runcoderun-gem_sync 1.1.4 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/examples/rcr/gem_sync_example.rb +51 -0
- data/gem_sync.gemspec +1 -1
- data/lib/rcr/gem_sync.rb +12 -2
- data/lib/runcoderun_gems.txt +8 -8
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.6
|
@@ -2,6 +2,10 @@ require 'examples/example_helper'
|
|
2
2
|
|
3
3
|
describe Rcr::GemSync do
|
4
4
|
|
5
|
+
def fake_gem(name, version)
|
6
|
+
OpenStruct.new(:name => name, :version => version)
|
7
|
+
end
|
8
|
+
|
5
9
|
describe "sync" do
|
6
10
|
it "should read gem list, install each gem, ..." do
|
7
11
|
gem_sync = Rcr::GemSync.new(["--github"])
|
@@ -42,6 +46,53 @@ EOL
|
|
42
46
|
end
|
43
47
|
end
|
44
48
|
|
49
|
+
describe "installed?" do
|
50
|
+
describe "is rspec installed?" do
|
51
|
+
it "should be installed if any version of rspec is installed" do
|
52
|
+
gem_sync = Rcr::GemSync.new
|
53
|
+
gem_sync.stubs(:installed_gems).returns([fake_gem('rspec', '1.2.0')])
|
54
|
+
gem_sync.installed?(OpenStruct.new(:name => "rspec")).should be_true
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should not be installed if rspec is not installed" do
|
58
|
+
gem_sync = Rcr::GemSync.new
|
59
|
+
gem_sync.stubs(:installed_gems).returns([fake_gem('shoulda', '1.2.0')])
|
60
|
+
gem_sync.installed?(OpenStruct.new(:name => "rspec")).should be_false
|
61
|
+
gem_sync.installed?(OpenStruct.new(:name => "rspec", :version => '1.2.0')).should be_false
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe "is rspec v1.2.3 installed?" do
|
66
|
+
it "should be installed if rspec v1.2.3 is installed" do
|
67
|
+
gem_sync = Rcr::GemSync.new
|
68
|
+
gem_sync.stubs(:installed_gems).returns([fake_gem('rspec', '1.2.3'), fake_gem('rspec', '1.3.0')])
|
69
|
+
gem_sync.installed?(fake_gem('rspec', '1.2.3')).should be_true
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should not be installed if rspec is installed, but v1.2.3 is not" do
|
73
|
+
gem_sync = Rcr::GemSync.new
|
74
|
+
gem_sync.stubs(:installed_gems).returns([fake_gem('rspec', '1.2.6'), fake_gem('rspec', '1.3.0')])
|
75
|
+
gem_sync.installed?(fake_gem('rspec', '1.2.3')).should be_false
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe "install_from_github" do
|
81
|
+
it "should not attempt to install if there are no dashes in the name" do
|
82
|
+
gem = fake_gem("somegem", '1.0.0')
|
83
|
+
gem_sync = Rcr::GemSync.new
|
84
|
+
gem_sync.expects(:run).never
|
85
|
+
gem_sync.install_from_github(gem)
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should attempt to install if there are dashes in the name" do
|
89
|
+
gem = fake_gem("user-gem", '1.0.0')
|
90
|
+
gem_sync = Rcr::GemSync.new
|
91
|
+
gem_sync.expects(:run).never
|
92
|
+
gem_sync.install_from_github(gem)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
45
96
|
describe "install!" do
|
46
97
|
it "should skip if already installed" do
|
47
98
|
gem = stub_everything("gem", :name => "foo")
|
data/gem_sync.gemspec
CHANGED
data/lib/rcr/gem_sync.rb
CHANGED
@@ -58,8 +58,17 @@ module Rcr
|
|
58
58
|
install_from_rubyforge(rubygem) || install_from_github(rubygem)
|
59
59
|
end
|
60
60
|
|
61
|
-
def
|
62
|
-
installed_gems.
|
61
|
+
def gem_installed?(name)
|
62
|
+
installed_gems.any? { |installed| installed.name == name }
|
63
|
+
end
|
64
|
+
|
65
|
+
def gem_version_installed?(version)
|
66
|
+
return true if version.nil?
|
67
|
+
installed_gems.any? { |installed| installed.version == version }
|
68
|
+
end
|
69
|
+
|
70
|
+
def installed?(requested)
|
71
|
+
gem_installed?(requested.name) && gem_version_installed?(requested.version)
|
63
72
|
end
|
64
73
|
|
65
74
|
def installed_gems
|
@@ -73,6 +82,7 @@ module Rcr
|
|
73
82
|
end
|
74
83
|
|
75
84
|
def install_from_github(rubygem)
|
85
|
+
return unless rubygem.name.include?("-")
|
76
86
|
cmd = "gem install #{rubygem.name} --no-ri --no-rdoc"
|
77
87
|
cmd << " --version #{rubygem.version}" if rubygem.version
|
78
88
|
cmd << " --source #{GITHUB}"
|
data/lib/runcoderun_gems.txt
CHANGED
@@ -21,7 +21,7 @@ arrayfields (4.7.3, 4.6.0)
|
|
21
21
|
authlogic
|
22
22
|
aws-s3
|
23
23
|
bacon
|
24
|
-
bcrypt-ruby (2.0.5, 2.0.3)
|
24
|
+
bcrypt-ruby (2.0.5, 2.0.3) +ruby_186
|
25
25
|
beanstalk-client
|
26
26
|
bj
|
27
27
|
bmabey-email_spec
|
@@ -69,7 +69,6 @@ extlib (0.9.12, 0.9.5)
|
|
69
69
|
ezamar
|
70
70
|
facets (2.5.2, 2.5.0, 2.4.5, 2.4.4, 2.4.1, 2.3.0, 2.2.1, 2.2.0, 2.1.3, 2.0.5)
|
71
71
|
facon
|
72
|
-
factory_girl
|
73
72
|
faker
|
74
73
|
fakeweb
|
75
74
|
fastercsv (1.4.0, 1.2.3)
|
@@ -116,7 +115,7 @@ jeremymcanally-stump
|
|
116
115
|
jnunemaker-twitter
|
117
116
|
jruby-openssl +jruby
|
118
117
|
jruby-rcov +jruby
|
119
|
-
jscruggs-metric_fu
|
118
|
+
jscruggs-metric_fu
|
120
119
|
json (1.1.4, 1.1.3) +ruby_186 +ruby_191
|
121
120
|
jsonbuilder
|
122
121
|
juggernaut
|
@@ -152,12 +151,12 @@ metaid (1.0)
|
|
152
151
|
metric_fu
|
153
152
|
mhennemeyer-output_catcher
|
154
153
|
mime-types (1.16, 1.15)
|
155
|
-
|
154
|
+
minitar
|
156
155
|
mislav-hanna
|
157
156
|
mislav-will_paginate (2.3.11, 2.3.4)
|
158
|
-
mixlib-cli
|
159
|
-
mixlib-config
|
160
|
-
mixlib-log
|
157
|
+
mixlib-cli
|
158
|
+
mixlib-config
|
159
|
+
mixlib-log
|
161
160
|
mocha (0.9.5, 0.9.4, 0.9.0)
|
162
161
|
mojombo-chronic
|
163
162
|
mojombo-grit (1.1.1, 0.9.4)
|
@@ -170,7 +169,7 @@ mwmitchell-material_girl
|
|
170
169
|
mysql (2.7) +ruby_186 +ruby_191
|
171
170
|
nagoro
|
172
171
|
net-ssh (2.0.11, 2.0.4)
|
173
|
-
newgem
|
172
|
+
newgem
|
174
173
|
nokogiri (1.3.2)
|
175
174
|
oauth
|
176
175
|
obsidian
|
@@ -275,6 +274,7 @@ technicalpickles-jeweler
|
|
275
274
|
term-ansicolor
|
276
275
|
termios
|
277
276
|
test-spec
|
277
|
+
test-unit (1.2.3) +ruby_191
|
278
278
|
thin
|
279
279
|
thinking_sphinx
|
280
280
|
thoughtbot-clearance
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: runcoderun-gem_sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Sanheim
|
@@ -52,6 +52,7 @@ files:
|
|
52
52
|
- lib/runcoderun_gems.txt
|
53
53
|
has_rdoc: false
|
54
54
|
homepage: http://github.com/runcoderun/gem_sync
|
55
|
+
licenses:
|
55
56
|
post_install_message:
|
56
57
|
rdoc_options:
|
57
58
|
- --charset=UTF-8
|
@@ -72,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
73
|
requirements: []
|
73
74
|
|
74
75
|
rubyforge_project:
|
75
|
-
rubygems_version: 1.
|
76
|
+
rubygems_version: 1.3.5
|
76
77
|
signing_key:
|
77
78
|
specification_version: 3
|
78
79
|
summary: gem_sync
|