Permalink
Browse files

Keep dots when generating a Gemfile

This also changes how punctuation that isn't "." is treated. Previously, it
would be removed, now it is converted to "_". Thus, `appraise "rails3.0!"` now
generates "rails3.0_.gemfile" where before it generated "rails30.gemfile".
  • Loading branch information...
Gabe Berke-Williams
Gabe Berke-Williams committed Nov 2, 2012
1 parent f0e9f6f commit d39712e7030a660e5c1323f0dbe331f6bcab343c
Showing with 14 additions and 4 deletions.
  1. +1 −1 lib/appraisal/appraisal.rb
  2. +13 −3 spec/appraisal/appraisal_spec.rb
@@ -48,7 +48,7 @@ def gemfile_root
end
def clean_name
- name.gsub(/\s+/, '_').gsub(/[^\w]/, '')
+ name.gsub(/[^\w\.]/, '_')
end
end
end
@@ -9,8 +9,18 @@
appraisal.bundle_command.should == "bundle check --gemfile='/home/test/test directory' || bundle install --gemfile='/home/test/test directory'"
end
- it "cleans up spaces and punctuation when outputting its gemfile" do
- appraisal = Appraisal::Appraisal.new("This! is my appraisal name.", "Gemfile")
- appraisal.gemfile_path.should =~ /This_is_my_appraisal_name.gemfile/
+ it "converts spaces to underscores in the gemfile path" do
+ appraisal = Appraisal::Appraisal.new("one two", "Gemfile")
+ appraisal.gemfile_path.should =~ /one_two\.gemfile$/
+ end
+
+ it "converts punctuation to underscores in the gemfile path" do
+ appraisal = Appraisal::Appraisal.new("o&ne!", "Gemfile")
+ appraisal.gemfile_path.should =~ /o_ne_\.gemfile$/
+ end
+
+ it "keeps dots in the gemfile path" do
+ appraisal = Appraisal::Appraisal.new("rails3.0", "Gemfile")
+ appraisal.gemfile_path.should =~ /rails3\.0\.gemfile$/
end
end

0 comments on commit d39712e

Please sign in to comment.