zillabyte-cli 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d4a32ba8ba6751023917c2ae24ea830e0dc0b097
4
- data.tar.gz: e2b8de1a50cc65ea4209e492e2785d7965bb42c5
3
+ metadata.gz: a12f45e2993b92f487ad7a0b2b406df605ce7141
4
+ data.tar.gz: c270ac7db26aa00e9d8b8ccf5d61f27dcb3cf33e
5
5
  SHA512:
6
- metadata.gz: 098790826fa75356e0505e01d7f349aa3d1aeff0cf649a53c5622e20fb4a05c494c59d5d9f4fd0bdf375a00681ee30e80e240b02a3a11b40c240287908d5a600
7
- data.tar.gz: 69dec3f61189444b5d30a592e4a447883bc6765c0be75b88e9cc2dfa81ae556b6c69d46b1e793ff5afa33fcd7647ffb682d2d635041de1230f0a27d5b7e170fb
6
+ metadata.gz: 522f65cdbe2f6660f752dbbc8cf2a83bbc77385159c0fb8d5d0f3d2f13b9366c12d995db3c8a0323765aea1b94bd9d073f35d95559f4e4bd70e806f9ad372b9c
7
+ data.tar.gz: b19c7334d35942918fa16034d8da5fb22a1872e9011f360253c8d8b1ed7d3ca501edb6f66a62b3320161c685d39f52ce7d1fd9e836a1198570bf8df52718dca5
@@ -104,7 +104,7 @@ class Zillabyte::API::Flows < Zillabyte::API::Base
104
104
  error hash['error_message']
105
105
  else
106
106
  if(hash['tar'])
107
- session.display "unpacking to #{dir}" if type.nil?
107
+ session.display "unpacking to #{friendly_dir(dir)}" if type.nil?
108
108
  require("base64")
109
109
  tar = StringIO.new(Base64.decode64(hash['tar']))
110
110
  hash.delete('tar')
@@ -112,7 +112,7 @@ class Zillabyte::API::Flows < Zillabyte::API::Base
112
112
  #If you get an uri instead of the tar, then download the file directly from s3
113
113
  elsif(hash['uri'])
114
114
  require("net/http")
115
- session.display "downloading ##{id} to #{dir}" if type.nil?
115
+ session.display "downloading ##{id} to #{friendly_dir(dir)}" if type.nil?
116
116
  uri = URI(hash['uri'])
117
117
  try_again = 1
118
118
  while(try_again)
data/lib/zillabyte/api.rb CHANGED
@@ -119,8 +119,7 @@ class Zillabyte::API
119
119
  begin
120
120
  hash = JSON.parse(error.response.body)
121
121
  if hash['error_message']
122
- @session.error(hash['error_message'], type)
123
-
122
+ @session.error(hash['error_message'].to_s, type)
124
123
  end
125
124
  rescue JSON::ParserError => e
126
125
  # Trickle to generic message below
@@ -144,7 +144,7 @@ class Zillabyte::Command::Apps < Zillabyte::Command::Flows
144
144
 
145
145
  error("Unsupported language #{lang}. Zillabyte currently supports #{languages.join(', ')}.", type) if not languages.include? lang
146
146
 
147
- display "initializing empty #{lang} app in #{dir}" if type.nil?
147
+ display "initializing empty #{lang} app in #{friendly_dir(dir)}" if type.nil?
148
148
  erb_binding = binding
149
149
  require("fileutils")
150
150
  FileUtils.mkdir_p dir
@@ -162,9 +162,10 @@ class Zillabyte::Command::Apps < Zillabyte::Command::Flows
162
162
  end
163
163
 
164
164
  # Add the git remote...
165
- add_git_remote(name, remote)
165
+ # add_git_remote(name, remote)
166
166
 
167
167
  end
168
+ alias_command("init", "apps:init")
168
169
 
169
170
 
170
171
  # apps:errors ID
@@ -43,7 +43,7 @@ class Zillabyte::Command::Components < Zillabyte::Command::Flows
43
43
 
44
44
  error("Unsupported language #{lang}. Zillabyte currently supports #{languages.join(', ')}.", type) if not languages.include? lang
45
45
 
46
- display "initializing empty #{lang} component in #{dir}" if type.nil?
46
+ display "initializing empty #{lang} component in #{friendly_dir(dir)}" if type.nil?
47
47
  erb_binding = binding
48
48
  require("fileutils")
49
49
  FileUtils.mkdir_p dir
@@ -61,7 +61,7 @@ class Zillabyte::Command::Components < Zillabyte::Command::Flows
61
61
  end
62
62
 
63
63
  # Add the git remote...
64
- add_git_remote(name, remote)
64
+ # add_git_remote(name, remote)
65
65
 
66
66
  end
67
67
 
@@ -48,7 +48,7 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
48
48
  if type == "json"
49
49
  display "{}"
50
50
  else
51
- display "Flow ##{res['id']} pulled to #{dir}"
51
+ display "Flow ##{res['id']} pulled to #{friendly_dir(dir)}"
52
52
  end
53
53
  end
54
54
 
@@ -145,20 +145,13 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
145
145
  #
146
146
  # Performs any necessary initialization for the flow.
147
147
  #
148
- # --dir DIR # Flow directory
149
- # --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
150
- # --mode MODE # Specify development or production mode for dependencies #HIDDEN
148
+ # --dir DIR # Flow directory
149
+ # --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
150
+ # --mode MODE # Specify development or production mode for dependencies #HIDDEN
151
151
  #
152
152
  def prep()
153
153
  require("zillabyte/cli/config")
154
- mode, bundle_extra = case options[:mode]
155
- when nil, "development"
156
- [:development, ""]
157
- when "production"
158
- [:production, "; bundle install --deployment"]
159
- else
160
- error("Unsupported mode #{options[:mode].inspect()}. Zillabyte currently supports development and production.")
161
- end
154
+
162
155
  type = options[:output_type]
163
156
  dir = options[:dir] || shift_argument
164
157
  if dir.nil?
@@ -174,14 +167,16 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
174
167
 
175
168
  case meta["language"]
176
169
  when "ruby"
177
- # Execute in the bundler context
178
- if !File.exists?("#{meta['home_dir']}/vendor")
179
- full_script = File.join(dir, meta["script"])
180
- cmd = "cd \"#{meta['home_dir']}\"; unset BUNDLE_GEMFILE; unset RUBYOPT; bundle install #{bundle_extra}"
181
- exec(cmd)
170
+
171
+ base_cmd = "cd \"#{meta['home_dir']}\"; unset BUNDLE_GEMFILE; unset RUBYOPT;"
172
+ bundle_install_cmd = case options[:mode]
173
+ when "mock", /^mock-.+/
174
+ # Don't run 'bundle install' in test mode => speed things up. This assumes
175
+ # all gems are already installed locally!
182
176
  else
183
- display "vendor directory already exists!"
177
+ exec(base_cmd + "bundle install")
184
178
  end
179
+
185
180
  when "python"
186
181
  vDir = "#{meta['home_dir']}/vEnv"
187
182
  lock_file = meta['home_dir']+"/zillabyte_thread_lock_file"
@@ -455,6 +450,7 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
455
450
  # --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
456
451
  # --host HOST # #HIDDEN
457
452
  # --port PORT # #HIDDEN
453
+ # --unix_socket PATH # #HIDDEN
458
454
  #
459
455
  # HIDDEN:
460
456
  def live_run
@@ -464,6 +460,7 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
464
460
 
465
461
  host = options[:host]
466
462
  port = options[:port]
463
+ unix_socket = options[:unix_socket]
467
464
 
468
465
  dir = options[:dir] || shift_argument
469
466
  if dir.nil?
@@ -480,6 +477,8 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
480
477
 
481
478
  if(host && port)
482
479
  exec(Zillabyte::Helpers.command("--execute_live --name #{name.to_s} --host \"#{host}\" --port #{port}",type, dir))
480
+ elsif (unix_socket)
481
+ exec(Zillabyte::Helpers.command("--execute_live --name #{name.to_s} --unix_socket \"#{unix_socket}\"",type, dir))
483
482
  else
484
483
  exec(Zillabyte::Helpers.command("--execute_live --name #{name.to_s}",type, dir))
485
484
  end
@@ -495,6 +494,7 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
495
494
  # --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
496
495
  # --host HOST # #HIDDEN
497
496
  # --port PORT # #HIDDEN
497
+ # --unix_socket PATH # #HIDDEN
498
498
  #
499
499
  def info
500
500
 
@@ -509,6 +509,7 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
509
509
  end
510
510
  host = options[:host]
511
511
  port = options[:port]
512
+ unix_socket = options[:unix_socket]
512
513
 
513
514
  if (host && port)
514
515
 
@@ -519,6 +520,14 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
519
520
  socket.close()
520
521
  exit
521
522
 
523
+ elsif unix_socket
524
+
525
+ flow_info = Zillabyte::Helpers.get_info(dir, options)
526
+ socket = UNIXSocket.new(unix_socket)
527
+ socket.write(flow_info.to_json)
528
+ socket.close()
529
+ exit
530
+
522
531
  else
523
532
 
524
533
  # Otherwise, start our own tcp socket and get the info, print to stdout
@@ -3,14 +3,17 @@
3
3
 
4
4
  require 'zillabyte'
5
5
 
6
- Zillabyte.app("<%= name %>")
7
- .source("select * from web_pages")
8
- .each{ |page|
9
- if page['html'].include? "hello world"
10
- emit :url => page['url']
11
- end
12
- }
13
- .sink{
14
- name "has_hello_world"
15
- column "url", :string
16
- }
6
+ app = Zillabyte.app("<%= name %>")
7
+
8
+ stream = app.source("web_pages")
9
+
10
+ stream.each do |page|
11
+ if page['html'].include? "hello world"
12
+ emit :url => page['url']
13
+ end
14
+ end
15
+
16
+ stream.sink do
17
+ name "has_hello_world"
18
+ column "url", :string
19
+ end
@@ -117,38 +117,39 @@ module Zillabyte
117
117
  end
118
118
 
119
119
 
120
- def add_git_remote(name, remote = "zillabyte")
121
-
122
- remotes = {}
123
- require("zillabyte/auth")
124
- remotes[remote] = Zillabyte::Auth.git_host
125
-
126
- if ENV["ZILLABYTE_EXTRA_GIT_REMOTES"]
127
- # This is for dev purposes -- auto init various git env endpoints
128
- JSON.parse(ENV["ZILLABYTE_EXTRA_GIT_REMOTES"]).each_pair do |remote, host|
129
- remotes[remote] = host
130
- end
131
- end
132
-
133
- # Maybe initialize a git directory at the app root...
134
- if File.exists?(File.join(Dir.pwd, ".git")) == false && File.exists?(File.join(Dir.pwd, "zillabyte.conf.yaml"))
135
- git("init .")
136
- end
137
-
138
- # Install each git remote
139
- remotes.each_pair do |remote, host|
140
-
141
- if git('remote').split("\n").include?(remote)
142
- # already exists.. remove it.
143
- git("remote remove #{remote}")
144
- end
145
-
146
- git_url = "git@#{host}:#{Zillabyte::Auth.user}/#{name}"
147
- create_git_remote(remote, git_url)
148
-
149
- end
150
-
151
- end
120
+ # # Deprecated
121
+ # def add_git_remote(name, remote = "zillabyte")
122
+ #
123
+ # remotes = {}
124
+ # require("zillabyte/auth")
125
+ # remotes[remote] = Zillabyte::Auth.git_host
126
+ #
127
+ # if ENV["ZILLABYTE_EXTRA_GIT_REMOTES"]
128
+ # # This is for dev purposes -- auto init various git env endpoints
129
+ # JSON.parse(ENV["ZILLABYTE_EXTRA_GIT_REMOTES"]).each_pair do |remote, host|
130
+ # remotes[remote] = host
131
+ # end
132
+ # end
133
+ #
134
+ # # Maybe initialize a git directory at the app root...
135
+ # if File.exists?(File.join(Dir.pwd, ".git")) == false && File.exists?(File.join(Dir.pwd, "zillabyte.conf.yaml"))
136
+ # git("init .")
137
+ # end
138
+ #
139
+ # # Install each git remote
140
+ # remotes.each_pair do |remote, host|
141
+ #
142
+ # if git('remote').split("\n").include?(remote)
143
+ # # already exists.. remove it.
144
+ # git("remote remove #{remote}")
145
+ # end
146
+ #
147
+ # git_url = "git@#{host}:#{Zillabyte::Auth.user}/#{name}"
148
+ # create_git_remote(remote, git_url)
149
+ #
150
+ # end
151
+ #
152
+ # end
152
153
 
153
154
 
154
155
  # def get_flow_name(dir = Dir.pwd)
@@ -268,6 +269,9 @@ module Zillabyte
268
269
 
269
270
  end
270
271
 
272
+
273
+
274
+
271
275
  def command(arg="--execute_live", type = nil, dir = Dir.pwd, ignore_stderr = false, options = {})
272
276
  require("zillabyte/cli/config")
273
277
  meta = Zillabyte::CLI::Config.get_config_info(dir, self, options)
@@ -301,7 +305,15 @@ module Zillabyte
301
305
  return cmd
302
306
 
303
307
  end
308
+
309
+
310
+ def friendly_dir(dir)
311
+ require 'pathname'
312
+ Pathname.new(dir).relative_path_from(Pathname.new(Dir.pwd)).to_s
313
+ end
304
314
 
305
315
 
306
316
  end
307
317
  end
318
+
319
+
@@ -1,5 +1,5 @@
1
1
  module Zillabyte
2
2
  module CLI
3
- VERSION = "0.9.2"
3
+ VERSION = "0.9.3"
4
4
  end
5
5
  end
@@ -30,10 +30,8 @@ Gem::Specification.new do |spec|
30
30
  spec.add_dependency "activesupport", "~> 3.2.11"
31
31
  spec.add_dependency "multi_json", "~> 1.0"
32
32
 
33
- spec.add_dependency "bundler", "~> 1.3"
34
33
  spec.add_dependency "colorize", "~> 0.6"
35
34
  spec.add_dependency "indentation", "~> 0.1"
36
- spec.add_dependency "eventmachine"
37
35
 
38
36
  spec.post_install_message = """
39
37
  Getting Started with Zillabyte
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zillabyte-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - zillabyte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-26 00:00:00.000000000 Z
11
+ date: 2014-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -108,20 +108,6 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '1.0'
111
- - !ruby/object:Gem::Dependency
112
- name: bundler
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '1.3'
118
- type: :runtime
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '1.3'
125
111
  - !ruby/object:Gem::Dependency
126
112
  name: colorize
127
113
  requirement: !ruby/object:Gem::Requirement
@@ -150,20 +136,6 @@ dependencies:
150
136
  - - "~>"
151
137
  - !ruby/object:Gem::Version
152
138
  version: '0.1'
153
- - !ruby/object:Gem::Dependency
154
- name: eventmachine
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :runtime
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
139
  description: The Official Zillabyte CLI Gem
168
140
  email:
169
141
  - gem@zillabyte.com