OSDN Git Service

merge v04
[pettanr/pettanr.git] / spec / cli / create.rb
diff --git a/spec/cli/create.rb b/spec/cli/create.rb
new file mode 100644 (file)
index 0000000..7a1588c
--- /dev/null
@@ -0,0 +1,14 @@
+if ARGV.size < 2\r
+  puts 'create.rb subdir controller {filename=create.json}'\r
+  exit\r
+end\r
+domain = 'http://localhost:3000'\r
+user = ARGV[0].to_s\r
+ctl = ARGV[1]\r
+f = ARGV[2] ? ARGV[2].to_s+'_create' : 'create'\r
+path = File.expand_path(File.dirname(__FILE__))\r
+filename = path + "/#{user}/#{ctl}/#{f}.json"\r
+\r
+cmd = "curl -d @#{filename} #{domain}/#{ctl}.json  -X POST -H \"Content-Type: application/json\""\r
+puts cmd\r
+exec cmd\r