bundler-prehistoric 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +3 -0
- data/.travis.yml +100 -0
- data/CHANGELOG.md +1640 -0
- data/CONTRIBUTING.md +32 -0
- data/DEVELOPMENT.md +117 -0
- data/Gemfile +3 -0
- data/ISSUES.md +96 -0
- data/LICENSE.md +23 -0
- data/README.md +46 -0
- data/Rakefile +256 -0
- data/UPGRADING.md +103 -0
- data/bin/bundle +21 -0
- data/bin/bundle_ruby +56 -0
- data/bin/bundler +21 -0
- data/bundler.gemspec +33 -0
- data/lib/bundler.rb +442 -0
- data/lib/bundler/backports/time.rb +7 -0
- data/lib/bundler/capistrano.rb +16 -0
- data/lib/bundler/cli.rb +395 -0
- data/lib/bundler/cli/binstubs.rb +38 -0
- data/lib/bundler/cli/cache.rb +34 -0
- data/lib/bundler/cli/check.rb +35 -0
- data/lib/bundler/cli/clean.rb +19 -0
- data/lib/bundler/cli/common.rb +54 -0
- data/lib/bundler/cli/config.rb +84 -0
- data/lib/bundler/cli/console.rb +39 -0
- data/lib/bundler/cli/exec.rb +37 -0
- data/lib/bundler/cli/gem.rb +101 -0
- data/lib/bundler/cli/init.rb +33 -0
- data/lib/bundler/cli/inject.rb +33 -0
- data/lib/bundler/cli/install.rb +133 -0
- data/lib/bundler/cli/open.rb +23 -0
- data/lib/bundler/cli/outdated.rb +80 -0
- data/lib/bundler/cli/package.rb +36 -0
- data/lib/bundler/cli/platform.rb +43 -0
- data/lib/bundler/cli/show.rb +48 -0
- data/lib/bundler/cli/update.rb +73 -0
- data/lib/bundler/cli/viz.rb +27 -0
- data/lib/bundler/constants.rb +5 -0
- data/lib/bundler/current_ruby.rb +155 -0
- data/lib/bundler/definition.rb +604 -0
- data/lib/bundler/dep_proxy.rb +43 -0
- data/lib/bundler/dependency.rb +106 -0
- data/lib/bundler/deployment.rb +59 -0
- data/lib/bundler/deprecate.rb +15 -0
- data/lib/bundler/dsl.rb +305 -0
- data/lib/bundler/endpoint_specification.rb +76 -0
- data/lib/bundler/env.rb +56 -0
- data/lib/bundler/environment.rb +42 -0
- data/lib/bundler/fetcher.rb +396 -0
- data/lib/bundler/friendly_errors.rb +42 -0
- data/lib/bundler/gem_helper.rb +169 -0
- data/lib/bundler/gem_helpers.rb +25 -0
- data/lib/bundler/gem_installer.rb +9 -0
- data/lib/bundler/gem_path_manipulation.rb +8 -0
- data/lib/bundler/gem_tasks.rb +2 -0
- data/lib/bundler/graph.rb +169 -0
- data/lib/bundler/index.rb +184 -0
- data/lib/bundler/injector.rb +64 -0
- data/lib/bundler/installer.rb +332 -0
- data/lib/bundler/lazy_specification.rb +83 -0
- data/lib/bundler/lockfile_parser.rb +146 -0
- data/lib/bundler/match_platform.rb +13 -0
- data/lib/bundler/parallel_workers.rb +18 -0
- data/lib/bundler/parallel_workers/thread_worker.rb +30 -0
- data/lib/bundler/parallel_workers/unix_worker.rb +101 -0
- data/lib/bundler/parallel_workers/worker.rb +69 -0
- data/lib/bundler/psyched_yaml.rb +26 -0
- data/lib/bundler/remote_specification.rb +57 -0
- data/lib/bundler/resolver.rb +534 -0
- data/lib/bundler/retry.rb +60 -0
- data/lib/bundler/ruby_dsl.rb +11 -0
- data/lib/bundler/ruby_version.rb +117 -0
- data/lib/bundler/rubygems_ext.rb +171 -0
- data/lib/bundler/rubygems_integration.rb +578 -0
- data/lib/bundler/runtime.rb +310 -0
- data/lib/bundler/settings.rb +176 -0
- data/lib/bundler/setup.rb +23 -0
- data/lib/bundler/shared_helpers.rb +110 -0
- data/lib/bundler/similarity_detector.rb +63 -0
- data/lib/bundler/source.rb +29 -0
- data/lib/bundler/source/git.rb +289 -0
- data/lib/bundler/source/git/git_proxy.rb +158 -0
- data/lib/bundler/source/path.rb +225 -0
- data/lib/bundler/source/path/installer.rb +38 -0
- data/lib/bundler/source/rubygems.rb +334 -0
- data/lib/bundler/source/svn.rb +260 -0
- data/lib/bundler/source/svn/svn_proxy.rb +110 -0
- data/lib/bundler/spec_set.rb +154 -0
- data/lib/bundler/ssl_certs/.document +1 -0
- data/lib/bundler/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +14 -0
- data/lib/bundler/ssl_certs/DigiCertHighAssuranceEVRootCA.pem +23 -0
- data/lib/bundler/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +28 -0
- data/lib/bundler/ssl_certs/GeoTrustGlobalCA.pem +20 -0
- data/lib/bundler/ssl_certs/certificate_manager.rb +41 -0
- data/lib/bundler/templates/Executable +16 -0
- data/lib/bundler/templates/Executable.standalone +12 -0
- data/lib/bundler/templates/Gemfile +4 -0
- data/lib/bundler/templates/newgem/.travis.yml.tt +3 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
- data/lib/bundler/templates/newgem/LICENSE.txt.tt +22 -0
- data/lib/bundler/templates/newgem/README.md.tt +31 -0
- data/lib/bundler/templates/newgem/Rakefile.tt +26 -0
- data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
- data/lib/bundler/templates/newgem/consolerc.tt +3 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +3 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +9 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +6 -0
- data/lib/bundler/templates/newgem/gitignore.tt +16 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +12 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +38 -0
- data/lib/bundler/templates/newgem/rspec.tt +2 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +11 -0
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -0
- data/lib/bundler/templates/newgem/test/minitest_helper.rb.tt +4 -0
- data/lib/bundler/templates/newgem/test/test_newgem.rb.tt +11 -0
- data/lib/bundler/ui.rb +7 -0
- data/lib/bundler/ui/rg_proxy.rb +21 -0
- data/lib/bundler/ui/shell.rb +98 -0
- data/lib/bundler/ui/silent.rb +44 -0
- data/lib/bundler/vendor/.document +0 -0
- data/lib/bundler/vendor/net/http/faster.rb +26 -0
- data/lib/bundler/vendor/net/http/persistent.rb +1230 -0
- data/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb +128 -0
- data/lib/bundler/vendor/thor.rb +480 -0
- data/lib/bundler/vendor/thor/actions.rb +319 -0
- data/lib/bundler/vendor/thor/actions/create_file.rb +103 -0
- data/lib/bundler/vendor/thor/actions/create_link.rb +59 -0
- data/lib/bundler/vendor/thor/actions/directory.rb +118 -0
- data/lib/bundler/vendor/thor/actions/empty_directory.rb +135 -0
- data/lib/bundler/vendor/thor/actions/file_manipulation.rb +316 -0
- data/lib/bundler/vendor/thor/actions/inject_into_file.rb +107 -0
- data/lib/bundler/vendor/thor/base.rb +656 -0
- data/lib/bundler/vendor/thor/command.rb +133 -0
- data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +77 -0
- data/lib/bundler/vendor/thor/core_ext/io_binary_read.rb +10 -0
- data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +98 -0
- data/lib/bundler/vendor/thor/error.rb +32 -0
- data/lib/bundler/vendor/thor/group.rb +281 -0
- data/lib/bundler/vendor/thor/invocation.rb +173 -0
- data/lib/bundler/vendor/thor/line_editor.rb +17 -0
- data/lib/bundler/vendor/thor/line_editor/basic.rb +35 -0
- data/lib/bundler/vendor/thor/line_editor/readline.rb +88 -0
- data/lib/bundler/vendor/thor/parser.rb +4 -0
- data/lib/bundler/vendor/thor/parser/argument.rb +73 -0
- data/lib/bundler/vendor/thor/parser/arguments.rb +175 -0
- data/lib/bundler/vendor/thor/parser/option.rb +121 -0
- data/lib/bundler/vendor/thor/parser/options.rb +218 -0
- data/lib/bundler/vendor/thor/rake_compat.rb +71 -0
- data/lib/bundler/vendor/thor/runner.rb +322 -0
- data/lib/bundler/vendor/thor/shell.rb +81 -0
- data/lib/bundler/vendor/thor/shell/basic.rb +420 -0
- data/lib/bundler/vendor/thor/shell/color.rb +149 -0
- data/lib/bundler/vendor/thor/shell/html.rb +126 -0
- data/lib/bundler/vendor/thor/util.rb +267 -0
- data/lib/bundler/vendor/thor/version.rb +3 -0
- data/lib/bundler/vendored_persistent.rb +3 -0
- data/lib/bundler/vendored_thor.rb +8 -0
- data/lib/bundler/version.rb +6 -0
- data/lib/bundler/vlad.rb +11 -0
- data/man/bundle-config.ronn +155 -0
- data/man/bundle-exec.ronn +136 -0
- data/man/bundle-install.ronn +372 -0
- data/man/bundle-package.ronn +59 -0
- data/man/bundle-platform.ronn +42 -0
- data/man/bundle-update.ronn +179 -0
- data/man/bundle.ronn +92 -0
- data/man/gemfile.5.ronn +369 -0
- data/man/index.txt +7 -0
- data/spec/bundler/bundler_spec.rb +74 -0
- data/spec/bundler/cli_spec.rb +16 -0
- data/spec/bundler/definition_spec.rb +21 -0
- data/spec/bundler/dsl_spec.rb +108 -0
- data/spec/bundler/friendly_errors_spec.rb +13 -0
- data/spec/bundler/gem_helper_spec.rb +225 -0
- data/spec/bundler/psyched_yaml_spec.rb +8 -0
- data/spec/bundler/retry_spec.rb +59 -0
- data/spec/bundler/settings_spec.rb +13 -0
- data/spec/bundler/source_spec.rb +25 -0
- data/spec/cache/gems_spec.rb +316 -0
- data/spec/cache/git_spec.rb +188 -0
- data/spec/cache/path_spec.rb +121 -0
- data/spec/cache/platform_spec.rb +53 -0
- data/spec/cache/svn_spec.rb +82 -0
- data/spec/commands/binstubs_spec.rb +246 -0
- data/spec/commands/check_spec.rb +278 -0
- data/spec/commands/clean_spec.rb +652 -0
- data/spec/commands/config_spec.rb +227 -0
- data/spec/commands/console_spec.rb +102 -0
- data/spec/commands/exec_spec.rb +367 -0
- data/spec/commands/help_spec.rb +39 -0
- data/spec/commands/init_spec.rb +39 -0
- data/spec/commands/inject_spec.rb +78 -0
- data/spec/commands/licenses_spec.rb +31 -0
- data/spec/commands/newgem_spec.rb +451 -0
- data/spec/commands/open_spec.rb +80 -0
- data/spec/commands/outdated_spec.rb +168 -0
- data/spec/commands/package_spec.rb +128 -0
- data/spec/commands/show_spec.rb +152 -0
- data/spec/install/binstubs_spec.rb +24 -0
- data/spec/install/bundler_spec.rb +146 -0
- data/spec/install/deploy_spec.rb +237 -0
- data/spec/install/gemfile/gemspec_spec.rb +170 -0
- data/spec/install/gemfile/git_spec.rb +967 -0
- data/spec/install/gemfile/path_spec.rb +480 -0
- data/spec/install/gemfile/svn_spec.rb +582 -0
- data/spec/install/gemfile_spec.rb +44 -0
- data/spec/install/gems/c_ext_spec.rb +48 -0
- data/spec/install/gems/dependency_api_spec.rb +580 -0
- data/spec/install/gems/env_spec.rb +107 -0
- data/spec/install/gems/flex_spec.rb +314 -0
- data/spec/install/gems/groups_spec.rb +308 -0
- data/spec/install/gems/mirror_spec.rb +39 -0
- data/spec/install/gems/platform_spec.rb +221 -0
- data/spec/install/gems/post_install_spec.rb +121 -0
- data/spec/install/gems/resolving_spec.rb +124 -0
- data/spec/install/gems/simple_case_spec.rb +386 -0
- data/spec/install/gems/standalone_spec.rb +260 -0
- data/spec/install/gems/sudo_spec.rb +136 -0
- data/spec/install/gems/win32_spec.rb +26 -0
- data/spec/install/gemspecs_spec.rb +50 -0
- data/spec/install/path_spec.rb +150 -0
- data/spec/install/post_bundle_message_spec.rb +142 -0
- data/spec/install/prereleases_spec.rb +43 -0
- data/spec/install/security_policy_spec.rb +77 -0
- data/spec/install/upgrade_spec.rb +26 -0
- data/spec/lock/git_spec.rb +34 -0
- data/spec/lock/lockfile_spec.rb +912 -0
- data/spec/lock/svn_spec.rb +35 -0
- data/spec/other/bundle_ruby_spec.rb +142 -0
- data/spec/other/cli_dispatch_spec.rb +21 -0
- data/spec/other/ext_spec.rb +60 -0
- data/spec/other/platform_spec.rb +1285 -0
- data/spec/other/ssl_cert_spec.rb +10 -0
- data/spec/quality_spec.rb +88 -0
- data/spec/realworld/dependency_api_spec.rb +60 -0
- data/spec/realworld/edgecases_spec.rb +177 -0
- data/spec/realworld/parallel_spec.rb +69 -0
- data/spec/resolver/basic_spec.rb +66 -0
- data/spec/resolver/platform_spec.rb +88 -0
- data/spec/runtime/executable_spec.rb +149 -0
- data/spec/runtime/load_spec.rb +107 -0
- data/spec/runtime/platform_spec.rb +90 -0
- data/spec/runtime/require_spec.rb +332 -0
- data/spec/runtime/setup_spec.rb +856 -0
- data/spec/runtime/with_clean_env_spec.rb +91 -0
- data/spec/spec_helper.rb +114 -0
- data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +13 -0
- data/spec/support/artifice/endpoint.rb +71 -0
- data/spec/support/artifice/endpoint_500.rb +37 -0
- data/spec/support/artifice/endpoint_api_missing.rb +16 -0
- data/spec/support/artifice/endpoint_basic_authentication.rb +13 -0
- data/spec/support/artifice/endpoint_creds_diff_host.rb +38 -0
- data/spec/support/artifice/endpoint_extra.rb +31 -0
- data/spec/support/artifice/endpoint_extra_missing.rb +15 -0
- data/spec/support/artifice/endpoint_fallback.rb +17 -0
- data/spec/support/artifice/endpoint_host_redirect.rb +15 -0
- data/spec/support/artifice/endpoint_marshal_fail.rb +11 -0
- data/spec/support/artifice/endpoint_redirect.rb +15 -0
- data/spec/support/artifice/endpoint_strict_basic_authentication.rb +18 -0
- data/spec/support/artifice/endpoint_timeout.rb +13 -0
- data/spec/support/builders.rb +748 -0
- data/spec/support/fakeweb/rack-1.0.0.marshal +2 -0
- data/spec/support/fakeweb/windows.rb +23 -0
- data/spec/support/hax.rb +22 -0
- data/spec/support/helpers.rb +348 -0
- data/spec/support/indexes.rb +280 -0
- data/spec/support/less_than_proc.rb +14 -0
- data/spec/support/matchers.rb +77 -0
- data/spec/support/path.rb +81 -0
- data/spec/support/permissions.rb +10 -0
- data/spec/support/platforms.rb +94 -0
- data/spec/support/ruby_ext.rb +20 -0
- data/spec/support/rubygems_ext.rb +39 -0
- data/spec/support/streams.rb +13 -0
- data/spec/support/sudo.rb +16 -0
- data/spec/update/gems_spec.rb +201 -0
- data/spec/update/git_spec.rb +236 -0
- data/spec/update/source_spec.rb +63 -0
- data/spec/update/svn_spec.rb +100 -0
- metadata +486 -0
@@ -0,0 +1,34 @@
|
|
1
|
+
module Bundler
|
2
|
+
class CLI::Cache
|
3
|
+
attr_reader :options
|
4
|
+
def initialize(options)
|
5
|
+
@options = options
|
6
|
+
end
|
7
|
+
|
8
|
+
def run
|
9
|
+
Bundler.definition.validate_ruby!
|
10
|
+
Bundler.definition.resolve_with_cache!
|
11
|
+
setup_cache_all
|
12
|
+
Bundler.load.cache
|
13
|
+
Bundler.settings[:no_prune] = true if options["no-prune"]
|
14
|
+
Bundler.load.lock
|
15
|
+
rescue GemNotFound => e
|
16
|
+
Bundler.ui.error(e.message)
|
17
|
+
Bundler.ui.warn "Run `bundle install` to install missing gems."
|
18
|
+
exit 1
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def setup_cache_all
|
24
|
+
Bundler.settings[:cache_all] = options[:all] if options.key?("all")
|
25
|
+
|
26
|
+
if Bundler.definition.sources.any? { |s| !s.is_a?(Source::Rubygems) } && !Bundler.settings[:cache_all]
|
27
|
+
Bundler.ui.warn "Your Gemfile contains path and git dependencies. If you want " \
|
28
|
+
"to package them as well, please pass the --all flag. This will be the default " \
|
29
|
+
"on Bundler 2.0."
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Bundler
|
2
|
+
class CLI::Check
|
3
|
+
attr_reader :options
|
4
|
+
def initialize(options)
|
5
|
+
@options = options
|
6
|
+
end
|
7
|
+
|
8
|
+
def run
|
9
|
+
Bundler.settings[:path] = File.expand_path(options[:path]) if options[:path]
|
10
|
+
begin
|
11
|
+
definition = Bundler.definition
|
12
|
+
definition.validate_ruby!
|
13
|
+
not_installed = definition.missing_specs
|
14
|
+
rescue GemNotFound, VersionConflict
|
15
|
+
Bundler.ui.error "Bundler can't satisfy your Gemfile's dependencies."
|
16
|
+
Bundler.ui.warn "Install missing gems with `bundle install`."
|
17
|
+
exit 1
|
18
|
+
end
|
19
|
+
|
20
|
+
if not_installed.any?
|
21
|
+
Bundler.ui.error "The following gems are missing"
|
22
|
+
not_installed.each { |s| Bundler.ui.error " * #{s.name} (#{s.version})" }
|
23
|
+
Bundler.ui.warn "Install missing gems with `bundle install`"
|
24
|
+
exit 1
|
25
|
+
elsif !Bundler.default_lockfile.exist? && Bundler.settings[:frozen]
|
26
|
+
Bundler.ui.error "This bundle has been frozen, but there is no Gemfile.lock present"
|
27
|
+
exit 1
|
28
|
+
else
|
29
|
+
Bundler.load.lock unless options[:"dry-run"]
|
30
|
+
Bundler.ui.info "The Gemfile's dependencies are satisfied"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Bundler
|
2
|
+
class CLI::Clean
|
3
|
+
attr_reader :options
|
4
|
+
|
5
|
+
def initialize(options)
|
6
|
+
@options = options
|
7
|
+
end
|
8
|
+
|
9
|
+
def run
|
10
|
+
if Bundler.settings[:path] || options[:force]
|
11
|
+
Bundler.load.clean(options[:"dry-run"])
|
12
|
+
else
|
13
|
+
Bundler.ui.error "Can only use bundle clean when --path is set or --force is set"
|
14
|
+
exit 1
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module Bundler
|
2
|
+
module CLI::Common
|
3
|
+
def self.without_groups_message
|
4
|
+
groups = Bundler.settings.without
|
5
|
+
group_list = [groups[0...-1].join(", "), groups[-1..-1]].
|
6
|
+
reject{|s| s.to_s.empty? }.join(" and ")
|
7
|
+
group_str = (groups.size == 1) ? "group" : "groups"
|
8
|
+
"Gems in the #{group_str} #{group_list} were not installed."
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.select_spec(name, regex_match = nil)
|
12
|
+
specs = []
|
13
|
+
regexp = Regexp.new(name) if regex_match
|
14
|
+
|
15
|
+
Bundler.definition.specs.each do |spec|
|
16
|
+
return spec if spec.name == name
|
17
|
+
specs << spec if regexp && spec.name =~ regexp
|
18
|
+
end
|
19
|
+
|
20
|
+
case specs.count
|
21
|
+
when 0
|
22
|
+
raise GemNotFound, gem_not_found_message(name, Bundler.definition.dependencies)
|
23
|
+
when 1
|
24
|
+
specs.first
|
25
|
+
else
|
26
|
+
ask_for_spec_from(specs)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.ask_for_spec_from(specs)
|
31
|
+
if !$stdout.tty? && ENV['BUNDLE_SPEC_RUN'].nil?
|
32
|
+
raise GemNotFound, gem_not_found_message(name, Bundler.definition.dependencies)
|
33
|
+
end
|
34
|
+
|
35
|
+
specs.each_with_index do |spec, index|
|
36
|
+
Bundler.ui.info "#{index.succ} : #{spec.name}", true
|
37
|
+
end
|
38
|
+
Bundler.ui.info '0 : - exit -', true
|
39
|
+
|
40
|
+
num = Bundler.ui.ask('> ').to_i
|
41
|
+
num > 0 ? specs[num - 1] : nil
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.gem_not_found_message(missing_gem_name, alternatives)
|
45
|
+
require 'bundler/similarity_detector'
|
46
|
+
message = "Could not find gem '#{missing_gem_name}'."
|
47
|
+
alternate_names = alternatives.map { |a| a.respond_to?(:name) ? a.name : a }
|
48
|
+
suggestions = SimilarityDetector.new(alternate_names).similar_word_list(missing_gem_name)
|
49
|
+
message += "\nDid you mean #{suggestions}?" if suggestions
|
50
|
+
message
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
module Bundler
|
2
|
+
class CLI::Config
|
3
|
+
attr_reader :options, :thor
|
4
|
+
attr_accessor :args
|
5
|
+
|
6
|
+
def initialize(options, args, thor)
|
7
|
+
@options = options
|
8
|
+
@args = args
|
9
|
+
@thor = thor
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
peek = args.shift
|
14
|
+
|
15
|
+
if peek && peek =~ /^\-\-/
|
16
|
+
name, scope = args.shift, $'
|
17
|
+
else
|
18
|
+
name, scope = peek, "global"
|
19
|
+
end
|
20
|
+
|
21
|
+
unless name
|
22
|
+
Bundler.ui.confirm "Settings are listed in order of priority. The top value will be used.\n"
|
23
|
+
|
24
|
+
Bundler.settings.all.each do |setting|
|
25
|
+
Bundler.ui.confirm "#{setting}"
|
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
|
33
|
+
return
|
34
|
+
end
|
35
|
+
|
36
|
+
case scope
|
37
|
+
when "delete"
|
38
|
+
Bundler.settings.set_local(name, nil)
|
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
|
48
|
+
|
49
|
+
locations = Bundler.settings.locations(name)
|
50
|
+
|
51
|
+
if scope == "global"
|
52
|
+
if local = locations[:local]
|
53
|
+
Bundler.ui.info "Your application has set #{name} to #{local.inspect}. This will override the " \
|
54
|
+
"global value you are currently setting"
|
55
|
+
end
|
56
|
+
|
57
|
+
if env = locations[:env]
|
58
|
+
Bundler.ui.info "You have a bundler environment variable for #{name} set to #{env.inspect}. " \
|
59
|
+
"This will take precedence over the global value you are setting"
|
60
|
+
end
|
61
|
+
|
62
|
+
if global = locations[:global]
|
63
|
+
Bundler.ui.info "You are replacing the current global value of #{name}, which is currently #{global.inspect}"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
if scope == "local" && local = locations[:local]
|
68
|
+
Bundler.ui.info "You are replacing the current local value of #{name}, which is currently #{local.inspect}"
|
69
|
+
end
|
70
|
+
|
71
|
+
if name.match(/\Alocal\./)
|
72
|
+
pathname = Pathname.new(args.join(" "))
|
73
|
+
self.args = [pathname.expand_path.to_s] if pathname.directory?
|
74
|
+
end
|
75
|
+
|
76
|
+
Bundler.settings.send("set_#{scope}", name, args.join(" "))
|
77
|
+
else
|
78
|
+
Bundler.ui.error "Invalid scope --#{scope} given. Please use --local or --global."
|
79
|
+
exit 1
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Bundler
|
2
|
+
class CLI::Console
|
3
|
+
attr_reader :options, :group
|
4
|
+
def initialize(options, group)
|
5
|
+
@options = options
|
6
|
+
@group = group
|
7
|
+
end
|
8
|
+
|
9
|
+
def run
|
10
|
+
group ? Bundler.require(:default, *(group.split.map! {|g| g.to_sym })) : Bundler.require
|
11
|
+
ARGV.clear
|
12
|
+
|
13
|
+
console = get_console(Bundler.settings[:console] || 'irb')
|
14
|
+
load '.consolerc' if File.exists?('.consolerc')
|
15
|
+
console.start
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_console(name)
|
19
|
+
require name
|
20
|
+
get_constant(name)
|
21
|
+
rescue LoadError
|
22
|
+
Bundler.ui.error "Couldn't load console #{name}"
|
23
|
+
get_constant('irb')
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_constant(name)
|
27
|
+
const_name = {
|
28
|
+
'pry' => :Pry,
|
29
|
+
'ripl' => :Ripl,
|
30
|
+
'irb' => :IRB,
|
31
|
+
}[name]
|
32
|
+
Object.const_get(const_name)
|
33
|
+
rescue NameError
|
34
|
+
Bundler.ui.error "Could not find constant #{const_name}"
|
35
|
+
exit 1
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Bundler
|
2
|
+
class CLI::Exec
|
3
|
+
attr_reader :options, :args
|
4
|
+
|
5
|
+
def initialize(options, args)
|
6
|
+
@options = options
|
7
|
+
@args = args
|
8
|
+
end
|
9
|
+
|
10
|
+
def run
|
11
|
+
Bundler.definition.validate_ruby!
|
12
|
+
Bundler.load.setup_environment
|
13
|
+
|
14
|
+
begin
|
15
|
+
if RUBY_VERSION >= "2.0"
|
16
|
+
@args << { :close_others => !options.keep_file_descriptors? }
|
17
|
+
elsif options.keep_file_descriptors?
|
18
|
+
Bundler.ui.warn "Ruby version #{RUBY_VERSION} defaults to keeping non-standard file descriptors on Kernel#exec."
|
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
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
class CLI::Gem
|
5
|
+
attr_reader :options, :gem_name, :thor, :name, :target
|
6
|
+
|
7
|
+
def initialize(options, gem_name, thor)
|
8
|
+
@options = options
|
9
|
+
@gem_name = gem_name
|
10
|
+
@thor = thor
|
11
|
+
|
12
|
+
@name = gem_name.chomp("/") # remove trailing slash if present
|
13
|
+
@target = Pathname.pwd.join(name)
|
14
|
+
|
15
|
+
validate_ext_name if options[:ext]
|
16
|
+
end
|
17
|
+
|
18
|
+
def run
|
19
|
+
underscored_name = name.tr('-', '_')
|
20
|
+
namespaced_path = name.tr('-', '/')
|
21
|
+
constant_name = name.split('_').map{|p| p[0..0].upcase + p[1..-1] }.join
|
22
|
+
constant_name = constant_name.split('-').map{|q| q[0..0].upcase + q[1..-1] }.join('::') if constant_name =~ /-/
|
23
|
+
constant_array = constant_name.split('::')
|
24
|
+
git_user_name = `git config user.name`.chomp
|
25
|
+
git_user_email = `git config user.email`.chomp
|
26
|
+
|
27
|
+
opts = {
|
28
|
+
:name => name,
|
29
|
+
:underscored_name => underscored_name,
|
30
|
+
:namespaced_path => namespaced_path,
|
31
|
+
:makefile_path => "#{underscored_name}/#{underscored_name}",
|
32
|
+
:constant_name => constant_name,
|
33
|
+
:constant_array => constant_array,
|
34
|
+
:author => git_user_name.empty? ? "TODO: Write your name" : git_user_name,
|
35
|
+
:email => git_user_email.empty? ? "TODO: Write your email address" : git_user_email,
|
36
|
+
:test => options[:test],
|
37
|
+
:ext => options[:ext]
|
38
|
+
}
|
39
|
+
|
40
|
+
templates = {
|
41
|
+
"Gemfile.tt" => "Gemfile",
|
42
|
+
"gitignore.tt" => ".gitignore",
|
43
|
+
"lib/newgem.rb.tt" => "lib/#{namespaced_path}.rb",
|
44
|
+
"lib/newgem/version.rb.tt" => "lib/#{namespaced_path}/version.rb",
|
45
|
+
"LICENSE.txt.tt" => "LICENSE.txt",
|
46
|
+
"newgem.gemspec.tt" => "#{name}.gemspec",
|
47
|
+
"consolerc.tt" => ".consolerc",
|
48
|
+
"Rakefile.tt" => "Rakefile",
|
49
|
+
"README.md.tt" => "README.md"
|
50
|
+
}
|
51
|
+
|
52
|
+
templates.merge!("bin/newgem.tt" => "bin/#{name}") if options[:bin]
|
53
|
+
templates.merge!(".travis.yml.tt" => ".travis.yml") if options[:test]
|
54
|
+
|
55
|
+
case options[:test]
|
56
|
+
when 'rspec'
|
57
|
+
templates.merge!(
|
58
|
+
"rspec.tt" => ".rspec",
|
59
|
+
"spec/spec_helper.rb.tt" => "spec/spec_helper.rb",
|
60
|
+
"spec/newgem_spec.rb.tt" => "spec/#{namespaced_path}_spec.rb"
|
61
|
+
)
|
62
|
+
when 'minitest'
|
63
|
+
templates.merge!(
|
64
|
+
"test/minitest_helper.rb.tt" => "test/minitest_helper.rb",
|
65
|
+
"test/test_newgem.rb.tt" => "test/test_#{namespaced_path}.rb"
|
66
|
+
)
|
67
|
+
end
|
68
|
+
|
69
|
+
if options[:ext]
|
70
|
+
templates.merge!(
|
71
|
+
"ext/newgem/extconf.rb.tt" => "ext/#{name}/extconf.rb",
|
72
|
+
"ext/newgem/newgem.h.tt" => "ext/#{name}/#{underscored_name}.h",
|
73
|
+
"ext/newgem/newgem.c.tt" => "ext/#{name}/#{underscored_name}.c"
|
74
|
+
)
|
75
|
+
end
|
76
|
+
|
77
|
+
templates.each do |src, dst|
|
78
|
+
thor.template("newgem/#{src}", target.join(dst), opts)
|
79
|
+
end
|
80
|
+
|
81
|
+
Bundler.ui.info "Initializing git repo in #{target}"
|
82
|
+
Dir.chdir(target) { `git init`; `git add .` }
|
83
|
+
|
84
|
+
if options[:edit]
|
85
|
+
# Open gemspec in editor
|
86
|
+
thor.run("#{options["edit"]} \"#{target.join("#{name}.gemspec")}\"")
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def validate_ext_name
|
91
|
+
return unless gem_name.index('-')
|
92
|
+
|
93
|
+
Bundler.ui.error "You have specified a gem name which does not conform to the \n" \
|
94
|
+
"naming guidelines for C extensions. For more information, \n" \
|
95
|
+
"see the 'Extension Naming' section at the following URL:\n" \
|
96
|
+
"http://guides.rubygems.org/gems-with-extensions/\n"
|
97
|
+
exit 1
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Bundler
|
2
|
+
class CLI::Init
|
3
|
+
attr_reader :options
|
4
|
+
def initialize(options)
|
5
|
+
@options = options
|
6
|
+
end
|
7
|
+
|
8
|
+
def run
|
9
|
+
if File.exist?("Gemfile")
|
10
|
+
Bundler.ui.error "Gemfile already exists at #{Dir.pwd}/Gemfile"
|
11
|
+
exit 1
|
12
|
+
end
|
13
|
+
|
14
|
+
if options[:gemspec]
|
15
|
+
gemspec = File.expand_path(options[:gemspec])
|
16
|
+
unless File.exist?(gemspec)
|
17
|
+
Bundler.ui.error "Gem specification #{gemspec} doesn't exist"
|
18
|
+
exit 1
|
19
|
+
end
|
20
|
+
spec = Gem::Specification.load(gemspec)
|
21
|
+
puts "Writing new Gemfile to #{Dir.pwd}/Gemfile"
|
22
|
+
File.open('Gemfile', 'wb') do |file|
|
23
|
+
file << "# Generated from #{gemspec}\n"
|
24
|
+
file << spec.to_gemfile
|
25
|
+
end
|
26
|
+
else
|
27
|
+
puts "Writing new Gemfile to #{Dir.pwd}/Gemfile"
|
28
|
+
FileUtils.cp(File.expand_path('../../templates/Gemfile', __FILE__), 'Gemfile')
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|