Class: Scatter::Commands::Remote::Add

Inherits:
SubCommand
  • Object
show all
Defined in:
lib/scatter/commands/remote/add.rb

Instance Method Summary collapse

Constructor Details

#initialize(out, name) ⇒ Add

Returns a new instance of Add.



5
6
7
8
# File 'lib/scatter/commands/remote/add.rb', line 5

def initialize(out, name)
  super(out)
  @name = name
end

Instance Method Details

#execute!Object

Raises:



10
11
12
13
14
# File 'lib/scatter/commands/remote/add.rb', line 10

def execute!
  raise CommandLineError, "Remote #{@name} already exists" if Scatter::Config.find_remote(@name)
  Scatter::Config.remotes << Scatter::Remote.new(@name)
  Scatter::Config.save!
end