bundler 1.7.15 → 1.8.0.pre
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.
Potentially problematic release.
This version of bundler might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.gitignore +5 -14
- data/.rspec +1 -0
- data/.travis.yml +22 -15
- data/CHANGELOG.md +43 -13
- data/CODE_OF_CONDUCT.md +40 -0
- data/CONTRIBUTING.md +14 -12
- data/DEVELOPMENT.md +4 -2
- data/ISSUES.md +1 -1
- data/README.md +10 -14
- data/Rakefile +10 -10
- data/bin/bundle +1 -1
- data/bundler.gemspec +5 -4
- data/lib/bundler.rb +22 -3
- data/lib/bundler/anonymizable_uri.rb +24 -8
- data/lib/bundler/cli.rb +103 -66
- data/lib/bundler/cli/cache.rb +1 -0
- data/lib/bundler/cli/clean.rb +11 -4
- data/lib/bundler/cli/common.rb +2 -0
- data/lib/bundler/cli/console.rb +22 -26
- data/lib/bundler/cli/exec.rb +29 -22
- data/lib/bundler/cli/gem.rb +125 -37
- data/lib/bundler/cli/install.rb +22 -9
- data/lib/bundler/cli/outdated.rb +1 -1
- data/lib/bundler/cli/package.rb +8 -1
- data/lib/bundler/cli/show.rb +29 -3
- data/lib/bundler/cli/update.rb +2 -2
- data/lib/bundler/cli/viz.rb +1 -1
- data/lib/bundler/definition.rb +14 -22
- data/lib/bundler/dependency.rb +8 -1
- data/lib/bundler/dsl.rb +17 -4
- data/lib/bundler/endpoint_specification.rb +1 -1
- data/lib/bundler/env.rb +44 -25
- data/lib/bundler/fetcher.rb +33 -25
- data/lib/bundler/friendly_errors.rb +38 -5
- data/lib/bundler/gem_helper.rb +16 -10
- data/lib/bundler/gem_helpers.rb +1 -0
- data/lib/bundler/graph.rb +4 -1
- data/lib/bundler/index.rb +15 -25
- data/lib/bundler/installer.rb +6 -6
- data/lib/bundler/lockfile_parser.rb +7 -7
- data/lib/bundler/resolver.rb +2 -1
- data/lib/bundler/ruby_version.rb +1 -1
- data/lib/bundler/rubygems_ext.rb +1 -0
- data/lib/bundler/rubygems_integration.rb +1 -1
- data/lib/bundler/runtime.rb +22 -40
- data/lib/bundler/settings.rb +14 -5
- data/lib/bundler/setup.rb +2 -1
- data/lib/bundler/shared_helpers.rb +56 -4
- data/lib/bundler/source.rb +8 -9
- data/lib/bundler/source/git.rb +5 -1
- data/lib/bundler/source/git/git_proxy.rb +4 -0
- data/lib/bundler/source/path.rb +8 -11
- data/lib/bundler/source/path/installer.rb +0 -2
- data/lib/bundler/source/rubygems.rb +58 -72
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +13 -0
- data/lib/bundler/templates/newgem/LICENSE.txt.tt +17 -18
- data/lib/bundler/templates/newgem/README.md.tt +9 -1
- data/lib/bundler/templates/newgem/Rakefile.tt +2 -0
- data/lib/bundler/templates/newgem/bin/console.tt +14 -0
- data/lib/bundler/templates/newgem/bin/setup.tt +7 -0
- data/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
- data/lib/bundler/templates/newgem/gitignore.tt +2 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +1 -1
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +17 -13
- data/lib/bundler/templates/newgem/test/test_newgem.rb.tt +1 -1
- data/lib/bundler/ui/shell.rb +1 -1
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/worker.rb +73 -0
- data/man/bundle-config.ronn +17 -15
- data/man/bundle-install.ronn +102 -93
- data/man/bundle-update.ronn +39 -30
- data/man/bundle.ronn +6 -0
- data/man/gemfile.5.ronn +74 -13
- metadata +10 -231
- data/lib/bundler/parallel_workers.rb +0 -18
- data/lib/bundler/parallel_workers/thread_worker.rb +0 -30
- data/lib/bundler/parallel_workers/unix_worker.rb +0 -101
- data/lib/bundler/parallel_workers/worker.rb +0 -69
- data/lib/bundler/templates/newgem/bin/newgem.tt +0 -3
- data/spec/bundler/anonymizable_uri_spec.rb +0 -32
- data/spec/bundler/bundler_spec.rb +0 -72
- data/spec/bundler/cli_spec.rb +0 -16
- data/spec/bundler/definition_spec.rb +0 -22
- data/spec/bundler/dsl_spec.rb +0 -82
- data/spec/bundler/friendly_errors_spec.rb +0 -13
- data/spec/bundler/gem_helper_spec.rb +0 -226
- data/spec/bundler/psyched_yaml_spec.rb +0 -8
- data/spec/bundler/retry_spec.rb +0 -59
- data/spec/bundler/settings_spec.rb +0 -13
- data/spec/bundler/source/rubygems_spec.rb +0 -25
- data/spec/bundler/source_list_spec.rb +0 -361
- data/spec/cache/gems_spec.rb +0 -284
- data/spec/cache/git_spec.rb +0 -188
- data/spec/cache/path_spec.rb +0 -121
- data/spec/cache/platform_spec.rb +0 -57
- data/spec/commands/binstubs_spec.rb +0 -219
- data/spec/commands/check_spec.rb +0 -278
- data/spec/commands/clean_spec.rb +0 -592
- data/spec/commands/config_spec.rb +0 -263
- data/spec/commands/console_spec.rb +0 -76
- data/spec/commands/exec_spec.rb +0 -309
- data/spec/commands/help_spec.rb +0 -39
- data/spec/commands/init_spec.rb +0 -39
- data/spec/commands/inject_spec.rb +0 -78
- data/spec/commands/licenses_spec.rb +0 -18
- data/spec/commands/newgem_spec.rb +0 -428
- data/spec/commands/open_spec.rb +0 -68
- data/spec/commands/outdated_spec.rb +0 -156
- data/spec/commands/package_spec.rb +0 -114
- data/spec/commands/show_spec.rb +0 -125
- data/spec/install/binstubs_spec.rb +0 -24
- data/spec/install/bundler_spec.rb +0 -146
- data/spec/install/deploy_spec.rb +0 -250
- data/spec/install/gemfile/gemspec_spec.rb +0 -170
- data/spec/install/gemfile/git_spec.rb +0 -967
- data/spec/install/gemfile/path_spec.rb +0 -500
- data/spec/install/gemfile_spec.rb +0 -44
- data/spec/install/gems/c_ext_spec.rb +0 -48
- data/spec/install/gems/dependency_api_spec.rb +0 -652
- data/spec/install/gems/env_spec.rb +0 -107
- data/spec/install/gems/flex_spec.rb +0 -314
- data/spec/install/gems/groups_spec.rb +0 -308
- data/spec/install/gems/mirror_spec.rb +0 -39
- data/spec/install/gems/platform_spec.rb +0 -195
- data/spec/install/gems/post_install_spec.rb +0 -121
- data/spec/install/gems/resolving_spec.rb +0 -124
- data/spec/install/gems/simple_case_spec.rb +0 -377
- data/spec/install/gems/sources_spec.rb +0 -386
- data/spec/install/gems/standalone_spec.rb +0 -260
- data/spec/install/gems/sudo_spec.rb +0 -136
- data/spec/install/gems/win32_spec.rb +0 -26
- data/spec/install/gemspecs_spec.rb +0 -50
- data/spec/install/path_spec.rb +0 -150
- data/spec/install/post_bundle_message_spec.rb +0 -142
- data/spec/install/prereleases_spec.rb +0 -43
- data/spec/install/security_policy_spec.rb +0 -77
- data/spec/install/upgrade_spec.rb +0 -26
- data/spec/lock/git_spec.rb +0 -34
- data/spec/lock/lockfile_spec.rb +0 -924
- data/spec/other/bundle_ruby_spec.rb +0 -142
- data/spec/other/cli_dispatch_spec.rb +0 -21
- data/spec/other/ext_spec.rb +0 -60
- data/spec/other/platform_spec.rb +0 -1285
- data/spec/other/ssl_cert_spec.rb +0 -23
- data/spec/quality_spec.rb +0 -88
- data/spec/realworld/dependency_api_spec.rb +0 -60
- data/spec/realworld/edgecases_spec.rb +0 -212
- data/spec/realworld/parallel_spec.rb +0 -71
- data/spec/resolver/basic_spec.rb +0 -66
- data/spec/resolver/platform_spec.rb +0 -88
- data/spec/runtime/executable_spec.rb +0 -149
- data/spec/runtime/load_spec.rb +0 -107
- data/spec/runtime/platform_spec.rb +0 -90
- data/spec/runtime/require_spec.rb +0 -332
- data/spec/runtime/setup_spec.rb +0 -853
- data/spec/runtime/with_clean_env_spec.rb +0 -91
- data/spec/spec_helper.rb +0 -123
- data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +0 -13
- data/spec/support/artifice/endpoint.rb +0 -71
- data/spec/support/artifice/endpoint_500.rb +0 -37
- data/spec/support/artifice/endpoint_api_forbidden.rb +0 -11
- data/spec/support/artifice/endpoint_api_missing.rb +0 -16
- data/spec/support/artifice/endpoint_basic_authentication.rb +0 -13
- data/spec/support/artifice/endpoint_creds_diff_host.rb +0 -38
- data/spec/support/artifice/endpoint_extra.rb +0 -31
- data/spec/support/artifice/endpoint_extra_api.rb +0 -32
- data/spec/support/artifice/endpoint_extra_missing.rb +0 -15
- data/spec/support/artifice/endpoint_fallback.rb +0 -17
- data/spec/support/artifice/endpoint_host_redirect.rb +0 -15
- data/spec/support/artifice/endpoint_marshal_fail.rb +0 -11
- data/spec/support/artifice/endpoint_redirect.rb +0 -15
- data/spec/support/artifice/endpoint_strict_basic_authentication.rb +0 -18
- data/spec/support/artifice/endpoint_timeout.rb +0 -13
- data/spec/support/builders.rb +0 -693
- data/spec/support/fakeweb/rack-1.0.0.marshal +0 -2
- data/spec/support/fakeweb/windows.rb +0 -23
- data/spec/support/hax.rb +0 -22
- data/spec/support/helpers.rb +0 -361
- data/spec/support/indexes.rb +0 -280
- data/spec/support/matchers.rb +0 -77
- data/spec/support/path.rb +0 -85
- data/spec/support/permissions.rb +0 -10
- data/spec/support/platforms.rb +0 -94
- data/spec/support/ruby_ext.rb +0 -20
- data/spec/support/rubygems_ext.rb +0 -39
- data/spec/support/streams.rb +0 -13
- data/spec/support/sudo.rb +0 -16
- data/spec/update/gems_spec.rb +0 -201
- data/spec/update/git_spec.rb +0 -283
- data/spec/update/path_spec.rb +0 -18
data/lib/bundler/cli/clean.rb
CHANGED
@@ -7,10 +7,17 @@ module Bundler
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def run
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
require_path_or_force
|
11
|
+
Bundler.load.clean(options[:"dry-run"])
|
12
|
+
end
|
13
|
+
|
14
|
+
protected
|
15
|
+
|
16
|
+
def require_path_or_force
|
17
|
+
if !Bundler.settings[:path] && !options[:force]
|
18
|
+
Bundler.ui.error "Cleaning all the gems on your system is dangerous! " \
|
19
|
+
"If you're sure you want to remove every system gem not in this " \
|
20
|
+
"bundle, run `bundle clean --force`."
|
14
21
|
exit 1
|
15
22
|
end
|
16
23
|
end
|
data/lib/bundler/cli/common.rb
CHANGED
data/lib/bundler/cli/console.rb
CHANGED
@@ -1,41 +1,37 @@
|
|
1
1
|
module Bundler
|
2
2
|
class CLI::Console
|
3
|
-
attr_reader :options, :group
|
4
|
-
def initialize(options, group
|
3
|
+
attr_reader :options, :group
|
4
|
+
def initialize(options, group)
|
5
5
|
@options = options
|
6
6
|
@group = group
|
7
|
-
@consoles = consoles
|
8
7
|
end
|
9
8
|
|
10
9
|
def run
|
11
10
|
group ? Bundler.require(:default, *(group.split.map! {|g| g.to_sym })) : Bundler.require
|
12
11
|
ARGV.clear
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
begin
|
18
|
-
require preferred || true
|
19
|
-
rescue LoadError
|
20
|
-
# Is it in Gemfile?
|
21
|
-
Bundler.ui.error "Could not load the #{preferred} console"
|
22
|
-
Bundler.ui.info "Falling back on IRB..."
|
23
|
-
|
24
|
-
require 'irb'
|
25
|
-
preferred = 'irb'
|
26
|
-
end
|
27
|
-
|
28
|
-
constant = consoles[preferred]
|
13
|
+
console = get_console(Bundler.settings[:console] || 'irb')
|
14
|
+
console.start
|
15
|
+
end
|
29
16
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
17
|
+
def get_console(name)
|
18
|
+
require name
|
19
|
+
get_constant(name)
|
20
|
+
rescue LoadError
|
21
|
+
Bundler.ui.error "Couldn't load console #{name}"
|
22
|
+
get_constant('irb')
|
23
|
+
end
|
37
24
|
|
38
|
-
|
25
|
+
def get_constant(name)
|
26
|
+
const_name = {
|
27
|
+
'pry' => :Pry,
|
28
|
+
'ripl' => :Ripl,
|
29
|
+
'irb' => :IRB,
|
30
|
+
}[name]
|
31
|
+
Object.const_get(const_name)
|
32
|
+
rescue NameError
|
33
|
+
Bundler.ui.error "Could not find constant #{const_name}"
|
34
|
+
exit 1
|
39
35
|
end
|
40
36
|
|
41
37
|
end
|
data/lib/bundler/cli/exec.rb
CHANGED
@@ -1,36 +1,43 @@
|
|
1
1
|
module Bundler
|
2
2
|
class CLI::Exec
|
3
|
-
attr_reader :options, :args
|
3
|
+
attr_reader :options, :args, :cmd
|
4
4
|
|
5
5
|
def initialize(options, args)
|
6
6
|
@options = options
|
7
|
+
@cmd = args.shift
|
7
8
|
@args = args
|
9
|
+
|
10
|
+
if RUBY_VERSION >= "2.0"
|
11
|
+
@args << { :close_others => !options.keep_file_descriptors? }
|
12
|
+
elsif options.keep_file_descriptors?
|
13
|
+
Bundler.ui.warn "Ruby version #{RUBY_VERSION} defaults to keeping non-standard file descriptors on Kernel#exec."
|
14
|
+
end
|
8
15
|
end
|
9
16
|
|
10
17
|
def run
|
11
|
-
|
12
|
-
Bundler.load.setup_environment
|
18
|
+
raise ArgumentError if cmd.nil?
|
13
19
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
# Run
|
22
|
-
Kernel.exec(*args)
|
23
|
-
rescue Errno::EACCES
|
24
|
-
Bundler.ui.error "bundler: not executable: #{args.first}"
|
25
|
-
exit 126
|
26
|
-
rescue Errno::ENOENT
|
27
|
-
Bundler.ui.error "bundler: command not found: #{args.first}"
|
28
|
-
Bundler.ui.warn "Install missing gem executables with `bundle install`"
|
29
|
-
exit 127
|
30
|
-
rescue ArgumentError
|
31
|
-
Bundler.ui.error "bundler: exec needs a command to run"
|
32
|
-
exit 128
|
20
|
+
# First, try to exec directly to something in PATH
|
21
|
+
SharedHelpers.set_bundle_environment
|
22
|
+
bin_path = Bundler.which(@cmd)
|
23
|
+
if bin_path
|
24
|
+
Kernel.exec(bin_path, *args)
|
33
25
|
end
|
26
|
+
|
27
|
+
# If that didn't work, set up the whole bundle
|
28
|
+
Bundler.definition.validate_ruby!
|
29
|
+
Bundler.load.setup_environment
|
30
|
+
Kernel.exec(@cmd, *args)
|
31
|
+
rescue Errno::EACCES
|
32
|
+
Bundler.ui.error "bundler: not executable: #{cmd}"
|
33
|
+
exit 126
|
34
|
+
rescue Errno::ENOENT
|
35
|
+
Bundler.ui.error "bundler: command not found: #{cmd}"
|
36
|
+
Bundler.ui.warn "Install missing gem executables with `bundle install`"
|
37
|
+
exit 127
|
38
|
+
rescue ArgumentError
|
39
|
+
Bundler.ui.error "bundler: exec needs a command to run"
|
40
|
+
exit 128
|
34
41
|
end
|
35
42
|
|
36
43
|
end
|
data/lib/bundler/cli/gem.rb
CHANGED
@@ -1,30 +1,31 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
1
3
|
module Bundler
|
2
4
|
class CLI::Gem
|
3
|
-
attr_reader :options, :gem_name, :thor
|
5
|
+
attr_reader :options, :gem_name, :thor, :name, :target
|
6
|
+
|
4
7
|
def initialize(options, gem_name, thor)
|
5
8
|
@options = options
|
6
|
-
@gem_name = gem_name
|
9
|
+
@gem_name = resolve_name(gem_name)
|
7
10
|
@thor = thor
|
11
|
+
|
12
|
+
@name = @gem_name
|
13
|
+
@target = Pathname.pwd.join(gem_name)
|
14
|
+
|
15
|
+
validate_ext_name if options[:ext]
|
8
16
|
end
|
9
17
|
|
10
18
|
def run
|
11
|
-
|
12
|
-
Bundler.ui.error "You have specified a gem name which does not conform to the \n" \
|
13
|
-
"naming guidelines for C extensions. For more information, \n" \
|
14
|
-
"see the 'Extension Naming' section at the following URL:\n" \
|
15
|
-
"http://guides.rubygems.org/gems-with-extensions/\n"
|
16
|
-
exit 1
|
17
|
-
end
|
19
|
+
Bundler.ui.confirm "Creating gem '#{name}'..."
|
18
20
|
|
19
|
-
name = gem_name.chomp("/") # remove trailing slash if present
|
20
21
|
underscored_name = name.tr('-', '_')
|
21
22
|
namespaced_path = name.tr('-', '/')
|
22
|
-
target = File.join(Dir.pwd, name)
|
23
23
|
constant_name = name.split('_').map{|p| p[0..0].upcase + p[1..-1] }.join
|
24
24
|
constant_name = constant_name.split('-').map{|q| q[0..0].upcase + q[1..-1] }.join('::') if constant_name =~ /-/
|
25
25
|
constant_array = constant_name.split('::')
|
26
26
|
git_user_name = `git config user.name`.chomp
|
27
27
|
git_user_email = `git config user.email`.chomp
|
28
|
+
|
28
29
|
opts = {
|
29
30
|
:name => name,
|
30
31
|
:underscored_name => underscored_name,
|
@@ -35,44 +36,131 @@ module Bundler
|
|
35
36
|
:author => git_user_name.empty? ? "TODO: Write your name" : git_user_name,
|
36
37
|
:email => git_user_email.empty? ? "TODO: Write your email address" : git_user_email,
|
37
38
|
:test => options[:test],
|
38
|
-
:ext => options[:ext]
|
39
|
+
:ext => options[:ext],
|
40
|
+
:bin => options[:bin]
|
41
|
+
}
|
42
|
+
|
43
|
+
templates = {
|
44
|
+
"Gemfile.tt" => "Gemfile",
|
45
|
+
"gitignore.tt" => ".gitignore",
|
46
|
+
"lib/newgem.rb.tt" => "lib/#{namespaced_path}.rb",
|
47
|
+
"lib/newgem/version.rb.tt" => "lib/#{namespaced_path}/version.rb",
|
48
|
+
"newgem.gemspec.tt" => "#{name}.gemspec",
|
49
|
+
"Rakefile.tt" => "Rakefile",
|
50
|
+
"README.md.tt" => "README.md",
|
51
|
+
"bin/console.tt" => "bin/console",
|
52
|
+
"bin/setup.tt" => "bin/setup"
|
39
53
|
}
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
if options[:bin]
|
50
|
-
thor.template(File.join("newgem/bin/newgem.tt"), File.join(target, 'bin', name), opts)
|
54
|
+
|
55
|
+
if ask_and_set(:coc, "Do you want to include a code of conduct in gems you generate?",
|
56
|
+
"Codes of conduct can increase contributions to your project by contributors who " \
|
57
|
+
"prefer collaborative, safe spaces. You can read more about the code of conduct at " \
|
58
|
+
"contributor-covenant.org. Having a code of conduct means agreeing to the responsibility " \
|
59
|
+
"of enforcing it, so be sure that you are prepared to do that. For suggestions about " \
|
60
|
+
"how to enforce codes of conduct, see bit.ly/coc-enforcement."
|
61
|
+
)
|
62
|
+
templates.merge!("CODE_OF_CONDUCT.md.tt" => "CODE_OF_CONDUCT.md")
|
51
63
|
end
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
thor.template(File.join("newgem/test/test_newgem.rb.tt"), File.join(target, "test/test_#{namespaced_path}.rb"), opts)
|
64
|
+
|
65
|
+
if ask_and_set(:mit, "Do you want to license your code permissively under the MIT license?",
|
66
|
+
"This means that any other developer or company will be legally allowed to use your code " \
|
67
|
+
"for free as long as they admit you created it. You can read more about the MIT license " \
|
68
|
+
"at choosealicense.com/licenses/mit."
|
69
|
+
)
|
70
|
+
templates.merge!("LICENSE.txt.tt" => "LICENSE.txt")
|
60
71
|
end
|
61
|
-
|
62
|
-
|
72
|
+
|
73
|
+
if test_framework = ask_and_set_test_framework
|
74
|
+
templates.merge!(".travis.yml.tt" => ".travis.yml")
|
75
|
+
|
76
|
+
case test_framework
|
77
|
+
when 'rspec'
|
78
|
+
templates.merge!(
|
79
|
+
"rspec.tt" => ".rspec",
|
80
|
+
"spec/spec_helper.rb.tt" => "spec/spec_helper.rb",
|
81
|
+
"spec/newgem_spec.rb.tt" => "spec/#{namespaced_path}_spec.rb"
|
82
|
+
)
|
83
|
+
when 'minitest'
|
84
|
+
templates.merge!(
|
85
|
+
"test/minitest_helper.rb.tt" => "test/minitest_helper.rb",
|
86
|
+
"test/test_newgem.rb.tt" => "test/test_#{namespaced_path}.rb"
|
87
|
+
)
|
88
|
+
end
|
63
89
|
end
|
90
|
+
|
91
|
+
templates.merge!("exe/newgem.tt" => "exe/#{name}") if options[:bin]
|
92
|
+
|
64
93
|
if options[:ext]
|
65
|
-
|
66
|
-
|
67
|
-
|
94
|
+
templates.merge!(
|
95
|
+
"ext/newgem/extconf.rb.tt" => "ext/#{name}/extconf.rb",
|
96
|
+
"ext/newgem/newgem.h.tt" => "ext/#{name}/#{underscored_name}.h",
|
97
|
+
"ext/newgem/newgem.c.tt" => "ext/#{name}/#{underscored_name}.c"
|
98
|
+
)
|
99
|
+
end
|
100
|
+
|
101
|
+
templates.each do |src, dst|
|
102
|
+
thor.template("newgem/#{src}", target.join(dst), opts)
|
68
103
|
end
|
104
|
+
|
69
105
|
Bundler.ui.info "Initializing git repo in #{target}"
|
70
106
|
Dir.chdir(target) { `git init`; `git add .` }
|
71
107
|
|
72
108
|
if options[:edit]
|
73
|
-
|
109
|
+
# Open gemspec in editor
|
110
|
+
thor.run("#{options["edit"]} \"#{target.join("#{name}.gemspec")}\"")
|
74
111
|
end
|
75
112
|
end
|
76
113
|
|
114
|
+
private
|
115
|
+
|
116
|
+
def resolve_name(name)
|
117
|
+
Pathname.pwd.join(name).basename.to_s
|
118
|
+
end
|
119
|
+
|
120
|
+
def ask_and_set(key, header, message)
|
121
|
+
result = options[key]
|
122
|
+
if !Bundler.settings.all.include?("gem.#{key}")
|
123
|
+
if result.nil?
|
124
|
+
Bundler.ui.confirm header
|
125
|
+
result = Bundler.ui.ask("#{message} y/(n):") == "y"
|
126
|
+
end
|
127
|
+
|
128
|
+
Bundler.settings.set_global("gem.#{key}", result)
|
129
|
+
end
|
130
|
+
|
131
|
+
result || Bundler.settings["gem.#{key}"]
|
132
|
+
end
|
133
|
+
|
134
|
+
def validate_ext_name
|
135
|
+
return unless gem_name.index('-')
|
136
|
+
|
137
|
+
Bundler.ui.error "You have specified a gem name which does not conform to the \n" \
|
138
|
+
"naming guidelines for C extensions. For more information, \n" \
|
139
|
+
"see the 'Extension Naming' section at the following URL:\n" \
|
140
|
+
"http://guides.rubygems.org/gems-with-extensions/\n"
|
141
|
+
exit 1
|
142
|
+
end
|
143
|
+
|
144
|
+
def ask_and_set_test_framework
|
145
|
+
test_framework = options[:test] || Bundler.settings["gem.test"]
|
146
|
+
if test_framework.nil?
|
147
|
+
Bundler.ui.confirm "Do you want to generate tests with your gem?"
|
148
|
+
result = Bundler.ui.ask "Type 'rspec' or 'minitest' to generate those test files now and " \
|
149
|
+
"in the future. rspec/minitest/(none):"
|
150
|
+
if result =~ /rspec|minitest/
|
151
|
+
test_framework = result
|
152
|
+
else
|
153
|
+
test_framework = "false"
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
if Bundler.settings["gem.test"].nil?
|
158
|
+
Bundler.settings.set_global("gem.test", test_framework)
|
159
|
+
end
|
160
|
+
|
161
|
+
return if test_framework == "false"
|
162
|
+
test_framework
|
163
|
+
end
|
164
|
+
|
77
165
|
end
|
78
166
|
end
|
data/lib/bundler/cli/install.rb
CHANGED
@@ -44,7 +44,7 @@ module Bundler
|
|
44
44
|
"before deploying."
|
45
45
|
end
|
46
46
|
|
47
|
-
if Bundler.
|
47
|
+
if Bundler.app_cache.exist?
|
48
48
|
options[:local] = true
|
49
49
|
end
|
50
50
|
|
@@ -66,6 +66,7 @@ module Bundler
|
|
66
66
|
Bundler.settings[:shebang] = options["shebang"] if options["shebang"]
|
67
67
|
Bundler.settings[:jobs] = options["jobs"] if options["jobs"]
|
68
68
|
Bundler.settings[:no_prune] = true if options["no-prune"]
|
69
|
+
Bundler.settings[:no_install] = true if options["no-install"]
|
69
70
|
Bundler.settings[:clean] = options["clean"] if options["clean"]
|
70
71
|
Bundler.settings.without = options[:without]
|
71
72
|
Bundler::Fetcher.disable_endpoint = options["full-index"]
|
@@ -77,23 +78,24 @@ module Bundler
|
|
77
78
|
definition = Bundler.definition
|
78
79
|
definition.validate_ruby!
|
79
80
|
Installer.install(Bundler.root, definition, options)
|
80
|
-
Bundler.load.cache if Bundler.
|
81
|
+
Bundler.load.cache if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.settings[:frozen]
|
82
|
+
|
83
|
+
Bundler.ui.confirm "Bundle complete! #{dependencies_count_for(definition)}, #{gems_installed_for(definition)}."
|
84
|
+
confirm_without_groups
|
81
85
|
|
82
86
|
if Bundler.settings[:path]
|
83
87
|
absolute_path = File.expand_path(Bundler.settings[:path])
|
84
88
|
relative_path = absolute_path.sub(File.expand_path('.'), '.')
|
85
|
-
Bundler.ui.confirm "
|
86
|
-
without_groups_messages
|
87
|
-
Bundler.ui.confirm "It was installed into #{relative_path}"
|
89
|
+
Bundler.ui.confirm "Bundled gems are installed into #{relative_path}."
|
88
90
|
else
|
89
|
-
Bundler.ui.confirm "Your bundle is complete!"
|
90
|
-
without_groups_messages
|
91
91
|
Bundler.ui.confirm "Use `bundle show [gemname]` to see where a bundled gem is installed."
|
92
92
|
end
|
93
|
+
|
93
94
|
Installer.post_install_messages.to_a.each do |name, msg|
|
94
95
|
Bundler.ui.confirm "Post-install message from #{name}:"
|
95
96
|
Bundler.ui.info msg
|
96
97
|
end
|
98
|
+
|
97
99
|
Installer.ambiguous_gems.to_a.each do |name, installed_from_uri, *also_found_in_uris|
|
98
100
|
Bundler.ui.error "Warning: the gem '#{name}' was found in multiple sources."
|
99
101
|
Bundler.ui.error "Installed from: #{installed_from_uri}"
|
@@ -111,7 +113,7 @@ module Bundler
|
|
111
113
|
end
|
112
114
|
rescue GemNotFound, VersionConflict => e
|
113
115
|
if options[:local] && Bundler.app_cache.exist?
|
114
|
-
Bundler.ui.warn "Some gems seem to be missing from your
|
116
|
+
Bundler.ui.warn "Some gems seem to be missing from your #{Bundler.settings.app_cache_path} directory."
|
115
117
|
end
|
116
118
|
|
117
119
|
unless Bundler.definition.has_rubygems_remotes?
|
@@ -133,11 +135,22 @@ module Bundler
|
|
133
135
|
"application for all non-root users on this machine.", :wrap => true
|
134
136
|
end
|
135
137
|
|
136
|
-
def
|
138
|
+
def confirm_without_groups
|
137
139
|
if Bundler.settings.without.any?
|
138
140
|
require "bundler/cli/common"
|
139
141
|
Bundler.ui.confirm Bundler::CLI::Common.without_groups_message
|
140
142
|
end
|
141
143
|
end
|
144
|
+
|
145
|
+
def dependencies_count_for(definition)
|
146
|
+
count = definition.dependencies.count
|
147
|
+
"#{count} Gemfile #{count == 1 ? 'dependency' : 'dependencies'}"
|
148
|
+
end
|
149
|
+
|
150
|
+
def gems_installed_for(definition)
|
151
|
+
count = definition.specs.count
|
152
|
+
"#{count} #{count == 1 ? 'gem' : 'gems'} now installed"
|
153
|
+
end
|
154
|
+
|
142
155
|
end
|
143
156
|
end
|