bundler-fixture 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +3 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +46 -0
- data/Rakefile +6 -0
- data/bundler-fixture.gemspec +25 -0
- data/lib/bundler/fixture.rb +46 -0
- data/lib/bundler/fixture/version.rb +5 -0
- metadata +98 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 75221a464952c7a7e15ed2f89fd1e92f6a4e3ef7
|
4
|
+
data.tar.gz: 6c9bce77f8597ed4ef05581978cc44e6e3cb7eb4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 508ec05c652c3b9049d59662f8b7b5a995786207907cb6148d6c5fae464bdc27afccf959e14ade30d364434301ed4889d5c0c949804df85a91edee145213c49e
|
7
|
+
data.tar.gz: a580b2642fe0718185a7d5f7b2db23b1ce7908e70d49d6981cef6a35cf049f1e43cf0629533e7ab26f1f746d0b6c69592c17b1553711059a2061ba899ea5133b
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Chris Morris
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# Bundler::Fixture
|
2
|
+
|
3
|
+
A simple fixture to generate a for-realz Gemfile.lock with completely fake data.
|
4
|
+
|
5
|
+
Bundler has wonderful [fixture tooling](https://github.com/bundler/bundler/blob/master/spec/support/builders.rb) for testing itself, but it's pretty elaborate and hard (for a knucklehead like me) to re-use. I cobbled this together and wanted to re-use it elsewhere and decided to package it up separately.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'bundler-fixture'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install bundler-fixture
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
require 'bundler/fixture'
|
26
|
+
|
27
|
+
bf = BundlerFixture.new(dir: Dir.tmpdir)
|
28
|
+
bf.create_lockfile(gem_specs: bf.create_spec('foo', '1.4.5'))
|
29
|
+
|
30
|
+
`BundlerFixture` takes the gem specs and builds an index with the contents, and sets up other dependencies so a `Gemfile.lock` can be built reflecting the dependency tree in all of the passed specs with `Bundler::Definition`. This ensures `Bundler::LockfileParser` will be able to parse the file successfully, handy for testing your own code that's working programatically with its output.
|
31
|
+
|
32
|
+
## Development
|
33
|
+
|
34
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
35
|
+
|
36
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
37
|
+
|
38
|
+
## Contributing
|
39
|
+
|
40
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/chrismo/bundler-fixture.
|
41
|
+
|
42
|
+
|
43
|
+
## License
|
44
|
+
|
45
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
46
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'bundler/fixture/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'bundler-fixture'
|
8
|
+
spec.version = Bundler::Fixture::VERSION
|
9
|
+
spec.authors = ['chrismo']
|
10
|
+
spec.email = ['chrismo@clabs.org']
|
11
|
+
|
12
|
+
spec.summary = %q{Simple fixture to generate for-realz Gemfile.lock files}
|
13
|
+
# spec.description = %q{TODO: Write a longer description or delete this line.}
|
14
|
+
spec.homepage = 'https://github.com/chrismo/bundler-fixture'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = 'exe'
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
23
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
24
|
+
spec.add_development_dependency 'rspec'
|
25
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'bundler/fixture/version'
|
2
|
+
|
3
|
+
class BundlerFixture
|
4
|
+
attr_reader :dir
|
5
|
+
|
6
|
+
def initialize(dir: File.join(Dir.tmpdir, 'fake_project_root'))
|
7
|
+
@dir = dir
|
8
|
+
FileUtils.makedirs @dir
|
9
|
+
end
|
10
|
+
|
11
|
+
def clean_up
|
12
|
+
FileUtils.rmtree @dir
|
13
|
+
end
|
14
|
+
|
15
|
+
def create_lockfile(gem_specs:)
|
16
|
+
dir = @dir
|
17
|
+
index = Bundler::Index.new
|
18
|
+
deps = []
|
19
|
+
gem_specs.each do |g|
|
20
|
+
index << g
|
21
|
+
deps << Bundler::DepProxy.new(Bundler::Dependency.new(g.name, g.version), g.platform)
|
22
|
+
end
|
23
|
+
spec_set = Bundler::Resolver.resolve(deps, index)
|
24
|
+
|
25
|
+
sources = Bundler::SourceList.new
|
26
|
+
sources.add_rubygems_remote('https://rubygems.org')
|
27
|
+
spec_set.each { |s| s.source = sources.rubygems_sources.first }
|
28
|
+
|
29
|
+
gemfile_fn = File.join(dir, 'Gemfile.lock')
|
30
|
+
defn = Bundler::Definition.new(gemfile_fn, deps.map(&:dep), sources, true)
|
31
|
+
defn.instance_variable_set('@index', index)
|
32
|
+
defn.instance_variable_set('@resolve', spec_set)
|
33
|
+
defn.lock(gemfile_fn)
|
34
|
+
end
|
35
|
+
|
36
|
+
def create_spec(name, version, dependencies={})
|
37
|
+
Gem::Specification.new do |s|
|
38
|
+
s.name = name
|
39
|
+
s.version = Gem::Version.new(version)
|
40
|
+
s.platform = 'ruby'
|
41
|
+
dependencies.each do |name, requirement|
|
42
|
+
s.add_dependency name, requirement
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bundler-fixture
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- chrismo
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- chrismo@clabs.org
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- bin/console
|
70
|
+
- bin/setup
|
71
|
+
- bundler-fixture.gemspec
|
72
|
+
- lib/bundler/fixture.rb
|
73
|
+
- lib/bundler/fixture/version.rb
|
74
|
+
homepage: https://github.com/chrismo/bundler-fixture
|
75
|
+
licenses:
|
76
|
+
- MIT
|
77
|
+
metadata: {}
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 2.4.5.1
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: Simple fixture to generate for-realz Gemfile.lock files
|
98
|
+
test_files: []
|