Class: Bundler::CLI::Config
- Inherits:
-
Object
- Object
- Bundler::CLI::Config
- Defined in:
- lib/bundler/cli/config.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#thor ⇒ Object
readonly
Returns the value of attribute thor.
Instance Method Summary collapse
-
#initialize(options, args, thor) ⇒ Config
constructor
A new instance of Config.
- #run ⇒ Object
Constructor Details
#initialize(options, args, thor) ⇒ Config
Returns a new instance of Config.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/bundler/cli/config.rb', line 7 def initialize(, args, thor) @options = @args = args @thor = thor @name = peek = args.shift @scope = "global" return unless peek && peek.start_with?("--") @name = args.shift @scope = peek[2..-1] end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
5 6 7 |
# File 'lib/bundler/cli/config.rb', line 5 def args @args end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/bundler/cli/config.rb', line 4 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/bundler/cli/config.rb', line 4 def @options end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
4 5 6 |
# File 'lib/bundler/cli/config.rb', line 4 def scope @scope end |
#thor ⇒ Object (readonly)
Returns the value of attribute thor.
4 5 6 |
# File 'lib/bundler/cli/config.rb', line 4 def thor @thor end |
Instance Method Details
#run ⇒ Object
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 |
# File 'lib/bundler/cli/config.rb', line 18 def run unless name confirm_all return end unless valid_scope?(scope) Bundler.ui.error "Invalid scope --#{scope} given. Please use --local or --global." exit 1 end if scope == "delete" Bundler.settings.set_local(name, nil) Bundler.settings.set_global(name, nil) return end if args.empty? confirm(name) return end Bundler.ui.info() if Bundler.settings.send("set_#{scope}", name, new_value) end |