bundler 1.10.6 → 1.11.2
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 +4 -4
- data/.rubocop.yml +105 -0
- data/.rubocop_todo.yml +120 -0
- data/.travis.yml +8 -23
- data/CHANGELOG.md +95 -0
- data/CODE_OF_CONDUCT.md +6 -4
- data/DEVELOPMENT.md +4 -5
- data/README.md +2 -2
- data/Rakefile +71 -88
- data/bin/rake +14 -0
- data/bin/rspec +10 -0
- data/bin/rubocop +11 -0
- data/bundler.gemspec +17 -15
- data/exe/bundle +20 -0
- data/{bin → exe}/bundle_ruby +6 -4
- data/exe/bundler +20 -0
- data/lib/bundler/capistrano.rb +2 -2
- data/lib/bundler/cli/binstubs.rb +1 -2
- data/lib/bundler/cli/cache.rb +0 -1
- data/lib/bundler/cli/check.rb +7 -5
- data/lib/bundler/cli/clean.rb +0 -1
- data/lib/bundler/cli/common.rb +6 -7
- data/lib/bundler/cli/config.rb +69 -56
- data/lib/bundler/cli/console.rb +8 -8
- data/lib/bundler/cli/exec.rb +5 -4
- data/lib/bundler/cli/gem.rb +52 -40
- data/lib/bundler/cli/init.rb +5 -6
- data/lib/bundler/cli/inject.rb +1 -2
- data/lib/bundler/cli/install.rb +18 -21
- data/lib/bundler/cli/lock.rb +8 -3
- data/lib/bundler/cli/open.rb +4 -5
- data/lib/bundler/cli/outdated.rb +7 -8
- data/lib/bundler/cli/package.rb +1 -1
- data/lib/bundler/cli/platform.rb +2 -3
- data/lib/bundler/cli/show.rb +9 -9
- data/lib/bundler/cli/update.rb +2 -3
- data/lib/bundler/cli/viz.rb +1 -2
- data/lib/bundler/cli.rb +85 -74
- data/lib/bundler/constants.rb +1 -1
- data/lib/bundler/current_ruby.rb +38 -3
- data/lib/bundler/definition.rb +83 -88
- data/lib/bundler/dep_proxy.rb +11 -9
- data/lib/bundler/dependency.rb +17 -11
- data/lib/bundler/deployment.rb +2 -2
- data/lib/bundler/deprecate.rb +3 -3
- data/lib/bundler/dsl.rb +62 -43
- data/lib/bundler/env.rb +19 -12
- data/lib/bundler/environment.rb +1 -2
- data/lib/bundler/errors.rb +82 -0
- data/lib/bundler/fetcher/base.rb +20 -7
- data/lib/bundler/fetcher/dependency.rb +5 -5
- data/lib/bundler/fetcher/downloader.rb +1 -2
- data/lib/bundler/fetcher/index.rb +4 -7
- data/lib/bundler/fetcher.rb +49 -40
- data/lib/bundler/friendly_errors.rb +15 -8
- data/lib/bundler/gem_helper.rb +44 -35
- data/lib/bundler/gem_helpers.rb +7 -8
- data/lib/bundler/gem_remote_fetcher.rb +41 -0
- data/lib/bundler/gem_tasks.rb +4 -1
- data/lib/bundler/graph.rb +25 -24
- data/lib/bundler/index.rb +21 -18
- data/lib/bundler/injector.rb +2 -4
- data/lib/bundler/inline.rb +3 -3
- data/lib/bundler/installer/gem_installer.rb +76 -0
- data/lib/bundler/installer/parallel_installer.rb +22 -13
- data/lib/bundler/installer/standalone.rb +48 -0
- data/lib/bundler/installer.rb +57 -144
- data/lib/bundler/lazy_specification.rb +4 -5
- data/lib/bundler/lockfile_parser.rb +21 -19
- data/lib/bundler/man/bundle +2 -2
- data/lib/bundler/man/bundle-config +2 -2
- data/lib/bundler/man/bundle-config.txt +6 -4
- data/lib/bundler/man/bundle-exec +1 -1
- data/lib/bundler/man/bundle-exec.txt +1 -1
- data/lib/bundler/man/bundle-gem +80 -0
- data/lib/bundler/man/bundle-gem.txt +90 -0
- data/lib/bundler/man/bundle-install +37 -6
- data/lib/bundler/man/bundle-install.txt +68 -44
- data/lib/bundler/man/bundle-lock +55 -0
- data/lib/bundler/man/bundle-lock.txt +60 -0
- data/lib/bundler/man/bundle-package +1 -1
- data/lib/bundler/man/bundle-package.txt +1 -1
- data/lib/bundler/man/bundle-platform +1 -1
- data/lib/bundler/man/bundle-platform.txt +1 -1
- data/lib/bundler/man/bundle-update +1 -1
- data/lib/bundler/man/bundle-update.txt +1 -1
- data/lib/bundler/man/bundle.txt +2 -2
- data/lib/bundler/man/gemfile.5 +17 -1
- data/lib/bundler/man/gemfile.5.txt +12 -1
- data/lib/bundler/match_platform.rb +4 -4
- data/lib/bundler/psyched_yaml.rb +5 -5
- data/lib/bundler/remote_specification.rb +1 -1
- data/lib/bundler/resolver.rb +93 -88
- data/lib/bundler/retry.rb +9 -10
- data/lib/bundler/ruby_dsl.rb +1 -1
- data/lib/bundler/ruby_version.rb +7 -10
- data/lib/bundler/rubygems_ext.rb +32 -27
- data/lib/bundler/{gem_installer.rb → rubygems_gem_installer.rb} +2 -2
- data/lib/bundler/rubygems_integration.rb +85 -70
- data/lib/bundler/runtime.rb +65 -61
- data/lib/bundler/settings.rb +27 -26
- data/lib/bundler/setup.rb +3 -3
- data/lib/bundler/shared_helpers.rb +45 -20
- data/lib/bundler/similarity_detector.rb +19 -21
- data/lib/bundler/source/git/git_proxy.rb +52 -26
- data/lib/bundler/source/git.rb +29 -31
- data/lib/bundler/source/path/installer.rb +4 -4
- data/lib/bundler/source/path.rb +25 -28
- data/lib/bundler/source/rubygems/remote.rb +3 -3
- data/lib/bundler/source/rubygems.rb +62 -48
- data/lib/bundler/source.rb +4 -5
- data/lib/bundler/source_list.rb +4 -4
- data/lib/bundler/spec_set.rb +17 -15
- data/lib/bundler/ssl_certs/certificate_manager.rb +5 -6
- data/lib/bundler/stub_specification.rb +2 -2
- data/lib/bundler/templates/Executable +5 -5
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +42 -6
- data/lib/bundler/templates/newgem/README.md.tt +1 -1
- data/lib/bundler/templates/newgem/Rakefile.tt +4 -2
- data/lib/bundler/templates/newgem/bin/setup.tt +2 -1
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +2 -2
- data/lib/bundler/ui/rg_proxy.rb +2 -2
- data/lib/bundler/ui/shell.rb +10 -6
- data/lib/bundler/ui.rb +3 -3
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +82 -71
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +9 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +40 -21
- data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +8 -0
- data/lib/bundler/vendored_molinillo.rb +1 -1
- data/lib/bundler/vendored_persistent.rb +3 -3
- data/lib/bundler/vendored_thor.rb +2 -2
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/vlad.rb +1 -1
- data/lib/bundler/worker.rb +4 -5
- data/lib/bundler.rb +99 -120
- data/man/bundle-config.ronn +4 -2
- data/man/bundle-gem.ronn +77 -0
- data/man/bundle-install.ronn +13 -6
- data/man/bundle-lock.ronn +47 -0
- data/man/bundle.ronn +1 -1
- data/man/gemfile.5.ronn +8 -0
- data/man/index.txt +1 -0
- metadata +36 -8
- data/bin/bundle +0 -21
- data/bin/bundler +0 -21
data/lib/bundler/cli/config.rb
CHANGED
|
@@ -1,87 +1,100 @@
|
|
|
1
1
|
module Bundler
|
|
2
2
|
class CLI::Config
|
|
3
|
-
attr_reader :options, :thor
|
|
3
|
+
attr_reader :name, :options, :scope, :thor
|
|
4
4
|
attr_accessor :args
|
|
5
5
|
|
|
6
6
|
def initialize(options, args, thor)
|
|
7
7
|
@options = options
|
|
8
8
|
@args = args
|
|
9
9
|
@thor = thor
|
|
10
|
+
@name = peek = args.shift
|
|
11
|
+
@scope = "global"
|
|
12
|
+
if peek && peek =~ /^\-\-/
|
|
13
|
+
@name = args.shift
|
|
14
|
+
@scope = $'
|
|
15
|
+
end
|
|
10
16
|
end
|
|
11
17
|
|
|
12
18
|
def run
|
|
13
|
-
|
|
19
|
+
unless name
|
|
20
|
+
confirm_all
|
|
21
|
+
return
|
|
22
|
+
end
|
|
14
23
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
name, scope = peek, "global"
|
|
24
|
+
unless valid_scope?(scope)
|
|
25
|
+
Bundler.ui.error "Invalid scope --#{scope} given. Please use --local or --global."
|
|
26
|
+
exit 1
|
|
19
27
|
end
|
|
20
28
|
|
|
21
|
-
|
|
22
|
-
Bundler.
|
|
29
|
+
if scope == "delete"
|
|
30
|
+
Bundler.settings.set_local(name, nil)
|
|
31
|
+
Bundler.settings.set_global(name, nil)
|
|
32
|
+
return
|
|
33
|
+
end
|
|
23
34
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
thor.with_padding do
|
|
27
|
-
Bundler.settings.pretty_values_for(setting).each do |line|
|
|
28
|
-
Bundler.ui.info line
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
Bundler.ui.confirm ""
|
|
32
|
-
end
|
|
35
|
+
if args.empty?
|
|
36
|
+
confirm(name)
|
|
33
37
|
return
|
|
34
38
|
end
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
Bundler.settings.set_global(name, nil)
|
|
40
|
-
when "local", "global"
|
|
41
|
-
if args.empty?
|
|
42
|
-
Bundler.ui.confirm "Settings for `#{name}` in order of priority. The top value will be used"
|
|
43
|
-
thor.with_padding do
|
|
44
|
-
Bundler.settings.pretty_values_for(name).each { |line| Bundler.ui.info line }
|
|
45
|
-
end
|
|
46
|
-
return
|
|
47
|
-
end
|
|
40
|
+
Bundler.ui.info(message) if message
|
|
41
|
+
Bundler.settings.send("set_#{scope}", name, new_value)
|
|
42
|
+
end
|
|
48
43
|
|
|
49
|
-
|
|
50
|
-
locations = Bundler.settings.locations(name)
|
|
44
|
+
private
|
|
51
45
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
46
|
+
def confirm_all
|
|
47
|
+
Bundler.ui.confirm "Settings are listed in order of priority. The top value will be used.\n"
|
|
48
|
+
Bundler.settings.all.each do |setting|
|
|
49
|
+
Bundler.ui.confirm "#{setting}"
|
|
50
|
+
show_pretty_values_for(setting)
|
|
51
|
+
Bundler.ui.confirm ""
|
|
52
|
+
end
|
|
53
|
+
end
|
|
57
54
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
def confirm(name)
|
|
56
|
+
Bundler.ui.confirm "Settings for `#{name}` in order of priority. The top value will be used"
|
|
57
|
+
show_pretty_values_for(name)
|
|
58
|
+
end
|
|
62
59
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
60
|
+
def new_value
|
|
61
|
+
pathname = Pathname.new(args.join(" "))
|
|
62
|
+
if name.match(/\Alocal\./) && pathname.directory?
|
|
63
|
+
pathname.expand_path.to_s
|
|
64
|
+
else
|
|
65
|
+
args.join(" ")
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
def message
|
|
70
|
+
locations = Bundler.settings.locations(name)
|
|
71
|
+
if scope == "global"
|
|
72
|
+
if locations[:local]
|
|
73
|
+
"Your application has set #{name} to #{locations[:local].inspect}. " \
|
|
74
|
+
"This will override the global value you are currently setting"
|
|
75
|
+
elsif locations[:env]
|
|
76
|
+
"You have a bundler environment variable for #{name} set to " \
|
|
77
|
+
"#{locations[:env].inspect}. This will take precedence over the global value you are setting"
|
|
78
|
+
elsif locations[:global] && locations[:global] != args.join(" ")
|
|
79
|
+
"You are replacing the current global value of #{name}, which is currently " \
|
|
80
|
+
"#{locations[:global].inspect}"
|
|
72
81
|
end
|
|
82
|
+
elsif scope == "local" && locations[:local] != args.join(" ")
|
|
83
|
+
"You are replacing the current local value of #{name}, which is currently " \
|
|
84
|
+
"#{locations[:local].inspect}"
|
|
85
|
+
end
|
|
86
|
+
end
|
|
73
87
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
88
|
+
def show_pretty_values_for(setting)
|
|
89
|
+
thor.with_padding do
|
|
90
|
+
Bundler.settings.pretty_values_for(setting).each do |line|
|
|
91
|
+
Bundler.ui.info line
|
|
77
92
|
end
|
|
78
|
-
|
|
79
|
-
Bundler.settings.send("set_#{scope}", name, new_value)
|
|
80
|
-
else
|
|
81
|
-
Bundler.ui.error "Invalid scope --#{scope} given. Please use --local or --global."
|
|
82
|
-
exit 1
|
|
83
93
|
end
|
|
84
94
|
end
|
|
85
95
|
|
|
96
|
+
def valid_scope?(scope)
|
|
97
|
+
%w(delete local global).include?(scope)
|
|
98
|
+
end
|
|
86
99
|
end
|
|
87
100
|
end
|
data/lib/bundler/cli/console.rb
CHANGED
|
@@ -7,10 +7,10 @@ module Bundler
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def run
|
|
10
|
-
group ? Bundler.require(:default, *(group.split.map!
|
|
10
|
+
group ? Bundler.require(:default, *(group.split.map!(&:to_sym))) : Bundler.require
|
|
11
11
|
ARGV.clear
|
|
12
12
|
|
|
13
|
-
console = get_console(Bundler.settings[:console] ||
|
|
13
|
+
console = get_console(Bundler.settings[:console] || "irb")
|
|
14
14
|
console.start
|
|
15
15
|
end
|
|
16
16
|
|
|
@@ -18,21 +18,21 @@ module Bundler
|
|
|
18
18
|
require name
|
|
19
19
|
get_constant(name)
|
|
20
20
|
rescue LoadError
|
|
21
|
-
Bundler.ui.error "Couldn't load console #{name}"
|
|
22
|
-
|
|
21
|
+
Bundler.ui.error "Couldn't load console #{name}, falling back to irb"
|
|
22
|
+
require "irb"
|
|
23
|
+
get_constant("irb")
|
|
23
24
|
end
|
|
24
25
|
|
|
25
26
|
def get_constant(name)
|
|
26
27
|
const_name = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
"pry" => :Pry,
|
|
29
|
+
"ripl" => :Ripl,
|
|
30
|
+
"irb" => :IRB,
|
|
30
31
|
}[name]
|
|
31
32
|
Object.const_get(const_name)
|
|
32
33
|
rescue NameError
|
|
33
34
|
Bundler.ui.error "Could not find constant #{const_name}"
|
|
34
35
|
exit 1
|
|
35
36
|
end
|
|
36
|
-
|
|
37
37
|
end
|
|
38
38
|
end
|
data/lib/bundler/cli/exec.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require "bundler/current_ruby"
|
|
2
|
+
|
|
1
3
|
module Bundler
|
|
2
4
|
class CLI::Exec
|
|
3
5
|
attr_reader :options, :args, :cmd
|
|
@@ -7,7 +9,7 @@ module Bundler
|
|
|
7
9
|
@cmd = args.shift
|
|
8
10
|
@args = args
|
|
9
11
|
|
|
10
|
-
if
|
|
12
|
+
if Bundler.current_ruby.ruby_2? && !Bundler.current_ruby.jruby?
|
|
11
13
|
@args << { :close_others => !options.keep_file_descriptors? }
|
|
12
14
|
elsif options.keep_file_descriptors?
|
|
13
15
|
Bundler.ui.warn "Ruby version #{RUBY_VERSION} defaults to keeping non-standard file descriptors on Kernel#exec."
|
|
@@ -31,20 +33,19 @@ module Bundler
|
|
|
31
33
|
Bundler.load.setup_environment
|
|
32
34
|
Bundler.ui = nil
|
|
33
35
|
Kernel.exec(@cmd, *args)
|
|
34
|
-
rescue Errno::EACCES
|
|
36
|
+
rescue Errno::EACCES, Errno::ENOEXEC
|
|
35
37
|
Bundler.ui = ui
|
|
36
38
|
Bundler.ui.error "bundler: not executable: #{cmd}"
|
|
37
39
|
exit 126
|
|
38
40
|
rescue Errno::ENOENT
|
|
39
41
|
Bundler.ui = ui
|
|
40
42
|
Bundler.ui.error "bundler: command not found: #{cmd}"
|
|
41
|
-
Bundler.ui.warn
|
|
43
|
+
Bundler.ui.warn "Install missing gem executables with `bundle install`"
|
|
42
44
|
exit 127
|
|
43
45
|
rescue ArgumentError
|
|
44
46
|
Bundler.ui = ui
|
|
45
47
|
Bundler.ui.error "bundler: exec needs a command to run"
|
|
46
48
|
exit 128
|
|
47
49
|
end
|
|
48
|
-
|
|
49
50
|
end
|
|
50
51
|
end
|
data/lib/bundler/cli/gem.rb
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "pathname"
|
|
2
2
|
|
|
3
3
|
module Bundler
|
|
4
4
|
class CLI::Gem
|
|
5
|
+
TEST_FRAMEWORK_VERSIONS = {
|
|
6
|
+
"rspec" => "3.0",
|
|
7
|
+
"minitest" => "5.0"
|
|
8
|
+
}
|
|
9
|
+
|
|
5
10
|
attr_reader :options, :gem_name, :thor, :name, :target
|
|
6
11
|
|
|
7
12
|
def initialize(options, gem_name, thor)
|
|
@@ -10,7 +15,7 @@ module Bundler
|
|
|
10
15
|
@thor = thor
|
|
11
16
|
|
|
12
17
|
@name = @gem_name
|
|
13
|
-
@target =
|
|
18
|
+
@target = SharedHelpers.pwd.join(gem_name)
|
|
14
19
|
|
|
15
20
|
validate_ext_name if options[:ext]
|
|
16
21
|
end
|
|
@@ -18,10 +23,11 @@ module Bundler
|
|
|
18
23
|
def run
|
|
19
24
|
Bundler.ui.confirm "Creating gem '#{name}'..."
|
|
20
25
|
|
|
21
|
-
underscored_name = name.tr(
|
|
22
|
-
namespaced_path = name.tr(
|
|
23
|
-
constant_name = name.gsub(/-[_-]*(?![_-]|$)/){
|
|
24
|
-
constant_array = constant_name.split(
|
|
26
|
+
underscored_name = name.tr("-", "_")
|
|
27
|
+
namespaced_path = name.tr("-", "/")
|
|
28
|
+
constant_name = name.gsub(/-[_-]*(?![_-]|$)/) { "::" }.gsub(/([_-]+|(::)|^)(.|$)/) { $2.to_s + $3.upcase }
|
|
29
|
+
constant_array = constant_name.split("::")
|
|
30
|
+
test_task = options[:test] == "minitest" ? "test" : "spec"
|
|
25
31
|
|
|
26
32
|
git_user_name = `git config user.name`.chomp
|
|
27
33
|
git_user_email = `git config user.email`.chomp
|
|
@@ -36,6 +42,7 @@ module Bundler
|
|
|
36
42
|
:author => git_user_name.empty? ? "TODO: Write your name" : git_user_name,
|
|
37
43
|
:email => git_user_email.empty? ? "TODO: Write your email address" : git_user_email,
|
|
38
44
|
:test => options[:test],
|
|
45
|
+
:test_task => test_task,
|
|
39
46
|
:ext => options[:ext],
|
|
40
47
|
:bin => options[:bin],
|
|
41
48
|
:bundler_version => bundler_dependency_version
|
|
@@ -54,45 +61,25 @@ module Bundler
|
|
|
54
61
|
"bin/setup.tt" => "bin/setup"
|
|
55
62
|
}
|
|
56
63
|
|
|
57
|
-
executables = %w
|
|
64
|
+
executables = %w(
|
|
58
65
|
bin/console
|
|
59
66
|
bin/setup
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if ask_and_set(:coc, "Do you want to include a code of conduct in gems you generate?",
|
|
63
|
-
"Codes of conduct can increase contributions to your project by contributors who " \
|
|
64
|
-
"prefer collaborative, safe spaces. You can read more about the code of conduct at " \
|
|
65
|
-
"contributor-covenant.org. Having a code of conduct means agreeing to the responsibility " \
|
|
66
|
-
"of enforcing it, so be sure that you are prepared to do that. For suggestions about " \
|
|
67
|
-
"how to enforce codes of conduct, see bit.ly/coc-enforcement."
|
|
68
|
-
)
|
|
69
|
-
config[:coc] = true
|
|
70
|
-
Bundler.ui.info "Code of conduct enabled in config"
|
|
71
|
-
templates.merge!("CODE_OF_CONDUCT.md.tt" => "CODE_OF_CONDUCT.md")
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
if ask_and_set(:mit, "Do you want to license your code permissively under the MIT license?",
|
|
75
|
-
"This means that any other developer or company will be legally allowed to use your code " \
|
|
76
|
-
"for free as long as they admit you created it. You can read more about the MIT license " \
|
|
77
|
-
"at choosealicense.com/licenses/mit."
|
|
78
|
-
)
|
|
79
|
-
config[:mit] = true
|
|
80
|
-
Bundler.ui.info "MIT License enabled in config"
|
|
81
|
-
templates.merge!("LICENSE.txt.tt" => "LICENSE.txt")
|
|
82
|
-
end
|
|
67
|
+
)
|
|
83
68
|
|
|
84
69
|
if test_framework = ask_and_set_test_framework
|
|
85
70
|
config[:test] = test_framework
|
|
71
|
+
config[:test_framework_version] = TEST_FRAMEWORK_VERSIONS[test_framework]
|
|
72
|
+
|
|
86
73
|
templates.merge!(".travis.yml.tt" => ".travis.yml")
|
|
87
74
|
|
|
88
75
|
case test_framework
|
|
89
|
-
when
|
|
76
|
+
when "rspec"
|
|
90
77
|
templates.merge!(
|
|
91
78
|
"rspec.tt" => ".rspec",
|
|
92
79
|
"spec/spec_helper.rb.tt" => "spec/spec_helper.rb",
|
|
93
80
|
"spec/newgem_spec.rb.tt" => "spec/#{namespaced_path}_spec.rb"
|
|
94
81
|
)
|
|
95
|
-
when
|
|
82
|
+
when "minitest"
|
|
96
83
|
templates.merge!(
|
|
97
84
|
"test/test_helper.rb.tt" => "test/test_helper.rb",
|
|
98
85
|
"test/newgem_test.rb.tt" => "test/#{namespaced_path}_test.rb"
|
|
@@ -100,6 +87,28 @@ module Bundler
|
|
|
100
87
|
end
|
|
101
88
|
end
|
|
102
89
|
|
|
90
|
+
if ask_and_set(:mit, "Do you want to license your code permissively under the MIT license?",
|
|
91
|
+
"This means that any other developer or company will be legally allowed to use your code " \
|
|
92
|
+
"for free as long as they admit you created it. You can read more about the MIT license " \
|
|
93
|
+
"at http://choosealicense.com/licenses/mit.")
|
|
94
|
+
config[:mit] = true
|
|
95
|
+
Bundler.ui.info "MIT License enabled in config"
|
|
96
|
+
templates.merge!("LICENSE.txt.tt" => "LICENSE.txt")
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
if ask_and_set(:coc, "Do you want to include a code of conduct in gems you generate?",
|
|
100
|
+
"Codes of conduct can increase contributions to your project by contributors who " \
|
|
101
|
+
"prefer collaborative, safe spaces. You can read more about the code of conduct at " \
|
|
102
|
+
"contributor-covenant.org. Having a code of conduct means agreeing to the responsibility " \
|
|
103
|
+
"of enforcing it, so be sure that you are prepared to do that. Be sure that your email " \
|
|
104
|
+
"address is specified as a contact in the generated code of conduct so that people know " \
|
|
105
|
+
"who to contact in case of a violation. For suggestions about " \
|
|
106
|
+
"how to enforce codes of conduct, see http://bit.ly/coc-enforcement.")
|
|
107
|
+
config[:coc] = true
|
|
108
|
+
Bundler.ui.info "Code of conduct enabled in config"
|
|
109
|
+
templates.merge!("CODE_OF_CONDUCT.md.tt" => "CODE_OF_CONDUCT.md")
|
|
110
|
+
end
|
|
111
|
+
|
|
103
112
|
templates.merge!("exe/newgem.tt" => "exe/#{name}") if options[:bin]
|
|
104
113
|
|
|
105
114
|
if options[:ext]
|
|
@@ -121,7 +130,10 @@ module Bundler
|
|
|
121
130
|
end
|
|
122
131
|
|
|
123
132
|
Bundler.ui.info "Initializing git repo in #{target}"
|
|
124
|
-
Dir.chdir(target)
|
|
133
|
+
Dir.chdir(target) do
|
|
134
|
+
`git init`
|
|
135
|
+
`git add .`
|
|
136
|
+
end
|
|
125
137
|
|
|
126
138
|
if options[:edit]
|
|
127
139
|
# Open gemspec in editor
|
|
@@ -129,14 +141,15 @@ module Bundler
|
|
|
129
141
|
end
|
|
130
142
|
end
|
|
131
143
|
|
|
132
|
-
|
|
144
|
+
private
|
|
133
145
|
|
|
134
146
|
def resolve_name(name)
|
|
135
|
-
|
|
147
|
+
SharedHelpers.pwd.join(name).basename.to_s
|
|
136
148
|
end
|
|
137
149
|
|
|
138
150
|
def ask_and_set(key, header, message)
|
|
139
|
-
choice = options[key]
|
|
151
|
+
choice = options[key]
|
|
152
|
+
choice = Bundler.settings["gem.#{key}"] if choice.nil?
|
|
140
153
|
|
|
141
154
|
if choice.nil?
|
|
142
155
|
Bundler.ui.confirm header
|
|
@@ -148,7 +161,7 @@ module Bundler
|
|
|
148
161
|
end
|
|
149
162
|
|
|
150
163
|
def validate_ext_name
|
|
151
|
-
return unless gem_name.index(
|
|
164
|
+
return unless gem_name.index("-")
|
|
152
165
|
|
|
153
166
|
Bundler.ui.error "You have specified a gem name which does not conform to the \n" \
|
|
154
167
|
"naming guidelines for C extensions. For more information, \n" \
|
|
@@ -181,11 +194,11 @@ module Bundler
|
|
|
181
194
|
def bundler_dependency_version
|
|
182
195
|
v = Gem::Version.new(Bundler::VERSION)
|
|
183
196
|
req = v.segments[0..1]
|
|
184
|
-
req <<
|
|
197
|
+
req << "a" if v.prerelease?
|
|
185
198
|
req.join(".")
|
|
186
199
|
end
|
|
187
200
|
|
|
188
|
-
def ensure_safe_gem_name
|
|
201
|
+
def ensure_safe_gem_name(name, constant_array)
|
|
189
202
|
if name =~ /^\d/
|
|
190
203
|
Bundler.ui.error "Invalid gem name #{name} Please give a name which does not start with numbers."
|
|
191
204
|
exit 1
|
|
@@ -194,6 +207,5 @@ module Bundler
|
|
|
194
207
|
exit 1
|
|
195
208
|
end
|
|
196
209
|
end
|
|
197
|
-
|
|
198
210
|
end
|
|
199
211
|
end
|
data/lib/bundler/cli/init.rb
CHANGED
|
@@ -7,7 +7,7 @@ module Bundler
|
|
|
7
7
|
|
|
8
8
|
def run
|
|
9
9
|
if File.exist?("Gemfile")
|
|
10
|
-
Bundler.ui.error "Gemfile already exists at #{
|
|
10
|
+
Bundler.ui.error "Gemfile already exists at #{SharedHelpers.pwd}/Gemfile"
|
|
11
11
|
exit 1
|
|
12
12
|
end
|
|
13
13
|
|
|
@@ -18,16 +18,15 @@ module Bundler
|
|
|
18
18
|
exit 1
|
|
19
19
|
end
|
|
20
20
|
spec = Gem::Specification.load(gemspec)
|
|
21
|
-
puts "Writing new Gemfile to #{
|
|
22
|
-
File.open(
|
|
21
|
+
puts "Writing new Gemfile to #{SharedHelpers.pwd}/Gemfile"
|
|
22
|
+
File.open("Gemfile", "wb") do |file|
|
|
23
23
|
file << "# Generated from #{gemspec}\n"
|
|
24
24
|
file << spec.to_gemfile
|
|
25
25
|
end
|
|
26
26
|
else
|
|
27
|
-
puts "Writing new Gemfile to #{
|
|
28
|
-
FileUtils.cp(File.expand_path(
|
|
27
|
+
puts "Writing new Gemfile to #{SharedHelpers.pwd}/Gemfile"
|
|
28
|
+
FileUtils.cp(File.expand_path("../../templates/Gemfile", __FILE__), "Gemfile")
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
|
-
|
|
32
31
|
end
|
|
33
32
|
end
|
data/lib/bundler/cli/inject.rb
CHANGED
|
@@ -23,11 +23,10 @@ module Bundler
|
|
|
23
23
|
|
|
24
24
|
if added.any?
|
|
25
25
|
Bundler.ui.confirm "Added to Gemfile:"
|
|
26
|
-
Bundler.ui.confirm added.map{
|
|
26
|
+
Bundler.ui.confirm added.map {|g| " #{g}" }.join("\n")
|
|
27
27
|
else
|
|
28
28
|
Bundler.ui.confirm "All injected gems were already present in the Gemfile"
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
|
-
|
|
32
31
|
end
|
|
33
32
|
end
|
data/lib/bundler/cli/install.rb
CHANGED
|
@@ -29,17 +29,17 @@ module Bundler
|
|
|
29
29
|
Bundler.settings.without = [] if options[:without] && options[:without].empty?
|
|
30
30
|
|
|
31
31
|
with = options.fetch("with", [])
|
|
32
|
-
with |= Bundler.settings.with.map
|
|
32
|
+
with |= Bundler.settings.with.map(&:to_s)
|
|
33
33
|
with -= options[:without] if options[:without]
|
|
34
34
|
|
|
35
35
|
without = options.fetch("without", [])
|
|
36
|
-
without |= Bundler.settings.without.map
|
|
36
|
+
without |= Bundler.settings.without.map(&:to_s)
|
|
37
37
|
without -= options[:with] if options[:with]
|
|
38
38
|
|
|
39
39
|
options[:with] = with
|
|
40
40
|
options[:without] = without
|
|
41
41
|
|
|
42
|
-
ENV[
|
|
42
|
+
ENV["RB_USER_INSTALL"] = "1" if Bundler::FREEBSD
|
|
43
43
|
|
|
44
44
|
# Just disable color in deployment mode
|
|
45
45
|
Bundler.ui.shell = Thor::Shell::Basic.new if options[:deployment]
|
|
@@ -50,10 +50,10 @@ module Bundler
|
|
|
50
50
|
exit 1
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
-
if
|
|
54
|
-
unless
|
|
53
|
+
if options["trust-policy"]
|
|
54
|
+
unless Bundler.rubygems.security_policies.keys.include?(options["trust-policy"])
|
|
55
55
|
Bundler.ui.error "Rubygems doesn't know about trust policy '#{options["trust-policy"]}'. " \
|
|
56
|
-
"The known policies are: #{Bundler.rubygems.security_policies.keys.join(
|
|
56
|
+
"The known policies are: #{Bundler.rubygems.security_policies.keys.join(", ")}."
|
|
57
57
|
exit 1
|
|
58
58
|
end
|
|
59
59
|
Bundler.settings["trust-policy"] = options["trust-policy"]
|
|
@@ -63,17 +63,15 @@ module Bundler
|
|
|
63
63
|
|
|
64
64
|
if options[:deployment] || options[:frozen]
|
|
65
65
|
unless Bundler.default_lockfile.exist?
|
|
66
|
-
flag = options[:deployment] ?
|
|
67
|
-
raise ProductionError, "The #{flag} flag requires a
|
|
68
|
-
"sure you have checked your
|
|
66
|
+
flag = options[:deployment] ? "--deployment" : "--frozen"
|
|
67
|
+
raise ProductionError, "The #{flag} flag requires a #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}. Please make " \
|
|
68
|
+
"sure you have checked your #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} into version control " \
|
|
69
69
|
"before deploying."
|
|
70
70
|
end
|
|
71
71
|
|
|
72
|
-
if Bundler.app_cache.exist?
|
|
73
|
-
options[:local] = true
|
|
74
|
-
end
|
|
72
|
+
options[:local] = true if Bundler.app_cache.exist?
|
|
75
73
|
|
|
76
|
-
Bundler.settings[:frozen] =
|
|
74
|
+
Bundler.settings[:frozen] = "1"
|
|
77
75
|
end
|
|
78
76
|
|
|
79
77
|
# When install is called with --no-deployment, disable deployment mode
|
|
@@ -85,7 +83,7 @@ module Bundler
|
|
|
85
83
|
Bundler.settings[:path] = nil if options[:system]
|
|
86
84
|
Bundler.settings[:path] = "vendor/bundle" if options[:deployment]
|
|
87
85
|
Bundler.settings[:path] = options["path"] if options["path"]
|
|
88
|
-
Bundler.settings[:path]
|
|
86
|
+
Bundler.settings[:path] ||= "bundle" if options["standalone"]
|
|
89
87
|
Bundler.settings[:bin] = options["binstubs"] if options["binstubs"]
|
|
90
88
|
Bundler.settings[:bin] = nil if options["binstubs"] && options["binstubs"].empty?
|
|
91
89
|
Bundler.settings[:shebang] = options["shebang"] if options["shebang"]
|
|
@@ -96,7 +94,7 @@ module Bundler
|
|
|
96
94
|
Bundler.settings.without = options[:without]
|
|
97
95
|
Bundler.settings.with = options[:with]
|
|
98
96
|
Bundler::Fetcher.disable_endpoint = options["full-index"]
|
|
99
|
-
Bundler.settings[:disable_shared_gems] = Bundler.settings[:path] ?
|
|
97
|
+
Bundler.settings[:disable_shared_gems] = Bundler.settings[:path] ? "1" : nil
|
|
100
98
|
|
|
101
99
|
# rubygems plugins sometimes hook into the gem install process
|
|
102
100
|
Gem.load_env_plugins if Gem.respond_to?(:load_env_plugins)
|
|
@@ -112,7 +110,7 @@ module Bundler
|
|
|
112
110
|
|
|
113
111
|
if Bundler.settings[:path]
|
|
114
112
|
absolute_path = File.expand_path(Bundler.settings[:path])
|
|
115
|
-
relative_path = absolute_path.sub(File.expand_path(
|
|
113
|
+
relative_path = absolute_path.sub(File.expand_path("."), ".")
|
|
116
114
|
Bundler.ui.confirm "Bundled gems are installed into #{relative_path}."
|
|
117
115
|
else
|
|
118
116
|
Bundler.ui.confirm "Use `bundle show [gemname]` to see where a bundled gem is installed."
|
|
@@ -128,7 +126,7 @@ module Bundler
|
|
|
128
126
|
Bundler.ui.error "Warning: the gem '#{name}' was found in multiple sources."
|
|
129
127
|
Bundler.ui.error "Installed from: #{installed_from_uri}"
|
|
130
128
|
Bundler.ui.error "Also found in:"
|
|
131
|
-
also_found_in_uris.each {
|
|
129
|
+
also_found_in_uris.each {|uri| Bundler.ui.error " * #{uri}" }
|
|
132
130
|
Bundler.ui.error "You should add a source requirement to restrict this gem to your preferred source."
|
|
133
131
|
Bundler.ui.error "For example:"
|
|
134
132
|
Bundler.ui.error " gem '#{name}', :source => '#{installed_from_uri}'"
|
|
@@ -157,7 +155,7 @@ module Bundler
|
|
|
157
155
|
private
|
|
158
156
|
|
|
159
157
|
def warn_if_root
|
|
160
|
-
return if Bundler::WINDOWS || !Process.uid.zero?
|
|
158
|
+
return if Bundler.settings[:silence_root_warning] || Bundler::WINDOWS || !Process.uid.zero?
|
|
161
159
|
Bundler.ui.warn "Don't run Bundler as root. Bundler can ask for sudo " \
|
|
162
160
|
"if it is needed, and installing your bundle as root will break this " \
|
|
163
161
|
"application for all non-root users on this machine.", :wrap => true
|
|
@@ -172,18 +170,17 @@ module Bundler
|
|
|
172
170
|
|
|
173
171
|
def dependencies_count_for(definition)
|
|
174
172
|
count = definition.dependencies.count
|
|
175
|
-
"#{count} Gemfile #{count == 1 ?
|
|
173
|
+
"#{count} Gemfile #{count == 1 ? "dependency" : "dependencies"}"
|
|
176
174
|
end
|
|
177
175
|
|
|
178
176
|
def gems_installed_for(definition)
|
|
179
177
|
count = definition.specs.count
|
|
180
|
-
"#{count} #{count == 1 ?
|
|
178
|
+
"#{count} #{count == 1 ? "gem" : "gems"} now installed"
|
|
181
179
|
end
|
|
182
180
|
|
|
183
181
|
def print_post_install_message(name, msg)
|
|
184
182
|
Bundler.ui.confirm "Post-install message from #{name}:"
|
|
185
183
|
Bundler.ui.info msg
|
|
186
184
|
end
|
|
187
|
-
|
|
188
185
|
end
|
|
189
186
|
end
|
data/lib/bundler/cli/lock.rb
CHANGED
|
@@ -16,8 +16,14 @@ module Bundler
|
|
|
16
16
|
ui = Bundler.ui
|
|
17
17
|
Bundler.ui = UI::Silent.new if print
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
gems = options[:update]
|
|
20
|
+
|
|
21
|
+
if gems && !gems.empty?
|
|
22
|
+
definition = Bundler.definition(:gems => gems)
|
|
23
|
+
else
|
|
24
|
+
definition = Bundler.definition(true)
|
|
25
|
+
end
|
|
26
|
+
|
|
21
27
|
definition.resolve_remotely! unless options[:local]
|
|
22
28
|
|
|
23
29
|
if print
|
|
@@ -31,6 +37,5 @@ module Bundler
|
|
|
31
37
|
|
|
32
38
|
Bundler.ui = ui
|
|
33
39
|
end
|
|
34
|
-
|
|
35
40
|
end
|
|
36
41
|
end
|
data/lib/bundler/cli/open.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
1
|
+
require "bundler/cli/common"
|
|
2
|
+
require "shellwords"
|
|
3
3
|
|
|
4
4
|
module Bundler
|
|
5
5
|
class CLI::Open
|
|
@@ -10,14 +10,13 @@ module Bundler
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def run
|
|
13
|
-
editor = [ENV[
|
|
13
|
+
editor = [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? }
|
|
14
14
|
return Bundler.ui.info("To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR") unless editor
|
|
15
15
|
path = Bundler::CLI::Common.select_spec(name, :regex_match).full_gem_path
|
|
16
16
|
Dir.chdir(path) do
|
|
17
17
|
command = Shellwords.split(editor) + [path]
|
|
18
|
-
system(*command) || Bundler.ui.info("Could not run '#{command.join(
|
|
18
|
+
system(*command) || Bundler.ui.info("Could not run '#{command.join(" ")}'")
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
|
-
|
|
22
21
|
end
|
|
23
22
|
end
|