Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' into rails

  • Loading branch information...
commit a979efec70fefb301cce43d55aaca60ef37b5990 2 parents 4de0a1c + da688ab
@winton authored
View
10 lib/gem_template/gems.rb
@@ -72,10 +72,10 @@ def gemset=(gemset)
end
@versions = (@gemsets[gemspec.name.to_sym] || {}).inject({}) do |hash, (key, value)|
- if !value.is_a?(::Hash)
+ if !value.is_a?(::Hash) && value
hash[key] = value
elsif key == @gemset
- value.each { |k, v| hash[k] = v }
+ (value || {}).each { |k, v| hash[k] = v }
end
hash
end
@@ -88,9 +88,9 @@ def gemset=(gemset)
def gemset_names
(
- [ :default, :solo ] +
+ [ :default ] +
@gemsets[gemspec.name.to_sym].inject([]) { |array, (key, value)|
- array.push(key) if value.is_a?(::Hash)
+ array.push(key) if value.is_a?(::Hash) || value.nil?
array
}
).uniq
@@ -115,7 +115,7 @@ def deep_merge(first, second)
end
def dependency_filter(dependencies, match)
- dependencies.inject([]) { |array, value|
+ (dependencies || []).inject([]) { |array, value|
if value.is_a?(::Hash)
array += value[match.to_s] if value[match.to_s]
else
View
3  spec/fixtures/gemsets.yml
@@ -5,4 +5,5 @@ name:
rspec: =1.3.1
rspec2:
mysql2: =0.2.6
- rspec: =2.3.0
+ rspec: =2.3.0
+ solo: null
View
8 spec/fixtures/gemspec.yml
@@ -12,10 +12,4 @@ dependencies:
- mysql
- rspec2:
- mysql2
-development_dependencies:
- - default:
- - mysql
- - rspec
- - rspec2:
- - mysql2
- - rspec
+development_dependencies: null
View
69 spec/gem_template/gems_spec.rb
@@ -64,7 +64,8 @@
:rspec2 => {
:mysql2 => "=0.2.6",
:rspec => "=2.3.0"
- }
+ },
+ :solo => nil
}
}
end
@@ -80,7 +81,11 @@
it "should return proper values for Gems.dependencies" do
GemTemplate::Gems.dependencies.should == [ :rake, :mysql ]
- GemTemplate::Gems.development_dependencies.should == [ :mysql, :rspec ]
+ GemTemplate::Gems.development_dependencies.should == []
+ end
+
+ it "should return proper values for Gems.gemset_names" do
+ GemTemplate::Gems.gemset_names.should == [ :default, :rspec2, :solo ]
end
end
@@ -105,7 +110,8 @@
:rspec2 => {
:mysql2=>"=0.2.6",
:rspec => "=2.3.0"
- }
+ },
+ :solo => nil
}
}
end
@@ -120,7 +126,52 @@
it "should return proper values for Gems.dependencies" do
GemTemplate::Gems.dependencies.should == [ :rake, :mysql2 ]
- GemTemplate::Gems.development_dependencies.should == [ :mysql2, :rspec ]
+ GemTemplate::Gems.development_dependencies.should == []
+ end
+
+ it "should return proper values for Gems.gemset_names" do
+ GemTemplate::Gems.gemset_names.should == [ :default, :rspec2, :solo ]
+ end
+ end
+
+ describe :solo do
+ before(:each) do
+ GemTemplate::Gems.gemset = :solo
+ end
+
+ it "should set @gemset" do
+ GemTemplate::Gems.gemset.should == :solo
+ end
+
+ it "should set @gemsets" do
+ GemTemplate::Gems.gemsets.should == {
+ :name => {
+ :rake => ">0.8.6",
+ :default => {
+ :externals => '=1.0.2',
+ :mysql => "=2.8.1",
+ :rspec => "=1.3.1"
+ },
+ :rspec2 => {
+ :mysql2=>"=0.2.6",
+ :rspec => "=2.3.0"
+ },
+ :solo => nil
+ }
+ }
+ end
+
+ it "should set Gems.versions" do
+ GemTemplate::Gems.versions.should == {:rake=>">0.8.6"}
+ end
+
+ it "should return proper values for Gems.dependencies" do
+ GemTemplate::Gems.dependencies.should == [:rake]
+ GemTemplate::Gems.development_dependencies.should == []
+ end
+
+ it "should return proper values for Gems.gemset_names" do
+ GemTemplate::Gems.gemset_names.should == [ :default, :rspec2, :solo ]
end
end
@@ -168,10 +219,7 @@
{ "default" => [ "mysql" ] },
{ "rspec2" => [ "mysql2" ] }
],
- "development_dependencies" => [
- { "default" => [ "mysql", "rspec" ] },
- { "rspec2" => [ "mysql2", "rspec" ] }
- ]
+ "development_dependencies" => nil
}
end
@@ -188,10 +236,7 @@
{ "default" => ["mysql"] },
{ "rspec2" => [ "mysql2" ] }
]
- GemTemplate::Gems.gemspec.development_dependencies.should == [
- { "default" => [ "mysql", "rspec" ] },
- { "rspec2" => [ "mysql2", "rspec" ] }
- ]
+ GemTemplate::Gems.gemspec.development_dependencies.should == nil
end
it "should produce a valid gemspec" do
Please sign in to comment.
Something went wrong with that request. Please try again.