OSDN Git Service

add story
[pettanr/pettanr.git] / spec / cli / update.rb
diff --git a/spec/cli/update.rb b/spec/cli/update.rb
new file mode 100644 (file)
index 0000000..8e19b43
--- /dev/null
@@ -0,0 +1,14 @@
+if ARGV.size < 2\r
+  puts 'update.rb subdir controller {filename=update.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+'_update' : 'update'\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 PUT -H \"Content-Type: application/json\""\r
+puts cmd\r
+exec cmd\r