foy_ruby_handler 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Foy
2
2
  module RubyHandler
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -7,7 +7,10 @@ module Foy
7
7
  class << self
8
8
  def parse(file)
9
9
  lockfile = Bundler::LockfileParser.new(File.open(file, 'r').read)
10
- lockfile.specs.collect{|d| "#{d.name} #{d.version}"}.join("\n")
10
+ dependencies = lockfile.dependencies.collect(&:name)
11
+ lockfile.specs.collect do |spec|
12
+ "#{spec.name} #{spec.version}" if dependencies.include?(spec.name)
13
+ end.compact.join("\n")
11
14
  end
12
15
 
13
16
  def latest_version_for(gem)
@@ -4,17 +4,17 @@ describe Foy::RubyHandler do
4
4
 
5
5
  describe "#parse" do
6
6
  context "Gemfile.lock" do
7
- let(:parse!) {Foy::RubyHandler.parse("spec/fixtures/Gemfile")}
7
+ let(:parse!) {Foy::RubyHandler.parse("spec/fixtures/Gemfile.lock")}
8
8
 
9
9
  it "uses bundler parser" do
10
10
  Bundler::LockfileParser.should_receive(:new)
11
- .with("GEM\n remote: http://rubygems.org/\n specs:\n package (1.7.1)\n")
11
+ .with(File.open("spec/fixtures/Gemfile.lock", 'r'))
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("package 1.7.1")
17
+ expect(parse!).to be_eql("rake 10.0.3\nrspec 2.13.0")
18
18
  end
19
19
  end
20
20
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foy_ruby_handler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-05 00:00:00.000000000 Z
12
+ date: 2013-03-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -97,7 +97,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
97
97
  version: '0'
98
98
  segments:
99
99
  - 0
100
- hash: 2017061980129681664
100
+ hash: -1969186774063330600
101
101
  required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  none: false
103
103
  requirements:
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  segments:
108
108
  - 0
109
- hash: 2017061980129681664
109
+ hash: -1969186774063330600
110
110
  requirements: []
111
111
  rubyforge_project:
112
112
  rubygems_version: 1.8.23