runcoderun-gem_sync 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -1
- data/gem_sync.gemspec +1 -1
- data/lib/rcr/gem_sync.rb +12 -2
- data/spec/gem_sync_spec.rb +14 -2
- metadata +1 -1
data/History.txt
CHANGED
@@ -1,7 +1,13 @@
|
|
1
|
+
=== 0.4.6
|
2
|
+
* Bug fixes
|
3
|
+
|
4
|
+
=== 0.4.5
|
5
|
+
* Allow reading gem list directly from a source on the web, using openuri
|
6
|
+
* Allow reading from the gem list on github directly with an arg of __from_github__ to #install_gems - this means I no longer have to push gem updates to grab new gems
|
7
|
+
|
1
8
|
=== 0.2.5
|
2
9
|
* rename to GemSync...github adds the name spacing anyways
|
3
10
|
|
4
11
|
=== 0.2.0 / 2008-09-05
|
5
|
-
|
6
12
|
* added bin
|
7
13
|
* renamed
|
data/gem_sync.gemspec
CHANGED
data/lib/rcr/gem_sync.rb
CHANGED
@@ -3,24 +3,34 @@ require 'open-uri'
|
|
3
3
|
|
4
4
|
module Rcr
|
5
5
|
class GemSync
|
6
|
-
VERSION = '0.4.
|
6
|
+
VERSION = '0.4.6'
|
7
7
|
GITHUB = "http://gems.github.com"
|
8
8
|
RCR_DEFAULT_GEM_LIST = File.expand_path(File.join(File.dirname(__FILE__), *%w[.. runcoderun_gems.txt]))
|
9
9
|
RCR_GITHUB_GEM_LIST = "http://github.com/runcoderun/gem_sync/tree/master%2Flib%2Fruncoderun_gems.txt?raw=true"
|
10
10
|
|
11
|
-
def self.install_gems(gem_list =
|
11
|
+
def self.install_gems(gem_list = nil)
|
12
|
+
gem_list = RCR_DEFAULT_GEM_LIST unless gem_list
|
13
|
+
puts "gem_list: #{gem_list.inspect}"
|
12
14
|
update_self
|
13
15
|
read_gem_list(gem_list)
|
14
16
|
install_gems_from_list
|
15
17
|
update_gems
|
16
18
|
end
|
17
19
|
|
20
|
+
def self.fail_if_gem_list_doesnt_exist(gem_list)
|
21
|
+
raise("gem_list should not be nil") unless gem_list
|
22
|
+
unless gem_list[0..3] == "http"
|
23
|
+
raise("file for gem_list #{gem_list} not found!") unless File.exists?(gem_list)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
18
27
|
def self.update_self
|
19
28
|
puts `gem update runcoderun-gem_sync --source #{GITHUB}`
|
20
29
|
end
|
21
30
|
|
22
31
|
def self.read_gem_list(gem_list)
|
23
32
|
list = gem_list == "__from_github__" ? RCR_GITHUB_GEM_LIST : gem_list
|
33
|
+
fail_if_gem_list_doesnt_exist(list)
|
24
34
|
puts "Running gem_sync with list: #{list}."
|
25
35
|
@@gem_list = open(list).read
|
26
36
|
end
|
data/spec/gem_sync_spec.rb
CHANGED
@@ -4,26 +4,38 @@ require File.join(File.dirname(__FILE__), *%w[.. lib rcr gem_sync])
|
|
4
4
|
|
5
5
|
describe 'GemSync' do
|
6
6
|
|
7
|
+
describe "calling gem_sync" do
|
8
|
+
end
|
9
|
+
|
7
10
|
describe "reading file" do
|
8
11
|
before do
|
9
12
|
Rcr::GemSync.stubs :update_self
|
10
13
|
Rcr::GemSync.stubs :install_gems_from_list
|
11
14
|
Rcr::GemSync.stubs :update_gems
|
12
15
|
end
|
16
|
+
|
17
|
+
it "uses default gem list for nil gem list" do
|
18
|
+
Rcr::GemSync.expects(:open).with(Rcr::GemSync::RCR_DEFAULT_GEM_LIST).returns(StringIO.new)
|
19
|
+
Rcr::GemSync.install_gems
|
20
|
+
Rcr::GemSync.expects(:open).with(Rcr::GemSync::RCR_DEFAULT_GEM_LIST).returns(StringIO.new)
|
21
|
+
Rcr::GemSync.install_gems nil
|
22
|
+
end
|
13
23
|
|
14
24
|
it "allows overriding gem list file" do
|
25
|
+
Rcr::GemSync.stubs(:fail_if_gem_list_doesnt_exist).returns(true)
|
15
26
|
Rcr::GemSync.expects(:open).with("/my/gems.txt").returns(StringIO.new)
|
16
27
|
Rcr::GemSync.install_gems "/my/gems.txt"
|
17
28
|
end
|
18
29
|
|
19
30
|
it "reads file for gem list" do
|
31
|
+
Rcr::GemSync.stubs(:fail_if_gem_list_doesnt_exist).returns(true)
|
20
32
|
Rcr::GemSync.expects(:open).with("/my/gems.txt").returns(StringIO.new)
|
21
33
|
Rcr::GemSync.read_gem_list "/my/gems.txt"
|
22
34
|
end
|
23
35
|
|
24
|
-
it "reads from gem list on github if passed
|
36
|
+
it "reads from gem list on github if passed github param" do
|
25
37
|
Rcr::GemSync.expects(:open).with(Rcr::GemSync::RCR_GITHUB_GEM_LIST).returns(StringIO.new)
|
26
|
-
Rcr::GemSync.install_gems "
|
38
|
+
Rcr::GemSync.install_gems "__from_github__"
|
27
39
|
end
|
28
40
|
|
29
41
|
end
|