runcoderun-gem_sync 1.1.1 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.1
1
+ 1.1.4
@@ -41,6 +41,12 @@ ZenTest (3.10.0, 3.9.2, 3.9.1, 3.8.0, 3.6.0)]
41
41
  end
42
42
 
43
43
  describe "parsing platforms" do
44
+ it "should return nil for no platforms" do
45
+ list = %[rambow_likes_gerbils (<= 7.3.2)]
46
+ gem = Rcr::GemParser.convert_gem_list(list).first
47
+ gem.platforms.should be_nil
48
+ end
49
+
44
50
  it "is parses a single platform" do
45
51
  list = %[rambow_likes_gerbils (<= 7.3.2) +ruby186]
46
52
  gem = Rcr::GemParser.convert_gem_list(list).first
@@ -2,12 +2,6 @@ require 'examples/example_helper'
2
2
 
3
3
  describe Rcr::GemSync do
4
4
 
5
- describe "creating a gem_sync" do
6
- it "saves github gem list source" do
7
- Rcr::GemSync.new(["--github"]).gem_list.should == Rcr::GemSync::RCR_GITHUB_GEM_LIST
8
- end
9
- end
10
-
11
5
  describe "sync" do
12
6
  it "should read gem list, install each gem, ..." do
13
7
  gem_sync = Rcr::GemSync.new(["--github"])
@@ -19,14 +13,22 @@ describe Rcr::GemSync do
19
13
  end
20
14
 
21
15
  describe "install_gems" do
22
- it "should iterate over each gem, and install unless already installed" do
16
+ it "should iterate over each gem and install!" do
23
17
  gem_sync = Rcr::GemSync.new(["--github"])
24
18
  gem_sync.expects(:read_gem_list).returns(<<-EOL)
25
19
  gem1 (1.0.0)
26
20
  gem2 (1.0.0)
27
21
  EOL
28
- gem_sync.stubs(:installed?).returns(true, false)
29
- gem_sync.expects(:install!).once
22
+ gem_sync.expects(:run).times(2).returns(true)
23
+ gem_sync.sync
24
+ end
25
+
26
+ it "should install gems that have no platform, even when gem sync platform is specified" do
27
+ gem_sync = Rcr::GemSync.new(["-p ruby191"])
28
+ gem_sync.expects(:read_gem_list).returns(<<-EOL)
29
+ gem1 (1.0.0)
30
+ EOL
31
+ gem_sync.expects(:run).once.returns(true)
30
32
  gem_sync.sync
31
33
  end
32
34
 
@@ -35,12 +37,20 @@ EOL
35
37
  gem_sync.expects(:read_gem_list).returns(<<-EOL)
36
38
  gem1 (1.0.0) +jruby130
37
39
  EOL
38
- gem_sync.expects(:install!).never
40
+ gem_sync.expects(:run).never
39
41
  gem_sync.sync
40
42
  end
41
43
  end
42
44
 
43
45
  describe "install!" do
46
+ it "should skip if already installed" do
47
+ gem = stub_everything("gem", :name => "foo")
48
+ gem_sync = Rcr::GemSync.new
49
+ gem_sync.expects(:installed?).with(gem).returns(true)
50
+ gem_sync.expects(:run).never
51
+ gem_sync.install!(gem)
52
+ end
53
+
44
54
  it "should try installing as rubyforge first" do
45
55
  gem = OpenStruct.new(:name => "foo", :version => "1.0.0")
46
56
  gem_sync = Rcr::GemSync.new
@@ -62,6 +72,11 @@ EOL
62
72
  Rcr::GemSync.new.platform_matches?(OpenStruct.new).should == true
63
73
  end
64
74
 
75
+ it "should return true if gem sync platform is specified and gem has no platform" do
76
+ gem_sync = Rcr::GemSync.new(["-p ruby191"])
77
+ gem_sync.platform_matches?(OpenStruct.new).should == true
78
+ end
79
+
65
80
  it "should return false gem sync and gem platform do not match" do
66
81
  gem_sync = Rcr::GemSync.new(["-p ruby191"])
67
82
  gem_sync.platform_matches?(OpenStruct.new(:platforms => ["jruby130"])).should == false
data/gem_sync.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{gem_sync}
8
- s.version = "1.1.1"
8
+ s.version = "1.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Rob Sanheim"]
12
- s.date = %q{2009-09-04}
12
+ s.date = %q{2009-09-06}
13
13
  s.default_executable = %q{gem_sync}
14
14
  s.description = %q{Tool to install rubygems for RunCodeRun, though it could be used to bootstrap your own machines as well.}
15
15
  s.email = %q{rob@runcoderun.com}
@@ -34,7 +34,8 @@ module Rcr
34
34
  end
35
35
 
36
36
  def self.parse_platforms(string)
37
- string.scan(/\+[\w-]+\b/).map! { |platform| platform.gsub!('+', '') }
37
+ platforms = string.scan(/\+[\w-]+\b/).map! { |platform| platform.gsub!('+', '') }
38
+ platforms.empty? ? nil : platforms
38
39
  end
39
40
 
40
41
 
data/lib/rcr/gem_sync.rb CHANGED
@@ -9,7 +9,6 @@ module Rcr
9
9
  RCR_GITHUB_GEM_LIST = "http://github.com/runcoderun/gem_sync/raw/master/lib/runcoderun_gems.txt"
10
10
  RCR_GITHUB_GEM_BLACKLIST = "http://github.com/runcoderun/gem_sync/raw/master/lib/gem_blacklist.txt"
11
11
 
12
- attr_accessor :gem_list
13
12
  def initialize(args = ["--github"])
14
13
  options = Rcr::OptionParsing.parse(args)
15
14
  @platform = options[:platform]
@@ -19,6 +18,12 @@ module Rcr
19
18
  system("gem env") if verbose?
20
19
  end
21
20
 
21
+ def sync
22
+ @gem_list = read_gem_list
23
+ @gems = parse_gems
24
+ install_gems
25
+ end
26
+
22
27
  def verbose?
23
28
  @verbose
24
29
  end
@@ -28,7 +33,7 @@ module Rcr
28
33
  end
29
34
 
30
35
  def read_gem_list
31
- open(gem_list).read
36
+ open(@gem_list).read
32
37
  end
33
38
 
34
39
  def platform_matches?(gem)
@@ -39,22 +44,18 @@ module Rcr
39
44
  end
40
45
  end
41
46
 
42
- def sync
43
- @gem_list = read_gem_list
44
- @gems = parse_gems
45
- install_gems
46
- end
47
-
48
47
  def parse_gems
49
48
  @gems = Rcr::GemParser.convert_gem_list(@gem_list)
50
49
  end
51
50
 
52
51
  def install_gems
53
- @gems.each do |rubygem|
54
- next unless platform_matches?(rubygem)
55
- next if installed?(rubygem)
56
- install!(rubygem)
57
- end
52
+ @gems.each { |rubygem| install!(rubygem) }
53
+ end
54
+
55
+ def install!(rubygem)
56
+ return unless platform_matches?(rubygem)
57
+ return if installed?(rubygem)
58
+ install_from_rubyforge(rubygem) || install_from_github(rubygem)
58
59
  end
59
60
 
60
61
  def installed?(rubygem)
@@ -65,10 +66,6 @@ module Rcr
65
66
  @installed_gems ||= Rcr::GemParser.convert_gem_list(`gem list`)
66
67
  end
67
68
 
68
- def install!(rubygem)
69
- install_from_rubyforge(rubygem) || install_from_github(rubygem)
70
- end
71
-
72
69
  def install_from_rubyforge(rubygem)
73
70
  cmd = "gem install #{rubygem.name} --no-ri --no-rdoc"
74
71
  cmd << " --version #{rubygem.version}" if rubygem.version
@@ -9,21 +9,21 @@ activerecord (2.3.2, 2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.2, 2.0.1, 1.15.6)
9
9
  activeresource (2.3.2, 2.2.2, 2.1.2, 2.1.0, 2.0.2, 2.0.1)
10
10
  activesupport (2.3.2, 2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.2, 2.0.1, 1.4.4)
11
11
  activemerchant
12
- acts_as_reportable (1.1.1)
12
+ acts_as_reportable
13
13
  addressable (2.0.2, 1.0.4)
14
- allison (2.0.3)
14
+ allison
15
15
  andand
16
16
  andre-geokit
17
17
  antage-postgres +ruby_191
18
- archive-tar-minitar (0.5.2)
18
+ archive-tar-minitar
19
19
  ar-extensions
20
20
  arrayfields (4.7.3, 4.6.0)
21
21
  authlogic
22
22
  aws-s3
23
23
  bacon
24
24
  bcrypt-ruby (2.0.5, 2.0.3)
25
- beanstalk-client (1.0.2)
26
- bj (1.0.1)
25
+ beanstalk-client
26
+ bj
27
27
  bmabey-email_spec
28
28
  builder (2.1.2)
29
29
  cache_money
@@ -36,11 +36,11 @@ chronic
36
36
  coderay
37
37
  colors
38
38
  configatron (2.2.2, 2.1.5)
39
- configuration (0.0.5)
39
+ configuration
40
40
  context
41
41
  crack
42
42
  csv-mapper (0.0.3)
43
- cucumber (0.3.96, 0.3.94, 0.3.92, 0.3.9, 0.3.11, 0.3.0)
43
+ cucumber (0.3.96, 0.3.94, 0.3.92, 0.3.9)
44
44
  curb +ruby_186 +ruby_191
45
45
  daemons
46
46
  dancroak-clearance
@@ -80,7 +80,7 @@ feedvalidator
80
80
  ferret
81
81
  fireeagle
82
82
  flay (1.3.0, 1.2.1)
83
- flexmock (0.8.6, 0.8.3, 0.8.2)
83
+ flexmock
84
84
  flog (2.1.0, 2.0.0, 1.1.0)
85
85
  freelancing-god-ginger
86
86
  freelancing-god-thinking-sphinx
@@ -106,7 +106,7 @@ httpauth
106
106
  httpclient
107
107
  ianwhite-garlic
108
108
  icalendar (1.1.0, 1.0.2)
109
- image_science (1.1.3) +ruby_186 +ruby_191
109
+ image_science +ruby_186 +ruby_191
110
110
  innate
111
111
  javan-whenever
112
112
  jeremymcanally-context
@@ -124,7 +124,7 @@ kematzy-sinatra-cache
124
124
  lame_encoder
125
125
  launchy (0.3.3, 0.3.2)
126
126
  less
127
- libxml-ruby (1.1.3, 0.9.8, 0.8.3) +ruby_186 +ruby_191
127
+ libxml-ruby +ruby_186 +ruby_191
128
128
  Linguistics
129
129
  liquid
130
130
  locale
@@ -248,7 +248,7 @@ ruby-xslt
248
248
  rubyist-aasm
249
249
  runcoderun-configatron
250
250
  runcoderun-gem_sync
251
- ruport (1.6.1)
251
+ ruport
252
252
  schacon-git (1.0.7)
253
253
  selenium
254
254
  selenium-client
@@ -267,14 +267,14 @@ stomp
267
267
  stone
268
268
  syntax
269
269
  systemu (1.2.0)
270
- system_timer (1.0)
270
+ system_timer +ruby_186 +ruby_191
271
271
  taf2-curb
272
272
  tagz
273
273
  technicalpickles-echoe
274
274
  technicalpickles-jeweler
275
275
  term-ansicolor
276
276
  termios
277
- test-spec (0.10.0, 0.9.0)
277
+ test-spec
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.1
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Sanheim
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-04 00:00:00 -07:00
12
+ date: 2009-09-06 00:00:00 -07:00
13
13
  default_executable: gem_sync
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -52,7 +52,6 @@ files:
52
52
  - lib/runcoderun_gems.txt
53
53
  has_rdoc: false
54
54
  homepage: http://github.com/runcoderun/gem_sync
55
- licenses:
56
55
  post_install_message:
57
56
  rdoc_options:
58
57
  - --charset=UTF-8
@@ -73,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
72
  requirements: []
74
73
 
75
74
  rubyforge_project:
76
- rubygems_version: 1.3.5
75
+ rubygems_version: 1.2.0
77
76
  signing_key:
78
77
  specification_version: 3
79
78
  summary: gem_sync