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 CHANGED
@@ -2,4 +2,4 @@
2
2
  require File.join(File.dirname(__FILE__), *%w[.. lib rcr gem_sync])
3
3
 
4
4
  gem_list = (ARGV[0] || nil)
5
- Rcr::GemSync.install_gems
5
+ Rcr::GemSync.install_gems gem_list
data/gem_sync.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{gem_sync}
3
- s.version = "0.4.2"
3
+ s.version = "0.4.5"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new("= 1.2") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["Rob Sanheim @ Relevance"]
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.2'
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
- puts "Running gem_sync with list: #{gem_list}."
22
- @@gem_list = File.read(gem_list)
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
@@ -12,14 +12,19 @@ describe 'GemSync' do
12
12
  end
13
13
 
14
14
  it "allows overriding gem list file" do
15
- File.expects(:read).with("/my/gems.txt")
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
- File.expects(:read).with("/my/gems.txt")
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
 
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: 0.4.2
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Sanheim @ Relevance