Class: RestShifter::Commands::Create

Inherits:
Object
  • Object
show all
Defined in:
lib/rest_shifter/commands/create.rb

Class Method Summary collapse

Class Method Details

.run(args = ARGV) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rest_shifter/commands/create.rb', line 5

def run(args=ARGV)
  name = args.shift + ".flavor"
  dirname = File.dirname("#{Dir.home}/.rest_shifter/flavors/foo")
  FileUtils.mkdir_p(dirname) unless File.exists?(dirname)
  File.open(dirname + "/" + name, 'w') {|f| f.write(
'method_used                 = "get"
path                        = "/hello_world"
request_accept              = ""
request_content_type        = ""
response_sleep              = 0
response_status             = "200"
response_body               = "{ \"hello_world\" : \"Your service is working fine. :D\" }"
response_content_type       = "application/json"
response_location           = ""') }
end