Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skip comment lines in the gemfile #3

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/gem_dating/input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def gems

def gem_line(line)
return if line.strip == "end"
return if line =~ /^\s*#/

if line.start_with? "gem("
line.split("(")[1].split(",")[0]
Expand Down
11 changes: 11 additions & 0 deletions test/input_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,15 @@ def test_parens_are_serious_business
gems = GemDating::Input.new(pasteboard).gems
assert_equal ["rails", "sqlite3"], gems
end

def test_hash_alone_causes_confusion
pasteboard = <<-TEXT
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
#
gem "bcrypt", "~> 3.1"
TEXT
gems = GemDating::Input.new(pasteboard).gems
assert_equal ["tzinfo-data", "bcrypt"], gems
end
end