pagoda 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
1
  pagoda-*.*.*.gem
2
+ pkg
data/Gemfile.lock CHANGED
@@ -1,25 +1,27 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pagoda (0.1.15)
4
+ pagoda (0.6.0)
5
5
  gli
6
6
  pagoda-client
7
7
  pagoda-tunnel
8
+ rest-client
9
+ socketio-client
8
10
 
9
11
  GEM
10
12
  remote: http://rubygems.org/
11
13
  specs:
12
14
  coderay (0.9.8)
13
15
  diff-lcs (1.1.3)
14
- gli (1.3.5)
15
- json_pure (1.6.1)
16
+ gli (2.0.0)
17
+ json_pure (1.7.4)
16
18
  method_source (0.6.7)
17
19
  ruby_parser (>= 2.3.1)
18
- mime-types (1.17.2)
19
- pagoda-client (0.1.2)
20
+ mime-types (1.19)
21
+ pagoda-client (0.1.8)
20
22
  json_pure
21
23
  rest-client
22
- pagoda-tunnel (0.1.2)
24
+ pagoda-tunnel (0.1.3)
23
25
  rest-client
24
26
  pry (0.9.7.3)
25
27
  coderay (~> 0.9.8)
@@ -40,6 +42,8 @@ GEM
40
42
  sexp_processor (~> 3.0)
41
43
  sexp_processor (3.0.7)
42
44
  slop (2.1.0)
45
+ socketio-client (0.0.3)
46
+ rest-client
43
47
 
44
48
  PLATFORMS
45
49
  ruby
data/Rakefile CHANGED
@@ -1,8 +1,20 @@
1
1
  #!/usr/bin/env rake
2
2
  require "bundler/gem_tasks"
3
3
  require "rspec/core/rake_task"
4
+ require 'rake/packagetask'
5
+
4
6
 
5
7
  desc "Run all specs"
6
8
  RSpec::Core::RakeTask.new('spec') do |t|
7
9
  t.rspec_opts = ['--colour --format documentation']
10
+ end
11
+
12
+ desc "Package task"
13
+ Rake::PackageTask.new("pagoda", Pagoda::CLI::VERSION ) do |p|
14
+ p.need_tar_gz = true
15
+ p.package_files.include("./**/**/**/**")
16
+ end
17
+
18
+ task :push do
19
+ sh "scp pkg/pagoda-#{Pagoda::CLI::VERSION}.tar.gz getdeb@pagodabox.com:shared/pagoda/"
8
20
  end
data/bin/pagoda CHANGED
@@ -5,10 +5,10 @@ require 'rest_client'
5
5
  require 'gli'
6
6
 
7
7
  require 'pagoda/cli/version'
8
- require 'pagoda/cli/override'
8
+ # require 'pagoda/cli/override'
9
9
 
10
10
  # command = ARGV.shift.strip rescue 'help'
11
- include GLI
11
+ include GLI::App
12
12
  config_file '.pagodarc'
13
13
 
14
14
  program_desc 'Command line client for Pagoda Box'
@@ -32,7 +32,7 @@ switch [:h, :help]
32
32
 
33
33
  require 'pagoda/cli'
34
34
 
35
- GLI::DefaultHelpCommand.skips_pre = true
35
+ # GLI::DefaultHelpCommand.skips_pre = true
36
36
 
37
37
  pre do |global,command,options,args|
38
38
  # Pre logic here
@@ -102,4 +102,4 @@ on_error do |exception|
102
102
  # false
103
103
  end
104
104
 
105
- exit GLI.run(ARGV)
105
+ exit run(ARGV)
@@ -0,0 +1,17 @@
1
+ desc 'Real time log to your pagodabox application'
2
+ arg_name 'Component name'
3
+ command :log do |c|
4
+
5
+ c.desc 'Component name you want to connect to'
6
+ c.arg_name 'COMPONENT_NAME'
7
+ c.flag [:c, :component]
8
+
9
+ c.desc 'App name'
10
+ c.arg_name 'APP_NAME'
11
+ c.flag [:a, :app]
12
+
13
+ c.action do |global_options,options,args|
14
+ require 'pagoda/cli/helpers/log'
15
+ Pagoda::Command::Log.new(global_options,options,args).run
16
+ end
17
+ end
@@ -1,11 +1,13 @@
1
+ # Dir["pagoda/cli/commands/*.rb"].each {|file| require file } <+ magic stopped working :(
1
2
  require 'pagoda/cli/commands/clone'
2
3
  require 'pagoda/cli/commands/create'
3
4
  require 'pagoda/cli/commands/deploy'
4
5
  require 'pagoda/cli/commands/destroy'
5
6
  require 'pagoda/cli/commands/info'
6
7
  require 'pagoda/cli/commands/init'
7
- require 'pagoda/cli/commands/ssh_key'
8
8
  require 'pagoda/cli/commands/list'
9
+ require 'pagoda/cli/commands/log'
9
10
  require 'pagoda/cli/commands/rename'
10
11
  require 'pagoda/cli/commands/rollback'
12
+ require 'pagoda/cli/commands/ssh_key'
11
13
  require 'pagoda/cli/commands/tunnel'
@@ -0,0 +1,110 @@
1
+ require 'socketIO'
2
+
3
+ module Pagoda::Command
4
+ class Log < Base
5
+
6
+ COLORS = [
7
+ 'light_red',
8
+ 'light_green',
9
+ 'light_yellow',
10
+ 'light_blue',
11
+ 'light_magenta',
12
+ 'light_cyan',
13
+ 'white',
14
+ 'red',
15
+ 'yellow',
16
+ 'blue',
17
+ 'magenta',
18
+ 'cyan',
19
+ 'green'
20
+ ]
21
+
22
+ def run
23
+ user_input = options[:component] || args.first
24
+
25
+ if user_input =~ /^(web\d*)|(db\d*)|(cache\d*)|(worker\d*)$/
26
+ comps = user_input
27
+ else
28
+ comps = nil
29
+ end
30
+
31
+
32
+ auth_hash = {user: user, pass: password, app: app}
33
+ auth_hash['comps'] = [comps] unless comps == nil
34
+ message_block = ->(hash) { colorize hash[0]['message'], hash[0]['name'] }
35
+ error_block = ->(hash) { error hash[0]['message'] }
36
+
37
+ @client = SocketIO.connect("http://logvac.pagodabox.com", sync: true) do
38
+
39
+ before_start do
40
+ on_event('auth_challenge') do
41
+ emit('authenticate', auth_hash)
42
+ end
43
+
44
+ on_event('authenticated') do
45
+ puts "Successfully Authenticated"
46
+ end
47
+
48
+ on_event('error', &error_block)
49
+
50
+ on_event('subscribed') do |hash|
51
+ if hash[0]['success']
52
+ puts "successfully subscribed to #{hash[0]['comp']}"
53
+ else
54
+ puts "failed to subscribe to #{hash[0]['comp']}"
55
+ end
56
+ end
57
+
58
+ on_event('unsubscribed') do |hash|
59
+ puts "#{hash[0]['success'] ? 'successfully unsubscribed from' : 'failed to unsubscribe from' } #{hash[0]['comp']}"
60
+ end
61
+
62
+ on_event('log', &message_block)
63
+
64
+ on_disconnect do
65
+ puts "Disconnected"
66
+ exit 0
67
+ end
68
+
69
+ end
70
+
71
+ end
72
+
73
+ [:INT, :TERM].each do |sig|
74
+ Signal.trap(sig) do
75
+ @client.disconnect
76
+ puts "Log Closed."
77
+ puts "-----------------------------------------------"
78
+ puts
79
+ exit
80
+ end
81
+ end
82
+
83
+ loop { sleep 1000 }
84
+
85
+ end
86
+
87
+ def colorize message, name
88
+ @hash ||= {}
89
+ if color = @hash[name]
90
+ puts message.send(color)
91
+ else
92
+ puts message.send(@hash[name] = next_color)
93
+ # retry
94
+ end
95
+ end
96
+
97
+ def next_color
98
+ COLORS[@hash.length % COLORS.length]
99
+ end
100
+
101
+ def output_error
102
+ errors = []
103
+ errors << "Input unrecoginized"
104
+ errors << "try 'pagoda -a <appname> log <component>'"
105
+ errors << "ie. 'pagoda -a app log db1'"
106
+ error errors
107
+ end
108
+
109
+ end
110
+ end
@@ -15,12 +15,10 @@ module Pagoda::Command
15
15
  component = client.component_info(app, user_input)
16
16
  end
17
17
  rescue
18
- errors = []
19
- errors << "Input unrecoginized"
20
- errors << "try 'pagoda -a <appname> tunnel <component>'"
21
- errors << "ie. 'pagoda -a app tunnel db1'"
22
- error errors
18
+ output_error
23
19
  end
20
+ output_error unless component
21
+ puts component
24
22
  if component[:tunnelable]
25
23
  type = component[:_type]
26
24
  component_id = component[:_id]
@@ -32,5 +30,13 @@ module Pagoda::Command
32
30
 
33
31
  end
34
32
 
33
+ def output_error
34
+ errors = []
35
+ errors << "Input unrecoginized"
36
+ errors << "try 'pagoda -a <appname> tunnel <component>'"
37
+ errors << "ie. 'pagoda -a app tunnel db1'"
38
+ error errors
39
+ end
40
+
35
41
  end
36
42
  end
@@ -7,17 +7,17 @@ unless Object.respond_to? :tap
7
7
  end
8
8
  end
9
9
 
10
- module GLI
11
- def command(*names, &block)
12
- command = Command.new([names].flatten,@@next_desc,@@next_arg_name,@@next_long_desc,@@skips_pre,@@skips_post)
13
- commands[command.name] = command
14
- command.instance_eval(&block)
15
- # yield command
16
- command.tap do |c|
17
- c.desc "Help"
18
- c.switch [:h, :help]
19
- end
20
- clear_nexts
21
- end
10
+ # module GLI
11
+ # def command(*names, &block)
12
+ # command = Command.new([names].flatten,@@next_desc,@@next_arg_name,@@next_long_desc,@@skips_pre,@@skips_post)
13
+ # commands[command.name] = command
14
+ # command.instance_eval(&block)
15
+ # # yield command
16
+ # command.tap do |c|
17
+ # c.desc "Help"
18
+ # c.switch [:h, :help]
19
+ # end
20
+ # clear_nexts
21
+ # end
22
22
 
23
- end
23
+ # end
@@ -1,5 +1,5 @@
1
1
  module Pagoda
2
2
  module CLI
3
- VERSION = "0.5.0"
3
+ VERSION = "0.6.0"
4
4
  end
5
5
  end
data/lib/pagoda-cli.rb CHANGED
@@ -1 +1,2 @@
1
+ puts 'pagoda-cli'
1
2
  require 'pagoda/cli'
Binary file
data/pagoda.gemspec CHANGED
@@ -18,8 +18,9 @@ Gem::Specification.new do |gem|
18
18
  gem.add_development_dependency "rspec"
19
19
  gem.add_development_dependency "pry"
20
20
 
21
+ gem.add_dependency 'socketio-client'
21
22
  gem.add_dependency "pagoda-client"
22
23
  gem.add_dependency "pagoda-tunnel"
23
24
  gem.add_dependency "rest-client"
24
- gem.add_dependency "gli"
25
+ gem.add_dependency "gli", '~> 2.0.0'
25
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pagoda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-01 00:00:00.000000000Z
12
+ date: 2012-08-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &2154455140 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2154455140
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: pry
27
- requirement: &2154454340 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,31 @@ dependencies:
32
37
  version: '0'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *2154454340
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: socketio-client
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
36
62
  - !ruby/object:Gem::Dependency
37
63
  name: pagoda-client
38
- requirement: &2154453660 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
39
65
  none: false
40
66
  requirements:
41
67
  - - ! '>='
@@ -43,10 +69,15 @@ dependencies:
43
69
  version: '0'
44
70
  type: :runtime
45
71
  prerelease: false
46
- version_requirements: *2154453660
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
47
78
  - !ruby/object:Gem::Dependency
48
79
  name: pagoda-tunnel
49
- requirement: &2154453240 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
50
81
  none: false
51
82
  requirements:
52
83
  - - ! '>='
@@ -54,10 +85,15 @@ dependencies:
54
85
  version: '0'
55
86
  type: :runtime
56
87
  prerelease: false
57
- version_requirements: *2154453240
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
58
94
  - !ruby/object:Gem::Dependency
59
95
  name: rest-client
60
- requirement: &2154452800 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
61
97
  none: false
62
98
  requirements:
63
99
  - - ! '>='
@@ -65,18 +101,28 @@ dependencies:
65
101
  version: '0'
66
102
  type: :runtime
67
103
  prerelease: false
68
- version_requirements: *2154452800
69
- - !ruby/object:Gem::Dependency
70
- name: gli
71
- requirement: &2154452320 !ruby/object:Gem::Requirement
104
+ version_requirements: !ruby/object:Gem::Requirement
72
105
  none: false
73
106
  requirements:
74
107
  - - ! '>='
75
108
  - !ruby/object:Gem::Version
76
109
  version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: gli
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: 2.0.0
77
118
  type: :runtime
78
119
  prerelease: false
79
- version_requirements: *2154452320
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: 2.0.0
80
126
  description: Pagoda Box User facing interface to improve workflow with Pagoda Box
81
127
  email:
82
128
  - lyon@pagodabox.com
@@ -102,6 +148,7 @@ files:
102
148
  - lib/pagoda/cli/commands/info.rb
103
149
  - lib/pagoda/cli/commands/init.rb
104
150
  - lib/pagoda/cli/commands/list.rb
151
+ - lib/pagoda/cli/commands/log.rb
105
152
  - lib/pagoda/cli/commands/rename.rb
106
153
  - lib/pagoda/cli/commands/rollback.rb
107
154
  - lib/pagoda/cli/commands/ssh_key.rb
@@ -111,22 +158,13 @@ files:
111
158
  - lib/pagoda/cli/helpers/app.rb
112
159
  - lib/pagoda/cli/helpers/base.rb
113
160
  - lib/pagoda/cli/helpers/key.rb
161
+ - lib/pagoda/cli/helpers/log.rb
114
162
  - lib/pagoda/cli/helpers/tunnel.rb
115
163
  - lib/pagoda/cli/override.rb
116
164
  - lib/pagoda/cli/version.rb
165
+ - newpagoda-0.5.0.gem
117
166
  - pagoda.gemspec
118
167
  - pagoda.rdoc
119
- - pkg/newpagoda-0.1.10.gem
120
- - pkg/newpagoda-0.1.11.gem
121
- - pkg/newpagoda-0.1.12.gem
122
- - pkg/newpagoda-0.1.13.gem
123
- - pkg/newpagoda-0.1.15.gem
124
- - pkg/newpagoda-0.1.4.gem
125
- - pkg/newpagoda-0.1.6.gem
126
- - pkg/newpagoda-0.1.7.gem
127
- - pkg/newpagoda-0.1.8.gem
128
- - pkg/newpagoda-0.1.9.gem
129
- - pkg/newpagoda-0.5.0.gem
130
168
  - spec/lib/helper_spec.rb
131
169
  - spec/lib/helpers/app_spec.rb
132
170
  - spec/lib/helpers/base_spec.rb
@@ -153,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
191
  version: '0'
154
192
  requirements: []
155
193
  rubyforge_project:
156
- rubygems_version: 1.8.10
194
+ rubygems_version: 1.8.24
157
195
  signing_key:
158
196
  specification_version: 3
159
197
  summary: Pagoda Box CLI
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file