ext_bundler 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fc9b564e1fe3d8f89ac344587963da844de0dd8c
4
+ data.tar.gz: 0c56afff90a1a2d63ff54ca8b79d7f09a30ef51b
5
+ SHA512:
6
+ metadata.gz: a36c422d51c82f5f5b2b4657fb7e620947962bf15337bdb91bf6d6bc6e4ffbc7793b4ec8d15a58d5b2bcf75aca30a110e0a0345903a4500aba1bb83d29d0207e
7
+ data.tar.gz: 12c66b9953e47a0f4bf133afc9968cb7dbac9493b6691cc422dfdc3600c32b291f99be267c56c743310b8405db2b5093645b557ffafb9d1ac5c3ab852e72c35b
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2017 Patrice Lebel
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,112 @@
1
+ # ExtBundler
2
+
3
+ ### Installation
4
+
5
+ ```bash
6
+ $ gem install ext_bundler
7
+ ```
8
+
9
+ ### Usage
10
+
11
+ In your project Gemfile:
12
+
13
+ ```ruby
14
+ # Gemfile
15
+
16
+ source 'https://rubygems.org'
17
+
18
+ load(Bundler.settings['ext_bundler'] ||= File.join(
19
+ (File.exist?('EXT_BUNDLER') ? File.readlines('EXT_BUNDLER').first : `gem path ext_bundler`).strip,
20
+ 'lib', 'ext_bundler', 'bundler.rb'
21
+ )
22
+ )
23
+
24
+ # ...
25
+ ```
26
+
27
+ Add `.bundle` and `Gemfile.lock` to your project `.gitignore` if not already added.
28
+
29
+ In some other gem's gemspec file:
30
+
31
+ ```ruby
32
+ # gem_name.gemspec
33
+
34
+ # ...
35
+ Gem::Specification.new do |s|
36
+ # ...
37
+
38
+ s.add_dependency 'some_other_gem', github: 'account_name/repo_name'
39
+
40
+ s.add_dependency 'another_dev_gem', group: :development, require: false
41
+
42
+ # ...
43
+ end
44
+ ```
45
+
46
+ Supported keys are:
47
+
48
+ - :group, :groups
49
+ - :github, :git, :branch, :ref, :tag, :submodules
50
+ - :require
51
+ - :platform, :platforms
52
+
53
+ After running `bundle install` or `bundle update`, `ExtGemfile` is added or updated.
54
+
55
+ You also have to run `bundle install` again to replace your `Gemfile.lock` with a `ExtGemfile.lock`.
56
+
57
+ ### Bundler configurations
58
+
59
+ After running `bundle install` or `bundle update`, your `.bundle/config` will be updated accordingly with:
60
+
61
+ - `BUNDLE_EXT_BUNDLER` set to the current library path
62
+ - `BUNDLE_GITHUB__HTTPS` set to true
63
+ - `BUNDLE_GEMFILE` set to `ExtGemfile`
64
+
65
+ ### Upgrading
66
+
67
+ Clear `.bundle` directory within your project after updating `ext_bundler` gem.
68
+
69
+ ### Rails server
70
+
71
+ If you don't want to run `bundle exec rails server`, you could specify the extended gemfile with:
72
+
73
+ `BUNDLE_GEMFILE=ExtGemfile rails server`
74
+
75
+ ### Capistrano
76
+
77
+ The new Gemfile used must be `ExtGemfile` and could be configured by capistrano-bundler like this:
78
+
79
+ ```ruby
80
+ # config/deploy.rb
81
+
82
+ set :bundle_gemfile, -> { 'ExtGemfile' }
83
+ ```
84
+
85
+ Bundler also needs to know where to find `ext_bundler` and can be configured by [ExtCapistrano](https://github.com/patleb/ext_capistrano/blob/master/lib/capistrano/tasks/ext_capistrano/deploy.rb#L59);
86
+
87
+ ### Passenger + Nginx
88
+
89
+ Passenger needs to know where is the `ExtGemfile` and can be configured by [ExtCapistrano](https://github.com/patleb/ext_capistrano/blob/master/config/nginx.app.conf.erb#L29).
90
+
91
+ ### Development
92
+
93
+ ```ruby
94
+ # Gemfile
95
+
96
+ if ENV['EXT_BUNDLER']
97
+ require 'pathname'
98
+ gem_path = Pathname.new('~/path_to_gem/ext_bundler').expand_path
99
+ gem 'ext_bundler', path: gem_path.to_s
100
+ load(Bundler.settings['ext_bundler'] ||= gem_path.join('lib/ext_bundler/bundler.rb').to_s)
101
+ else
102
+ load(Bundler.settings['ext_bundler'] ||= File.join(
103
+ (File.exist?('EXT_BUNDLER') ? File.readlines('EXT_BUNDLER').first : `gem path ext_bundler`).strip,
104
+ 'lib', 'ext_bundler', 'bundler.rb'
105
+ )
106
+ )
107
+ end
108
+ ```
109
+
110
+ ### License
111
+
112
+ This project rocks and uses MIT-LICENSE.
@@ -0,0 +1,48 @@
1
+ module ExtBundler
2
+ def gem_dev(names, *args)
3
+ if names.is_a? Hash
4
+ @@gem_dev = names
5
+ self.class.send :define_singleton_method, :gem_dev do
6
+ @@gem_dev.find_all(&:last).map(&:first).each{ |gem| require gem }
7
+ end
8
+ else
9
+ @gem_dev_path ||= File.readlines('.gem-dev').first.strip if File.exist?('.gem-dev')
10
+ @@gem_dev[names.to_sym] ? gem(names, path: "#{@gem_dev_path}/#{names}", require: false) : gem(names, *args)
11
+ @@gem_dev[names.to_sym] = (args.last.is_a?(Hash) ? args.last : {})[:require].nil?
12
+ end
13
+ end
14
+
15
+ def gem_lock(name, *args)
16
+ name, args = _gem_lock(name, *args)
17
+ gem name, *args
18
+ end
19
+
20
+ def gem_lock_dev(name, *args)
21
+ name, args = _gem_lock(name, *args)
22
+ gem_dev name, *args
23
+ end
24
+
25
+ def _gem_lock(name, *args)
26
+ @gemfile_lock ||= File.read('Gemfile.lock')
27
+ options = args.last.is_a?(Hash) ? args.pop : {}
28
+ type = options.delete(:type)&.to_sym
29
+
30
+ version =
31
+ case type
32
+ when :ref
33
+ /^ revision: (\w+)(?:\n branch: \w+)?\n specs:\n #{name} \([\w\.]+\)$/m
34
+ else
35
+ /^ #{name} \(([\w\.]+)\)$/
36
+ end
37
+ version = @gemfile_lock.match(version)[1]
38
+
39
+ if type
40
+ options[type] = version
41
+ else
42
+ args.unshift(version)
43
+ end
44
+ args << options
45
+
46
+ [name, args]
47
+ end
48
+ end
@@ -0,0 +1,3 @@
1
+ module ExtBundler
2
+ VERSION = '2.0.2'
3
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ext_bundler
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Patrice Lebel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-11-02 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: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: gem-path
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.6'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.6'
41
+ description: ExtBundler
42
+ email:
43
+ - patleb@users.noreply.github.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - MIT-LICENSE
49
+ - README.md
50
+ - lib/ext_bundler.rb
51
+ - lib/ext_bundler/version.rb
52
+ homepage: https://github.com/patleb/ext_bundler
53
+ licenses:
54
+ - MIT
55
+ metadata: {}
56
+ post_install_message:
57
+ rdoc_options: []
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ requirements: []
71
+ rubyforge_project:
72
+ rubygems_version: 2.6.13
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: ExtBundler
76
+ test_files: []