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.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/bundler/cli/config.rb', line 8 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.
6 7 8 |
# File 'lib/bundler/cli/config.rb', line 6 def args @args end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/bundler/cli/config.rb', line 5 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/bundler/cli/config.rb', line 5 def @options end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
5 6 7 |
# File 'lib/bundler/cli/config.rb', line 5 def scope @scope end |
#thor ⇒ Object (readonly)
Returns the value of attribute thor.
5 6 7 |
# File 'lib/bundler/cli/config.rb', line 5 def thor @thor end |
Instance Method Details
#run ⇒ Object
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 50 |
# File 'lib/bundler/cli/config.rb', line 19 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? if [:parseable] if value = Bundler.settings[name] Bundler.ui.info("#{name}=#{value}") end return end confirm(name) return end Bundler.ui.info() if Bundler.settings.send("set_#{scope}", name, new_value) end |