runcoderun-gem_sync 0.4.2 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/gem_sync +1 -1
- data/gem_sync.gemspec +1 -1
- data/lib/rcr/gem_sync.rb +6 -3
- data/spec/gem_sync_spec.rb +7 -2
- metadata +1 -1
data/bin/gem_sync
CHANGED
data/gem_sync.gemspec
CHANGED
data/lib/rcr/gem_sync.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
require 'ostruct'
|
2
|
+
require 'open-uri'
|
2
3
|
|
3
4
|
module Rcr
|
4
5
|
class GemSync
|
5
|
-
VERSION = '0.4.
|
6
|
+
VERSION = '0.4.5'
|
6
7
|
GITHUB = "http://gems.github.com"
|
7
8
|
RCR_DEFAULT_GEM_LIST = File.expand_path(File.join(File.dirname(__FILE__), *%w[.. runcoderun_gems.txt]))
|
9
|
+
RCR_GITHUB_GEM_LIST = "http://github.com/runcoderun/gem_sync/tree/master%2Flib%2Fruncoderun_gems.txt?raw=true"
|
8
10
|
|
9
11
|
def self.install_gems(gem_list = RCR_DEFAULT_GEM_LIST)
|
10
12
|
update_self
|
@@ -18,8 +20,9 @@ module Rcr
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def self.read_gem_list(gem_list)
|
21
|
-
|
22
|
-
|
23
|
+
list = gem_list == "__from_github__" ? RCR_GITHUB_GEM_LIST : gem_list
|
24
|
+
puts "Running gem_sync with list: #{list}."
|
25
|
+
@@gem_list = open(list).read
|
23
26
|
end
|
24
27
|
|
25
28
|
def self.update_gems
|
data/spec/gem_sync_spec.rb
CHANGED
@@ -12,14 +12,19 @@ describe 'GemSync' do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it "allows overriding gem list file" do
|
15
|
-
|
15
|
+
Rcr::GemSync.expects(:open).with("/my/gems.txt").returns(StringIO.new)
|
16
16
|
Rcr::GemSync.install_gems "/my/gems.txt"
|
17
17
|
end
|
18
18
|
|
19
19
|
it "reads file for gem list" do
|
20
|
-
|
20
|
+
Rcr::GemSync.expects(:open).with("/my/gems.txt").returns(StringIO.new)
|
21
21
|
Rcr::GemSync.read_gem_list "/my/gems.txt"
|
22
22
|
end
|
23
|
+
|
24
|
+
it "reads from gem list on github if passed symbol :github_list" do
|
25
|
+
Rcr::GemSync.expects(:open).with(Rcr::GemSync::RCR_GITHUB_GEM_LIST).returns(StringIO.new)
|
26
|
+
Rcr::GemSync.install_gems "__gem_sync__"
|
27
|
+
end
|
23
28
|
|
24
29
|
end
|
25
30
|
|