Class: Gem::Commands::BundleCommand
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- Gem::Commands::BundleCommand
- Defined in:
- lib/bundler08/commands/bundle_command.rb
Instance Method Summary collapse
-
#description ⇒ Object
:nodoc:.
- #execute ⇒ Object
-
#initialize ⇒ BundleCommand
constructor
A new instance of BundleCommand.
- #usage ⇒ Object
Constructor Details
#initialize ⇒ BundleCommand
Returns a new instance of BundleCommand.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/bundler08/commands/bundle_command.rb', line 3 def initialize super('bundle', 'Create a gem bundle based on your Gemfile', {:manifest => nil, :update => false}) add_option('-i', '--init',"Create a Gemfile") do [:init] = true end add_option('-m', '--manifest MANIFEST', "Specify the path to the manifest file") do |manifest, | [:manifest] = manifest end add_option('-u', '--update', "Force a remote check for newer gems") do [:update] = true end add_option('--cached', "Only use cached gems when expanding the bundle") do [:cached] = true end add_option('--cache GEM', "Specify a path to a .gem file to add to the bundled gem cache") do |gem, | [:cache] = gem end add_option('--prune-cache', "Removes all .gem files that are not a part of the bundle from the cache") do [:prune] = true end add_option('--list', "List all gems that are part of the active bundle") do [:list] = true end add_option('--list-outdated', "List all outdated gems that are part of the active bundle") do [:list_outdated] = true end add_option('-b', '--build-options OPTION_FILE', "Specify a path to a yml file with build options for binary gems") do |option_file, | if File.exist?(option_file) require 'yaml' [:build_options] = YAML.load_file(option_file) end end add_option('--only ENV', "Only expand the given environment. To specify multiple environments, use --only multiple times.") do |env, | [:only] ||= [] [:only] << env end end |
Instance Method Details
#description ⇒ Object
:nodoc:
55 56 57 58 59 |
# File 'lib/bundler08/commands/bundle_command.rb', line 55 def description # :nodoc: <<-EOF Bundle stuff EOF end |
#execute ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/bundler08/commands/bundle_command.rb', line 61 def execute # Prevent the bundler from getting required unless it is actually being used require 'bundler08' if [:cache] Bundler::CLI.run(:cache, ) elsif [:prune] Bundler::CLI.run(:prune, ) elsif [:list] Bundler::CLI.run(:list, ) elsif [:list_outdated] Bundler::CLI.run(:list_outdated, ) elsif [:init] if File.exists?("Gemfile") Bundler.logger.error "The Gemfile already exists" else FileUtils.cp File.("../../templates/Gemfile", __FILE__), "Gemfile" Bundler.logger.info "Initialized Gemfile in #{Dir.pwd}" end else Bundler::CLI.run(:bundle, ) end end |
#usage ⇒ Object
51 52 53 |
# File 'lib/bundler08/commands/bundle_command.rb', line 51 def usage "#{program_name}" end |