foy_ruby_handler 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 027aee02ba6bdd766585934a9b6b86a7e4d52a55
4
+ data.tar.gz: 59b5f13fe541d69dd083f9f8105d4db81f980820
5
+ SHA512:
6
+ metadata.gz: 4cf58a51ab8b5008007afe21340a06fef1a71967e5c99472fd954f8944556c1d2877067d5d27cd2be85c19e0fe2c1e49981346f926d7ce38dfcea5dcab3ef1ac
7
+ data.tar.gz: 83783ecaae943a009c4eff8341f8970dba4a25a408dd786446cfdec05f552c9033ecf1721ed2beedad713c15ddcfe0944031d7781e03ba381e01861b572033ff
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ foy-ruby-handler
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.0.0-p353
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in foy-ruby-handler.gemspec
4
4
  gemspec
@@ -17,8 +17,9 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
- gem.add_dependency('bundler', '>= 1.3.1')
20
+ gem.add_dependency('bundler', '>= 1.5.2')
21
21
 
22
- gem.add_development_dependency('rake', '>= 10.0.3')
23
- gem.add_development_dependency('rspec', '>= 2.13.0')
22
+ gem.add_development_dependency 'rake', '>= 10.1.1'
23
+ gem.add_development_dependency 'rspec', '>= 2.14.1'
24
+ gem.add_development_dependency 'byebug'
24
25
  end
@@ -9,12 +9,12 @@ module Foy
9
9
  lockfile = Bundler::LockfileParser.new(File.open(file, 'r').read)
10
10
  dependencies = lockfile.dependencies.collect(&:name)
11
11
  lockfile.specs.collect do |spec|
12
- "#{spec.name} #{spec.version}" if dependencies.include?(spec.name)
13
- end.compact.join("\n")
12
+ {name: spec.name, version: spec.version.to_s} if dependencies.include?(spec.name)
13
+ end.compact
14
14
  end
15
15
 
16
16
  def latest_version_for(gem)
17
- Gem.latest_version_for(gem).version
17
+ Gem.latest_version_for(gem).version rescue nil
18
18
  end
19
19
  end
20
20
  end
@@ -1,5 +1,5 @@
1
1
  module Foy
2
2
  module RubyHandler
3
- VERSION = "0.0.3"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -8,13 +8,13 @@ describe Foy::RubyHandler do
8
8
 
9
9
  it "uses bundler parser" do
10
10
  Bundler::LockfileParser.should_receive(:new)
11
- .with(File.open("spec/fixtures/Gemfile.lock", 'r'))
11
+ .with(File.open("spec/fixtures/Gemfile.lock", 'r').read)
12
12
  .and_call_original
13
13
  parse!
14
14
  end
15
15
 
16
16
  it "returns current dependencies (name and version)" do
17
- expect(parse!).to be_eql("rake 10.0.3\nrspec 2.13.0")
17
+ expect(parse!).to be_eql([{name: 'rake', version: '10.0.3'}, {name: 'rspec', version: '2.13.0'}])
18
18
  end
19
19
  end
20
20
 
@@ -22,7 +22,7 @@ describe Foy::RubyHandler do
22
22
  end
23
23
 
24
24
  describe "#latest_version_for" do
25
- let(:version) { mock(:version, version: "2.0.1") }
25
+ let(:version) { double(:version, version: "2.0.1") }
26
26
 
27
27
  it "uses rubygem" do
28
28
  Gem.should_receive(:latest_version_for).with("package").and_return(version)
@@ -33,5 +33,10 @@ describe Foy::RubyHandler do
33
33
  Gem.stub(:latest_version_for).with("package").and_return(version)
34
34
  expect(Foy::RubyHandler.latest_version_for("package")).to be_eql("2.0.1")
35
35
  end
36
+
37
+ it "returns nil if commands raises error" do
38
+ Gem.stub(:latest_version_for).and_raise("error")
39
+ expect(Foy::RubyHandler.latest_version_for("package")).to be_nil
40
+ end
36
41
  end
37
42
  end
data/spec/spec_helper.rb CHANGED
@@ -16,4 +16,5 @@ RSpec.configure do |config|
16
16
  config.order = 'random'
17
17
  end
18
18
 
19
+ require 'byebug'
19
20
  require 'foy_ruby_handler'
metadata CHANGED
@@ -1,64 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foy_ruby_handler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
- prerelease:
4
+ version: 0.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Roberto Soares
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-03-06 00:00:00.000000000 Z
11
+ date: 2014-02-11 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
- version: 1.3.1
19
+ version: 1.5.2
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
- version: 1.3.1
26
+ version: 1.5.2
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
- version: 10.0.3
33
+ version: 10.1.1
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
- version: 10.0.3
40
+ version: 10.1.1
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
- version: 2.13.0
47
+ version: 2.14.1
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
- version: 2.13.0
54
+ version: 2.14.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: byebug
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
62
69
  description: Gemfile/gemspec handler used by foy-worker
63
70
  email:
64
71
  - roberto.tech@gmail.com
@@ -69,7 +76,8 @@ extra_rdoc_files: []
69
76
  files:
70
77
  - .gitignore
71
78
  - .rspec
72
- - .rvmrc
79
+ - .ruby-gemset
80
+ - .ruby-version
73
81
  - Gemfile
74
82
  - LICENSE.txt
75
83
  - README.md
@@ -80,41 +88,36 @@ files:
80
88
  - lib/foy_ruby_handler/cli.rb
81
89
  - lib/foy_ruby_handler/version.rb
82
90
  - spec/fixtures/Gemfile
91
+ - spec/fixtures/Gemfile.lock
83
92
  - spec/lib/foy_ruby_handler/cli_spec.rb
84
93
  - spec/lib/foy_ruby_handler_spec.rb
85
94
  - spec/spec_helper.rb
86
95
  homepage: ''
87
96
  licenses: []
97
+ metadata: {}
88
98
  post_install_message:
89
99
  rdoc_options: []
90
100
  require_paths:
91
101
  - lib
92
102
  required_ruby_version: !ruby/object:Gem::Requirement
93
- none: false
94
103
  requirements:
95
- - - ! '>='
104
+ - - '>='
96
105
  - !ruby/object:Gem::Version
97
106
  version: '0'
98
- segments:
99
- - 0
100
- hash: -1969186774063330600
101
107
  required_rubygems_version: !ruby/object:Gem::Requirement
102
- none: false
103
108
  requirements:
104
- - - ! '>='
109
+ - - '>='
105
110
  - !ruby/object:Gem::Version
106
111
  version: '0'
107
- segments:
108
- - 0
109
- hash: -1969186774063330600
110
112
  requirements: []
111
113
  rubyforge_project:
112
- rubygems_version: 1.8.23
114
+ rubygems_version: 2.2.1
113
115
  signing_key:
114
- specification_version: 3
116
+ specification_version: 4
115
117
  summary: Gemfile/gemspec handler used by foy-worker
116
118
  test_files:
117
119
  - spec/fixtures/Gemfile
120
+ - spec/fixtures/Gemfile.lock
118
121
  - spec/lib/foy_ruby_handler/cli_spec.rb
119
122
  - spec/lib/foy_ruby_handler_spec.rb
120
123
  - spec/spec_helper.rb
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm 1.9.3@foy-ruby-handler --create