gemlock 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2011 Mike Skalnik, Brian Gardner, Jabari Worthy, Tyler Hastings
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,6 +1,7 @@
1
1
  require "bundler"
2
2
  require "rest_client"
3
3
  require "json"
4
+ require "yaml"
4
5
 
5
6
  require "gemlock/version"
6
7
 
@@ -54,5 +55,19 @@ module Gemlock
54
55
 
55
56
  return_hash
56
57
  end
58
+
59
+ def config_file
60
+ config_file = nil
61
+ config_file = if defined?(Rails)
62
+ Rails.root.join('config', 'gemlock.yml')
63
+ end
64
+ end
65
+
66
+ def parsed_config
67
+ parsed_config = nil
68
+ if(config_file)
69
+ parsed_config = YAML.load_file(config_file)
70
+ end
71
+ end
57
72
  end
58
73
  end
@@ -1,3 +1,3 @@
1
1
  module Gemlock
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -0,0 +1 @@
1
+ email : tester@example.com
@@ -0,0 +1,45 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: https://rubygems.org:443/api/v1/gems/rails.json
6
+ body: !!null
7
+ headers:
8
+ accept:
9
+ - ! '*/*; q=0.5, application/xml'
10
+ accept-encoding:
11
+ - gzip, deflate
12
+ response: !ruby/struct:VCR::Response
13
+ status: !ruby/struct:VCR::ResponseStatus
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ date:
18
+ - Fri, 23 Sep 2011 01:29:13 GMT
19
+ server:
20
+ - Apache/2.2.3 (Red Hat) mod_ssl/2.2.3 OpenSSL/0.9.8e-fips-rhel5 Phusion_Passenger/3.0.0
21
+ x-powered-by:
22
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.0
23
+ etag:
24
+ - ! '"4b5b6772f8e96c437381a9738a92924c"'
25
+ x-ua-compatible:
26
+ - IE=Edge,chrome=1
27
+ x-runtime:
28
+ - '0.024993'
29
+ cache-control:
30
+ - max-age=0, private, must-revalidate
31
+ status:
32
+ - '200'
33
+ transfer-encoding:
34
+ - chunked
35
+ content-type:
36
+ - application/json; charset=utf-8
37
+ body: ! '{"dependencies":{"runtime":[{"name":"actionmailer","requirements":"=
38
+ 3.1.0"},{"name":"actionpack","requirements":"= 3.1.0"},{"name":"activerecord","requirements":"=
39
+ 3.1.0"},{"name":"activeresource","requirements":"= 3.1.0"},{"name":"activesupport","requirements":"=
40
+ 3.1.0"},{"name":"bundler","requirements":"~> 1.0"},{"name":"railties","requirements":"=
41
+ 3.1.0"}],"development":[]},"name":"rails","downloads":5538650,"info":"Ruby on
42
+ Rails is a full-stack web framework optimized for programmer happiness and sustainable
43
+ productivity. It encourages beautiful code by favoring convention over configuration.","version_downloads":156960,"version":"3.1.0","homepage_uri":"http://www.rubyonrails.org","bug_tracker_uri":"http://rails.lighthouseapp.com/projects/8994-ruby-on-rails","source_code_uri":"http://github.com/rails/rails","gem_uri":"http://rubygems.org/gems/rails-3.1.0.gem","project_uri":"http://rubygems.org/gems/rails","authors":"David
44
+ Heinemeier Hansson","mailing_list_uri":"http://groups.google.com/group/rubyonrails-talk","documentation_uri":"http://api.rubyonrails.org","wiki_uri":"http://wiki.rubyonrails.org"}'
45
+ http_version: '1.1'
@@ -18,14 +18,22 @@ describe Gemlock do
18
18
 
19
19
  describe "#lockfile" do
20
20
  it "loads Gemfile.lock from the Rails root if Rails is defined" do
21
- Rails.stubs(:root).returns(Pathname.new(File.dirname(__FILE__)))
21
+ module Rails
22
+ def self.root
23
+ Pathname.new(File.expand_path('fixtures', File.dirname(__FILE__)))
24
+ end
25
+ end
22
26
 
23
- expected_path = Pathname.new(File.dirname(__FILE__)).join('Gemfile.lock')
27
+ expected_path = Pathname.new(File.expand_path(File.join('fixtures', 'Gemfile.lock'),
28
+ File.dirname(__FILE__)))
24
29
  Gemlock.lockfile.should eql expected_path
30
+
31
+ # Undefine Rails module
32
+ Object.send(:remove_const, :Rails)
25
33
  end
26
34
 
27
35
  it "loads Gemfile.lock from the default Bundler location if Rails is not defined" do
28
- expected_path = Pathname.new(File.expand_path(File.join(File.dirname(__FILE__), 'Gemfile.lock')))
36
+ expected_path = Pathname.new(File.expand_path(File.join('spec', 'fixtures', 'Gemfile.lock')))
29
37
 
30
38
  Gemlock.lockfile.should eql expected_path
31
39
  end
@@ -58,4 +66,39 @@ describe Gemlock do
58
66
  Gemlock.outdated.should eql expected
59
67
  end
60
68
  end
69
+
70
+ describe "#config_file" do
71
+ it "loads gemlock.yml from the config directory if Rails is defined" do
72
+ module Rails
73
+ def self.root
74
+ Pathname.new(File.dirname(__FILE__))
75
+ end
76
+ end
77
+
78
+ expected_path = Pathname.new(File.dirname(__FILE__)).join('config', 'gemlock.yml')
79
+ Gemlock.config_file.should eql expected_path
80
+
81
+ # Undefine Rails module
82
+ Object.send(:remove_const, :Rails)
83
+
84
+ end
85
+
86
+ it "is nil if Rails is not defined" do
87
+ Gemlock.config_file.should be_nil
88
+ end
89
+ end
90
+
91
+ describe "#parsed_config" do
92
+ it "returns nil if the config_file is not defined" do
93
+ Gemlock.parsed_config.should be_nil
94
+ end
95
+
96
+ it "returns a hash containing the user's email if config_file is defined" do
97
+ Gemlock.stubs(:config_file).returns((File.join(File.dirname(__FILE__), 'fixtures', 'gemlock.yml')))
98
+
99
+ expected = {'email' => "tester@example.com"}
100
+
101
+ Gemlock.parsed_config.should eql expected
102
+ end
103
+ end
61
104
  end
@@ -1,6 +1,5 @@
1
1
  require 'rubygems'
2
2
  require 'bundler'
3
- require 'rake'
4
3
 
5
4
  begin
6
5
  Bundler.require(:default, :development)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemlock
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mike Skalnik
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2011-09-28 00:00:00 Z
21
+ date: 2011-10-10 00:00:00 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: rake
@@ -175,6 +175,7 @@ files:
175
175
  - .travis.yml
176
176
  - Gemfile
177
177
  - Gemfile.lock
178
+ - LICENSE
178
179
  - README.markdown
179
180
  - Rakefile
180
181
  - gemlock.gemspec
@@ -185,8 +186,10 @@ files:
185
186
  - lib/tasks/gemlock.rake
186
187
  - spec/fixtures/Gemfile
187
188
  - spec/fixtures/Gemfile.lock
189
+ - spec/fixtures/gemlock.yml
188
190
  - spec/fixtures/vcr_cassettes/Gemlock/_lookup_version.yml
189
191
  - spec/fixtures/vcr_cassettes/Gemlock/_outdated.yml
192
+ - spec/fixtures/vcr_cassettes/rails_cassette.yml
190
193
  - spec/gemlock_spec.rb
191
194
  - spec/spec_helper.rb
192
195
  homepage: ""
@@ -225,7 +228,9 @@ summary: Get notified when there are updates for gems in your Rails application
225
228
  test_files:
226
229
  - spec/fixtures/Gemfile
227
230
  - spec/fixtures/Gemfile.lock
231
+ - spec/fixtures/gemlock.yml
228
232
  - spec/fixtures/vcr_cassettes/Gemlock/_lookup_version.yml
229
233
  - spec/fixtures/vcr_cassettes/Gemlock/_outdated.yml
234
+ - spec/fixtures/vcr_cassettes/rails_cassette.yml
230
235
  - spec/gemlock_spec.rb
231
236
  - spec/spec_helper.rb