rubygems-lock 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.travis.yml +12 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +58 -0
- data/Rakefile +12 -0
- data/lib/rubygems/lock.rb +21 -0
- data/lib/rubygems/lock/version.rb +5 -0
- data/rubygems-lock.gemspec +24 -0
- data/spec/rubygems-lock_spec.rb +63 -0
- metadata +90 -0
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Ryan Souza
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# Rubygems::Lock
|
2
|
+
|
3
|
+
Use Gemfile and Gemfile.lock with CLI rubygem
|
4
|
+
|
5
|
+
CLI rubygems are applications too. Make sure your users have the experience you developed, with real dependency handling, free from version mismatches.
|
6
|
+
|
7
|
+
|
8
|
+
## Is this sane ???
|
9
|
+
|
10
|
+
I'm not entirely sure...
|
11
|
+
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
# in xxxx.gemspec, replace
|
17
|
+
....
|
18
|
+
spec.add_dependency "bundler", "~> 1.0"
|
19
|
+
spec.add_development_dependency "rake"
|
20
|
+
spec.add_development_dependency "minitest"
|
21
|
+
...
|
22
|
+
|
23
|
+
# with
|
24
|
+
|
25
|
+
spec.add_locked_dependencies
|
26
|
+
```
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
# in the Gemfile
|
30
|
+
|
31
|
+
# replace
|
32
|
+
gemspec
|
33
|
+
|
34
|
+
# with
|
35
|
+
gem "bundler", "~> 1.0"
|
36
|
+
|
37
|
+
group :development do
|
38
|
+
gem "rake"
|
39
|
+
gem "minitest"
|
40
|
+
gem "rubygems-lock" # Don't forget this! :)
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
```bash
|
45
|
+
# remove Gemfile.lock from .gitignore,
|
46
|
+
# check it in to version control
|
47
|
+
git add Gemfile.lock
|
48
|
+
|
49
|
+
# bundle like normal
|
50
|
+
bundle install
|
51
|
+
|
52
|
+
# commit everything and cut a gem
|
53
|
+
gem build xxxx.gemspec
|
54
|
+
|
55
|
+
# the gem has all the dependencies locked
|
56
|
+
# to the versions you developed and tested with
|
57
|
+
gem spec xxxx-0.0.0.gem --ruby
|
58
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require "rubygems/lock/version"
|
2
|
+
|
3
|
+
class Gem::Specification
|
4
|
+
def add_locked_dependencies
|
5
|
+
require 'bundler'
|
6
|
+
bundle = Bundler.definition
|
7
|
+
|
8
|
+
development = bundle.specs_for([:development]).to_a
|
9
|
+
default = bundle.specs_for([:default]).to_a - development
|
10
|
+
|
11
|
+
default.each do |spec|
|
12
|
+
add_dependency spec.name, spec.version.to_s
|
13
|
+
end
|
14
|
+
|
15
|
+
if self.respond_to? :add_development_dependency
|
16
|
+
development.each do |spec|
|
17
|
+
add_development_dependency spec.name, spec.version.to_s
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rubygems/lock/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rubygems-lock"
|
8
|
+
spec.version = Rubygems::Lock::VERSION
|
9
|
+
spec.authors = ["Ryan Souza"]
|
10
|
+
spec.email = ["ryan@ryansouza.net"]
|
11
|
+
spec.description = %q{Use Gemfile and Gemfile.lock with CLI rubygems}
|
12
|
+
spec.summary = %q{CLI rubygems are applications too. Make sure your users have the experience you developed, with real dependency handling, free from version mismatches.}
|
13
|
+
spec.homepage = "https://github.com/ryansouza/rubygems-lock"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
# Verified with 1.0 through 1.3
|
21
|
+
spec.add_dependency "bundler", "~> 1.0"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "minitest"
|
24
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
|
3
|
+
require 'rubygems/lock'
|
4
|
+
|
5
|
+
# Uses this gem's Gemfile
|
6
|
+
|
7
|
+
describe "A gemspec with locked dependencies" do
|
8
|
+
before do
|
9
|
+
@gemspec = Gem::Specification.new do |spec|
|
10
|
+
spec.name = "fakespec"
|
11
|
+
spec.version = "1.0.0"
|
12
|
+
spec.authors = "nobody"
|
13
|
+
spec.add_locked_dependencies
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
it "includes the runtime dependencies with exact versions" do
|
18
|
+
deps = @gemspec.dependencies
|
19
|
+
deps = deps.select {|d| d.type == :runtime}
|
20
|
+
deps = deps.sort_by(&:name)
|
21
|
+
deps = deps.map {|d| [d.name.to_s, d.requirement.to_s]}
|
22
|
+
deps.must_equal [["rubygems-lock", "= #{Rubygems::Lock::VERSION}"]]
|
23
|
+
end
|
24
|
+
|
25
|
+
it "includes the development dependencies with exact versions" do
|
26
|
+
deps = @gemspec.dependencies
|
27
|
+
deps = deps.select {|d| d.type == :development}
|
28
|
+
deps = deps.sort_by(&:name)
|
29
|
+
deps = deps.map {|d| [d.name.to_s, d.requirement.to_s]}
|
30
|
+
deps.must_equal [["bundler", "= #{Bundler::VERSION}"], ["minitest", "= 4.7.0"], ["rake", "= 10.0.4"]]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "A gemspec without the ability to use development dependencies" do
|
35
|
+
before do
|
36
|
+
@gemspec = Gem::Specification.new do |spec|
|
37
|
+
spec.name = "fakespec"
|
38
|
+
spec.version = "1.0.0"
|
39
|
+
spec.authors = "nobody"
|
40
|
+
class << spec
|
41
|
+
undef_method :add_development_dependency
|
42
|
+
end
|
43
|
+
spec.add_locked_dependencies
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
it "includes the runtime dependencies with exact versions" do
|
48
|
+
deps = @gemspec.dependencies
|
49
|
+
deps = deps.select {|d| d.type == :runtime}
|
50
|
+
deps = deps.sort_by(&:name)
|
51
|
+
deps = deps.map {|d| [d.name.to_s, d.requirement.to_s]}
|
52
|
+
deps.must_equal [["rubygems-lock", "= #{Rubygems::Lock::VERSION}"]]
|
53
|
+
end
|
54
|
+
|
55
|
+
it "includes the development dependencies with exact versions" do
|
56
|
+
deps = @gemspec.dependencies
|
57
|
+
deps = deps.select {|d| d.type == :development}
|
58
|
+
deps = deps.sort_by(&:name)
|
59
|
+
deps = deps.map {|d| [d.name.to_s, d.requirement.to_s]}
|
60
|
+
deps.must_equal []
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rubygems-lock
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Ryan Souza
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-04-02 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: &2168535240 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2168535240
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rake
|
27
|
+
requirement: &2168534200 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2168534200
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: minitest
|
38
|
+
requirement: &2168533020 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2168533020
|
47
|
+
description: Use Gemfile and Gemfile.lock with CLI rubygems
|
48
|
+
email:
|
49
|
+
- ryan@ryansouza.net
|
50
|
+
executables: []
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- .gitignore
|
55
|
+
- .travis.yml
|
56
|
+
- Gemfile
|
57
|
+
- LICENSE.txt
|
58
|
+
- README.md
|
59
|
+
- Rakefile
|
60
|
+
- lib/rubygems/lock.rb
|
61
|
+
- lib/rubygems/lock/version.rb
|
62
|
+
- rubygems-lock.gemspec
|
63
|
+
- spec/rubygems-lock_spec.rb
|
64
|
+
homepage: https://github.com/ryansouza/rubygems-lock
|
65
|
+
licenses:
|
66
|
+
- MIT
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options: []
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 1.8.11
|
86
|
+
signing_key:
|
87
|
+
specification_version: 3
|
88
|
+
summary: CLI rubygems are applications too. Make sure your users have the experience
|
89
|
+
you developed, with real dependency handling, free from version mismatches.
|
90
|
+
test_files: []
|