urturn-cli 0.6.6 → 0.6.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -43,25 +43,31 @@ module Webdoc
43
43
 
44
44
  # Bundle and deploy the expression in the current directory
45
45
  def deploy(path='.')
46
- Webdoc::Cli.authenticate_then do |headers|
46
+ if(path =~ /\.(expression|zip)$/)
47
+ File.open(path) {|file| send_bundle(file)}
48
+ else
47
49
  Webdoc::Cli.cmd.say "==> create bundle"
48
- bundle(path) do |file|
49
- request = RestClient::Request.new(
50
- :method => :post,
51
- :url => url('/expressions.json'),
52
- :cookies => headers[:cookies],
53
- :payload => {
54
- :multipart => true,
55
- :bundle => file
56
- }
57
- )
58
- Webdoc::Cli.cmd.say "==> send bundle to #{Webdoc::Cli.host}"
59
- response = handle_request_error { request.execute }
60
- json = JSON.parse(response.strip)
61
- system_name = json['expression']['system_name']
62
- Webdoc::Cli.cmd.say "Expression #{@system_name} has been deployed on #{Webdoc::Cli.host}"
63
- Webdoc::Cli.cmd.say "http://#{Webdoc::Cli.host}/#{username}/#{system_name}"
64
- end
50
+ bundle(path) {|file| send_bundle(file) }
51
+ end
52
+ end
53
+
54
+ def send_bundle(file)
55
+ Webdoc::Cli.authenticate_then do |headers|
56
+ request = RestClient::Request.new(
57
+ :method => :post,
58
+ :url => url('/expressions.json'),
59
+ :cookies => headers[:cookies],
60
+ :payload => {
61
+ :multipart => true,
62
+ :bundle => file
63
+ }
64
+ )
65
+ Webdoc::Cli.cmd.say "==> send bundle to #{Webdoc::Cli.host}"
66
+ response = handle_request_error { request.execute }
67
+ json = JSON.parse(response.strip)
68
+ system_name = json['expression']['system_name']
69
+ Webdoc::Cli.cmd.say "Expression #{@system_name} has been deployed on #{Webdoc::Cli.host}"
70
+ Webdoc::Cli.cmd.say "http://#{Webdoc::Cli.host}/#{username}/#{system_name}"
65
71
  end
66
72
  end
67
73
 
@@ -1,5 +1,5 @@
1
1
  module Webdoc
2
2
  module Cli
3
- VERSION = "0.6.6"
3
+ VERSION = "0.6.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: urturn-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.6
4
+ version: 0.6.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-01-26 00:00:00.000000000 Z
13
+ date: 2013-01-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: gli