Class: Stastic::Command::Rename

Inherits:
Base
  • Object
show all
Defined in:
lib/stastic/commands/rename.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = []) ⇒ Rename

Returns a new instance of Rename.



5
6
7
8
9
10
11
12
# File 'lib/stastic/commands/rename.rb', line 5

def initialize(args = [])
  case args.size
  when 1
    self.new_name = args.first
  else
    raise(Stastic::Command::InvalidOptions)
  end
end

Instance Attribute Details

#new_nameObject

Returns the value of attribute new_name.



3
4
5
# File 'lib/stastic/commands/rename.rb', line 3

def new_name
  @new_name
end

Instance Method Details

#indexObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/stastic/commands/rename.rb', line 14

def index
  print "Changing Site Name... "
  response = with_valid_site do
    Stastic::Client.rename(Stastic::Config.site_id, new_name)
  end
  Stastic::Config.update(:name => response["name"])
  puts "Success\n"
  print "  Site Name: #{Stastic::Config.name}\n"
  print "  Site URL:  #{Stastic::Config.name}.stastic.com\n\n"
end