runcoderun-rcr_gem_sync 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt ADDED
@@ -0,0 +1,4 @@
1
+ === 0.2.0 / 2008-09-05
2
+
3
+ * added bin
4
+ * renamed
data/Manifest ADDED
@@ -0,0 +1,9 @@
1
+ bin/rcr_gem_sync
2
+ History.txt
3
+ lib/rcr/gem_sync.rb
4
+ lib/runcoderun_gems.txt
5
+ Manifest
6
+ Manifest.txt
7
+ Rakefile
8
+ README.txt
9
+ spec/gem_sync_spec.rb
data/Manifest.txt ADDED
@@ -0,0 +1,7 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ bin/gem_test
6
+ lib/gem_test.rb
7
+ test/test_gem_test.rb
data/README.txt ADDED
@@ -0,0 +1,48 @@
1
+ = GemTest
2
+
3
+ * FIX (url)
4
+
5
+ == DESCRIPTION:
6
+
7
+ FIX (describe your package)
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ * FIX (list of features or problems)
12
+
13
+ == SYNOPSIS:
14
+
15
+ FIX (code sample of usage)
16
+
17
+ == REQUIREMENTS:
18
+
19
+ * FIX (list of requirements)
20
+
21
+ == INSTALL:
22
+
23
+ * FIX (sudo gem install, anything else)
24
+
25
+ == LICENSE:
26
+
27
+ (The MIT License)
28
+
29
+ Copyright (c) 2008 FIX
30
+
31
+ Permission is hereby granted, free of charge, to any person obtaining
32
+ a copy of this software and associated documentation files (the
33
+ 'Software'), to deal in the Software without restriction, including
34
+ without limitation the rights to use, copy, modify, merge, publish,
35
+ distribute, sublicense, and/or sell copies of the Software, and to
36
+ permit persons to whom the Software is furnished to do so, subject to
37
+ the following conditions:
38
+
39
+ The above copyright notice and this permission notice shall be
40
+ included in all copies or substantial portions of the Software.
41
+
42
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
43
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
46
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
47
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
48
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ require 'rubygems'
2
+ require 'echoe'
3
+ require './lib/rcr/gem_sync.rb'
4
+
5
+ Echoe.new('rcr_gem_sync', Rcr::GemSync::VERSION) do |p|
6
+ p.rubyforge_name = 'rcr_gem_sync'
7
+ p.email = 'rob@runcoderun.com'
8
+ p.author = ["Rob Sanheim @ Relevance"]
9
+ p.summary = "Tool to install dependancies for RunCodeRun, though it could be used to bootstrap your own machines as well."
10
+ p.url = "http://runcoderun.com"
11
+ p.test_pattern = 'spec/**/*_spec.rb'
12
+ end
data/bin/rcr_gem_sync ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require File.join(File.dirname(__FILE__), *%w[.. lib rcr gem_sync])
3
+
4
+ Rcr::GemSync.install_gems
@@ -0,0 +1,59 @@
1
+ require 'ostruct'
2
+
3
+ module Rcr
4
+ class GemSync
5
+ VERSION = '0.2.0'
6
+ GITHUB = "http://gems.github.com"
7
+ RCR_GEM_LIST = File.expand_path(File.join(File.dirname(__FILE__), *%w[.. runcoderun_gems.txt]))
8
+
9
+ def self.install_gems
10
+ gem_list = File.read(RCR_GEM_LIST)
11
+ convert_gem_list(gem_list).each do |gem|
12
+ if gem_installed?(gem.name, gem.version)
13
+ puts "skipping #{gem.name} #{gem.version}"
14
+ next
15
+ end
16
+ cmd = "gem install #{gem.name} --no-ri --no-rdoc"
17
+ cmd << " --version #{gem.version}" if gem.version
18
+ puts cmd
19
+ puts `#{cmd}`
20
+ unless $?.success?
21
+ cmd << " --source #{GITHUB}"
22
+ puts "***** WARNING Trying to install gem #{gem.name} from github - watch for security issues."
23
+ puts cmd
24
+ puts `#{cmd}`
25
+ end
26
+ end
27
+ end
28
+
29
+ def self.convert_gem_list(string)
30
+ gems = []
31
+ string.each do |line|
32
+ name = parse_name(line)
33
+ next unless name
34
+ versions = parse_versions(line)
35
+ versions.each do |version|
36
+ gems << OpenStruct.new(:name => name, :version => version.strip)
37
+ end
38
+ end
39
+ gems
40
+ end
41
+
42
+ def self.parse_name(string)
43
+ string.match(/[\w\-_]*/)[0]
44
+ end
45
+
46
+ def self.parse_versions(string)
47
+ string.scan(/([\d\.]+)/).flatten
48
+ end
49
+
50
+ def self.gem_installed?(name, version)
51
+ installed_gems.detect {|gem| gem.name == name && gem.version == version}
52
+ end
53
+
54
+ def self.installed_gems
55
+ @installed_gems ||= convert_gem_list `gem list`
56
+ end
57
+
58
+ end
59
+ end
@@ -0,0 +1,78 @@
1
+ activesupport (2.1.1, 2.1.0, 2.0.2, 2.0.1, 1.4.4)
2
+ acts_as_reportable (1.1.1)
3
+ allison (2.0.3)
4
+ archive-tar-minitar (0.5.2)
5
+ arrayfields (4.6.0)
6
+ bcrypt-ruby (2.0.3)
7
+ beanstalk-client (1.0.2)
8
+ bj (1.0.1)
9
+ builder (2.1.2)
10
+ camping (1.5)
11
+ color (1.4.0)
12
+ daemons (1.0.10)
13
+ diff-lcs (1.1.2)
14
+ echoe (3)
15
+ facets (2.4.4, 2.4.1, 2.3.0, 2.2.1, 2.2.0, 2.1.3, 2.0.5)
16
+ factory_girl
17
+ fastercsv (1.2.3)
18
+ fattr (1.0.3)
19
+ flexmock (0.8.2)
20
+ flog (1.1.0)
21
+ git (1.0.5)
22
+ god (0.7.8)
23
+ haml (2.0.2, 2.0.1)
24
+ heckle (1.4.1)
25
+ highline (1.4.0)
26
+ htmlentities (4.0.0)
27
+ hoe (1.7.0)
28
+ hpricot (0.6)
29
+ icalendar (1.0.2)
30
+ image_science (1.1.3)
31
+ json (1.1.3)
32
+ launchy (0.3.2)
33
+ libxml-ruby (0.8.3)
34
+ log_buddy (0.0.5)
35
+ main (2.8.2)
36
+ markaby (0.5)
37
+ metaid (1.0)
38
+ mime-types (1.15)
39
+ mocha (0.9.0)
40
+ mosquito (0.1.3)
41
+ mysql (2.7)
42
+ open4 (0.9.6)
43
+ orderedhash (0.0.4)
44
+ ParseTree (2.2.0)
45
+ pdf-writer (1.1.8)
46
+ picnic (0.6.4)
47
+ polyglot (0.2.3)
48
+ quietbacktrace
49
+ rack (0.4.0)
50
+ rails (2.1.0, 2.0.2, 2.0.1, 1.2.6)
51
+ rake (0.8.1)
52
+ rcov (0.8.1.2.0)
53
+ RedCloth (4.0.3, 4.0.1, 3.0.4, 3.0.3)
54
+ redgreen (1.2.2)
55
+ relevance-github_hook (0.5.8)
56
+ rest-client (0.7)
57
+ rmagick (2.5.2)
58
+ rspec (1.1.4)
59
+ ruby-debug
60
+ ruby-json (1.1.2)
61
+ ruby2ruby (1.1.9)
62
+ rubyforge (1.0.0)
63
+ RubyInline (3.7.0)
64
+ ruport (1.6.1)
65
+ Shoulda (1.1.1)
66
+ sql-parser (0.0.2)
67
+ sqlite3-ruby (1.2.1)
68
+ systemu (1.2.0)
69
+ technicalpickles-echoe (3)
70
+ test-spec (0.9.0)
71
+ tinder (1.1.7)
72
+ transaction-simple (1.4.0)
73
+ treetop (1.2.4)
74
+ uuidtools (1.0.3)
75
+ validatable (1.6.7)
76
+ wikitext (1.1.99)
77
+ will_paginate (2.2.2)
78
+ ZenTest (3.10.0)
@@ -0,0 +1,81 @@
1
+
2
+ # Gem::Specification for Rcr_gem_sync-0.2.0
3
+ # Originally generated by Echoe
4
+
5
+ --- !ruby/object:Gem::Specification
6
+ name: rcr_gem_sync
7
+ version: !ruby/object:Gem::Version
8
+ version: 0.2.0
9
+ platform: ruby
10
+ authors:
11
+ - Rob Sanheim @ Relevance
12
+ autorequire:
13
+ bindir: bin
14
+
15
+ date: 2008-09-20 00:00:00 -04:00
16
+ default_executable:
17
+ dependencies:
18
+ - !ruby/object:Gem::Dependency
19
+ name: echoe
20
+ type: :development
21
+ version_requirement:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: "0"
27
+ version:
28
+ description: Tool to install dependancies for RunCodeRun, though it could be used to bootstrap your own machines as well.
29
+ email: rob@runcoderun.com
30
+ executables:
31
+ - rcr_gem_sync
32
+ extensions: []
33
+
34
+ extra_rdoc_files:
35
+ - bin/rcr_gem_sync
36
+ - lib/rcr/gem_sync.rb
37
+ - lib/runcoderun_gems.txt
38
+ - README.txt
39
+ files:
40
+ - bin/rcr_gem_sync
41
+ - History.txt
42
+ - lib/rcr/gem_sync.rb
43
+ - lib/runcoderun_gems.txt
44
+ - Manifest
45
+ - Manifest.txt
46
+ - Rakefile
47
+ - README.txt
48
+ - spec/gem_sync_spec.rb
49
+ - rcr_gem_sync.gemspec
50
+ has_rdoc: true
51
+ homepage: http://runcoderun.com
52
+ post_install_message:
53
+ rdoc_options:
54
+ - --line-numbers
55
+ - --inline-source
56
+ - --title
57
+ - Rcr_gem_sync
58
+ - --main
59
+ - README.txt
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: "0"
67
+ version:
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - "="
71
+ - !ruby/object:Gem::Version
72
+ version: "1.2"
73
+ version:
74
+ requirements: []
75
+
76
+ rubyforge_project: rcr_gem_sync
77
+ rubygems_version: 1.2.0
78
+ specification_version: 2
79
+ summary: Tool to install dependancies for RunCodeRun, though it could be used to bootstrap your own machines as well.
80
+ test_files:
81
+ - spec/gem_sync_spec.rb
@@ -0,0 +1,65 @@
1
+ require 'test/spec'
2
+
3
+ require File.join(File.dirname(__FILE__), *%w[.. lib rcr gem_sync])
4
+
5
+ describe 'GemSync' do
6
+
7
+ describe "parsing a gem list" do
8
+ it "parses gem list" do
9
+ list = %[wirble (0.1.2)
10
+ xml-simple (1.0.11)
11
+ ZenTest (3.10.0, 3.9.2, 3.9.1, 3.8.0, 3.6.0)]
12
+ gems = Rcr::GemSync.convert_gem_list(list)
13
+ gems[0].name.should == "wirble"
14
+ gems[0].version.should == "0.1.2"
15
+ gems[1].name.should == "xml-simple"
16
+ gems[1].version.should == "1.0.11"
17
+ gems[2..-1].each { |gem| gem.name.should == "ZenTest"}
18
+ gems[2].version.should == "3.10.0"
19
+ gems[3].version.should == "3.9.2"
20
+ end
21
+ end
22
+
23
+ describe "parsing versions" do
24
+ it "parses single version" do
25
+ versions = Rcr::GemSync.parse_versions("foo (1.0.10)")
26
+ versions[0].should == "1.0.10"
27
+ end
28
+
29
+ it "parses single digit version" do
30
+ versions = Rcr::GemSync.parse_versions("echoe (3)")
31
+ versions[0].should == "3"
32
+ end
33
+
34
+ it "parses four digit versions" do
35
+ versions = Rcr::GemSync.parse_versions("fiveruns-memcache-client (1.5.0.3)")
36
+ versions[0].should == "1.5.0.3"
37
+ end
38
+
39
+ it "parses with multiple versions" do
40
+ versions = Rcr::GemSync.parse_versions("foo (1.0.10, 1.0.11)")
41
+ versions[0].should == "1.0.10"
42
+ versions[1].should == "1.0.11"
43
+ end
44
+ end
45
+
46
+ describe "parsing gem names" do
47
+
48
+ it "parses gem name without versions" do
49
+ Rcr::GemSync.parse_name("factory-girl").should == "factory-girl"
50
+ end
51
+
52
+ it "parses simple gem name" do
53
+ Rcr::GemSync.parse_name("daemons (1.0.10)").should == "daemons"
54
+ end
55
+
56
+ it "parses name with dashes" do
57
+ Rcr::GemSync.parse_name("diff-lcs (1.0.10)").should == "diff-lcs"
58
+ end
59
+
60
+ it "parses name with underscores" do
61
+ Rcr::GemSync.parse_name("spec_converter_foo (1.0.10)").should == "spec_converter_foo"
62
+ end
63
+ end
64
+
65
+ end
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: runcoderun-rcr_gem_sync
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.4
5
+ platform: ruby
6
+ authors:
7
+ - Rob Sanheim @ Relevance
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-09-10 00:00:00 -07:00
13
+ default_executable: rcr_gem_sync
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: echoe
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: "0"
23
+ version:
24
+ description: Tool to install dependancies for RunCodeRun, though it coudl be used to bootstrap your own machines as well.
25
+ email: rob@runcoderun.com
26
+ executables:
27
+ - rcr_gem_sync
28
+ extensions: []
29
+
30
+ extra_rdoc_files:
31
+ - bin/rcr_gem_sync
32
+ - lib/rcr/gem_sync.rb
33
+ - lib/runcoderun_gems.txt
34
+ - README.txt
35
+ files:
36
+ - bin/rcr_gem_sync
37
+ - History.txt
38
+ - lib/rcr/gem_sync.rb
39
+ - lib/runcoderun_gems.txt
40
+ - Manifest
41
+ - Manifest.txt
42
+ - Rakefile
43
+ - README.txt
44
+ - spec/gem_sync_spec.rb
45
+ - rcr_gem_sync.gemspec
46
+ has_rdoc: true
47
+ homepage: http://runcoderun.com
48
+ post_install_message:
49
+ rdoc_options:
50
+ - --line-numbers
51
+ - --inline-source
52
+ - --title
53
+ - Rcr_gem_sync
54
+ - --main
55
+ - README.txt
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: "0"
63
+ version:
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "="
67
+ - !ruby/object:Gem::Version
68
+ version: "1.2"
69
+ version:
70
+ requirements: []
71
+
72
+ rubyforge_project: rcr_gem_sync
73
+ rubygems_version: 1.2.0
74
+ signing_key:
75
+ specification_version: 2
76
+ summary: Tool to install dependancies for RunCodeRun, though it coudl be used to bootstrap your own machines as well.
77
+ test_files:
78
+ - spec/gem_sync_spec.rb