Class: Bundler::CLI
- Inherits:
-
Object
- Object
- Bundler::CLI
- Defined in:
- lib/bundler08/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
- #bundle ⇒ Object
- #cache ⇒ Object
- #exec ⇒ Object
-
#initialize(options) ⇒ CLI
constructor
A new instance of CLI.
- #list ⇒ Object
- #list_outdated ⇒ Object
- #prune ⇒ Object
- #run(command) ⇒ Object
Constructor Details
Class Method Details
.run(command, options = {}) ⇒ Object
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 |
# File 'lib/bundler08/cli.rb', line 5 def self.run(command, = {}) new().run(command) rescue DefaultManifestNotFound => e Bundler.logger.error "Could not find a Gemfile to use" exit 3 rescue InvalidEnvironmentName => e Bundler.logger.error "Gemfile error: #{e.}" exit 4 rescue InvalidRepository => e Bundler.logger.error e. exit 5 rescue VersionConflict => e Bundler.logger.error e. exit 6 rescue GemNotFound => e Bundler.logger.error e. exit 7 rescue InvalidCacheArgument => e Bundler.logger.error e. exit 8 rescue SourceNotCached => e Bundler.logger.error e. exit 9 rescue ManifestFileNotFound => e Bundler.logger.error e. exit 10 end |
Instance Method Details
#bundle ⇒ Object
39 40 41 |
# File 'lib/bundler08/cli.rb', line 39 def bundle @bundle.install(@options) end |
#cache ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/bundler08/cli.rb', line 43 def cache gemfile = @options[:cache] if File.extname(gemfile) == ".gem" if !File.exist?(gemfile) raise InvalidCacheArgument, "'#{gemfile}' does not exist." end @bundle.cache(gemfile) elsif File.directory?(gemfile) || gemfile.include?('/') if !File.directory?(gemfile) raise InvalidCacheArgument, "'#{gemfile}' does not exist." end gemfiles = Dir["#{gemfile}/*.gem"] if gemfiles.empty? raise InvalidCacheArgument, "'#{gemfile}' contains no gemfiles" end @bundle.cache(*gemfiles) else raise InvalidCacheArgument, "w0t? '#{gemfile}' means nothing to me." end end |
#exec ⇒ Object
78 79 80 81 82 |
# File 'lib/bundler08/cli.rb', line 78 def exec @bundle.setup_environment # w0t? super(*$command) end |
#list ⇒ Object
70 71 72 |
# File 'lib/bundler08/cli.rb', line 70 def list @bundle.list(@options) end |
#list_outdated ⇒ Object
74 75 76 |
# File 'lib/bundler08/cli.rb', line 74 def list_outdated @bundle.list_outdated(@options) end |
#prune ⇒ Object
65 66 67 68 |
# File 'lib/bundler08/cli.rb', line 65 def prune Bundler.mode = :local @bundle.prune(@options) end |
#run(command) ⇒ Object
84 85 86 |
# File 'lib/bundler08/cli.rb', line 84 def run(command) send(command) end |