genlock 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4db33886dd93edbcec9745f4eb2b6a6c12dd5088
4
+ data.tar.gz: 6c97e8bdfaf06a885c75bbeed4871d3966dc7c42
5
+ SHA512:
6
+ metadata.gz: 7e07121757b3d9433ea71c6db29a2ff4740a5ade10e815a2e61e50ea8e97281692731256cfd32b4940cd4a96a74fd00e647f0ad76d325e6e96a7f58bc32c712d
7
+ data.tar.gz: c464fc5679aca19178ed244ca67e5a460e75a6049ff5ac59752023cdc61ac1e0ebf23825278d7ed2257e087e31b237333c58c22bfe46315cb96441cfc90be108
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Nicolas Sanguinetti <hi@nicolassanguinetti.info>
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,36 @@
1
+ # Generate Gemfile.lock from a `.gems` file
2
+
3
+ If you use any of the utilities that manage `.gems` file for ruby instead of
4
+ bundler (such as [dep][], [rpm][], or similar tools), and want to use tools that
5
+ assume you use Bundler (for example, deploying to Heroku), you can easily
6
+ generate a `Gemfile.lock` file from your `.gems` file using this tool.
7
+
8
+ This is what I put in my `Makefile`:
9
+
10
+ ``` Makefile
11
+ Gemfile: .gems
12
+ echo "source \"https://rubygems.org\"" > $@
13
+ echo "ruby \"$(shell ruby -e 'puts RUBY_VERSION')\"" >> $@
14
+ awk '{ print "gem \"" $$1 "\", \"" $$3 "\"" }' $< >> $@
15
+
16
+ Gemfile.lock: .gems
17
+ genlock $< > $@
18
+ ```
19
+
20
+ Now, whenever my `.gems` file changes, `make` will ensure I have the `Gemfile`
21
+ and `Gemfile.lock` files available for whatever tools that require them.
22
+
23
+ ## Installation
24
+
25
+ Clone the repository, then run `make install`. You can run `./configure --prefix
26
+ <prefix>` if you want to change the install location (by default `/usr/local`).
27
+
28
+ ...Or you can download the binary and drop it in your PATH, really. No need for
29
+ anything fancy :)
30
+
31
+ ## License
32
+
33
+ Distributed under an MIT license. See the [LICENSE](./LICENSE) file for details.
34
+
35
+ [dep]: https://github.com/djanowski/dep
36
+ [rpm]: https://github.com/elcuervo/rpm
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "open-uri"
4
+ require "erb"
5
+ require "genlock"
6
+
7
+ SPECS = Hash[Gem::Specification.latest_specs.map { |spec| [spec.name, spec] }]
8
+
9
+ def all_deps(name)
10
+ deps = SPECS[name].runtime_dependencies
11
+ [*deps, *deps.map { |d| all_deps(d.name) }]
12
+ end
13
+
14
+ gemfile = ARGF.read.split("\n")
15
+ user = Hash[gemfile.map { |line| line.split(/ -v |:/) }]
16
+
17
+ dep_names = (user.keys + user.keys.map { |name| all_deps(name) }.flatten.map { |d| d.name }).uniq
18
+ deps = Marshal.load(
19
+ open("https://rubygems.org/api/v1/dependencies?gems=#{dep_names.join(",")}")
20
+ ).select { |dep|
21
+ dep[:number] == SPECS[dep[:name]].version.to_s && dep[:platform] == RUBY_ENGINE
22
+ }
23
+
24
+ template = <<-EOT
25
+ GEM
26
+ remote: https://rubygems.org/
27
+ specs:<% deps.sort_by { |d| d[:name] }.each do |dep| %>
28
+ <%= dep[:name] %> (<%= dep[:number] %>)<% dep[:dependencies].sort_by { |n, _| n }.each do |name, version| %>
29
+ <%= name %><% if version != ">= 0" %> (<%= version %>)<% end %><% end %><% end %>
30
+
31
+ PLATFORMS
32
+ <%= RUBY_ENGINE %>
33
+
34
+ DEPENDENCIES<% user.sort_by { |n, _| n }.each do |name, version| %>
35
+ <%= name %> (= <%= version %>)<% end %>
36
+ EOT
37
+
38
+ puts ERB.new(template).result(binding)
@@ -0,0 +1,4 @@
1
+ require_relative "genlock/version"
2
+
3
+ module Genlock
4
+ end
@@ -0,0 +1,3 @@
1
+ module Genlock
2
+ VERSION = "1.0.0"
3
+ end
metadata ADDED
@@ -0,0 +1,50 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: genlock
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Nicolas Sanguinetti
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-05 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Genlock generates Gemfile.lock files from .gems files without the need
14
+ for Bundler
15
+ email:
16
+ - contacto@nicolassanguinetti.info
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - LICENSE
22
+ - README.md
23
+ - bin/genlock
24
+ - lib/genlock.rb
25
+ - lib/genlock/version.rb
26
+ homepage: http://github.com/foca/genlock
27
+ licenses:
28
+ - MIT
29
+ metadata: {}
30
+ post_install_message:
31
+ rdoc_options: []
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ requirements: []
45
+ rubyforge_project:
46
+ rubygems_version: 2.4.5.1
47
+ signing_key:
48
+ specification_version: 4
49
+ summary: 'Genlock: Generate Gemfile.lock files without Bundler'
50
+ test_files: []