bushido 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/bin/bushido CHANGED
@@ -3,10 +3,11 @@ require 'bushido'
3
3
 
4
4
  options = {}
5
5
 
6
- commands = [:reauth, :remove_account, :claim, :list, :create, :show, :start, :stop, :restart, :update, :open]
6
+ commands = [:login, :remove_account, :claim, :list, :create, :show, :start, :stop, :restart, :update, :open, :logs, :add_var, :remove_var, :api_key].sort
7
7
 
8
8
  help_docs = {
9
- :reauth => "bushido reauth - Reauthorize this machine to work under your Bushido account",
9
+ :login => "bushido login - Authorizes this machine to work under your Bushido account",
10
+ :api_key => "bushido api_key - Prints out your Bushido API key for use elsewhere (in the bushido development webapp, for example)",
10
11
  :remove_account => "bushido remove_account - Removes all Bushido information from this machine",
11
12
  :claim => "bushido claim [NAME] - Claim a running Bushido app as your own",
12
13
  :list => "bushido list - List all of your deployed Bushido apps",
@@ -17,7 +18,10 @@ help_docs = {
17
18
  :restart => "bushido restart [NAME] - Performace a stop and start in succession" ,
18
19
  :update => "bushido update [NAME] - Will stop the running bushido app, pull from the url originally supplied to the app, update in place, and start back up",
19
20
  :open => "bushido open [NAME] - Open browser window to the running Bushido app",
20
- :create => "bushido create [NAME] - creates a new app"
21
+ :create => "bushido create [NAME] - Creates a new app",
22
+ :logs => "bushido logs [NAME] - Retrieves all of the logs for an app and returns them in a JSON structure",
23
+ :add_var => "bushido add_var [NAME] [KEY] [VALUE] - Adds an environmental variable for an app to use",
24
+ :remove_var => "bushido remove_var [NAME] [KEY] - Removes an existing environmental variable from an app"
21
25
  }
22
26
 
23
27
  OptionParser.new do |opts|
@@ -49,7 +53,9 @@ command = ARGV.first
49
53
  if command
50
54
  case command.downcase.to_sym
51
55
  when :login then Bushido::User.reauth
56
+ when :api_key then Bushido::User.show_api_key
52
57
  when :remove_account then Bushido::User.clear_config
58
+
53
59
  when :claim then Bushido::App.claim(ARGV[1])
54
60
  when :list then Bushido::App.list()
55
61
  when :create then Bushido::App.create(ARGV[1])
@@ -59,6 +65,16 @@ if command
59
65
  when :restart then Bushido::App.restart(ARGV[1])
60
66
  when :update then Bushido::App.update(ARGV[1])
61
67
  when :open then Bushido::App.open(ARGV[1])
68
+
69
+ when :add_domain then Bushido::App.add_domain(ARGV[1], ARGV[2])
70
+ when :remove_domain then Bushido::App.remove_domain(ARGV[1])
71
+ when :add_var then Bushido::App.add_var(ARGV[1], ARGV[2], ARGV[3])
72
+ when :remove_var then Bushido::App.remove_var(ARGV[1], ARGV[2])
73
+ when :clear_logs then Bushido::App.clear_logs(ARGV[1])
74
+ when :logs then Bushido::App.logs(ARGV[1])
75
+ else
76
+ puts "I don't know how to '#{command}'"
77
+ puts "I do know how to do these though: #{commands.join(', ')}"
62
78
  end
63
79
  else
64
80
  puts "usage: bushido <command>\n\nSee bushido -h for more detailed instructions"
data/bushido.gemspec CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Sean Grove"]
10
10
  s.email = ["s@bushi.do"]
11
- s.homepage = "http://trapm.com"
11
+ s.homepage = "http://gem.bushi.do"
12
12
  s.summary = %q{Command-lin interface for bushi.do}
13
13
  s.description = %q{A command line tool to do everything with bushido, from signing up and deploying new apps, to claiming, restarting, and updating existing apps}
14
14
 
data/lib/bushido/app.rb CHANGED
@@ -28,9 +28,9 @@ module Bushido
28
28
  Bushido::Command.get_command(url, params)
29
29
  end
30
30
 
31
- def put(app, command)
31
+ def put(app, command, params={})
32
32
  url = "#{Temple}/apps/#{app}.json"
33
- params = {:command => command}
33
+ params[:command] = command
34
34
 
35
35
  Bushido::Command.show_response Bushido::Command.put_command(url, params)
36
36
  end
@@ -64,6 +64,30 @@ module Bushido
64
64
  def update(name)
65
65
  put name, :update
66
66
  end
67
+
68
+ def add_var(name, key, value)
69
+ puts put(name, :add_var, {:key => key, :value => value})
70
+ end
71
+
72
+ def remove_var(name, key)
73
+ puts put(name, :remove_var, {:key => key})
74
+ end
75
+
76
+ def add_domain(name, domain)
77
+ puts put(name, :add_domain, {:domain => domain})
78
+ end
79
+
80
+ def remove_domain(name)
81
+ puts put(name, :remove_domain)
82
+ end
83
+
84
+ def clear_logs(name)
85
+ puts put(name, :clear_logs)
86
+ end
87
+
88
+ def logs(name)
89
+ puts get(name, {:gift => "logs"})
90
+ end
67
91
  end
68
92
  end
69
93
  end
data/lib/bushido/user.rb CHANGED
@@ -75,6 +75,10 @@ module Bushido
75
75
  end
76
76
  end
77
77
 
78
+ def show_api_key
79
+ puts "#{account['authentication_token']}"
80
+ end
81
+
78
82
  def authentication_token
79
83
  account["authentication_token"]
80
84
  end
@@ -1,3 +1,3 @@
1
1
  module Bushido
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bushido
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 7
9
- version: 0.0.7
4
+ prerelease:
5
+ version: 0.0.8
10
6
  platform: ruby
11
7
  authors:
12
8
  - Sean Grove
@@ -14,7 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-01-29 00:00:00 -08:00
13
+ date: 2011-02-13 00:00:00 -08:00
18
14
  default_executable:
19
15
  dependencies:
20
16
  - !ruby/object:Gem::Dependency
@@ -25,10 +21,6 @@ dependencies:
25
21
  requirements:
26
22
  - - ">="
27
23
  - !ruby/object:Gem::Version
28
- segments:
29
- - 1
30
- - 6
31
- - 1
32
24
  version: 1.6.1
33
25
  type: :runtime
34
26
  version_requirements: *id001
@@ -40,10 +32,6 @@ dependencies:
40
32
  requirements:
41
33
  - - ">="
42
34
  - !ruby/object:Gem::Version
43
- segments:
44
- - 1
45
- - 4
46
- - 6
47
35
  version: 1.4.6
48
36
  type: :runtime
49
37
  version_requirements: *id002
@@ -55,10 +43,6 @@ dependencies:
55
43
  requirements:
56
44
  - - ">="
57
45
  - !ruby/object:Gem::Version
58
- segments:
59
- - 1
60
- - 6
61
- - 1
62
46
  version: 1.6.1
63
47
  type: :runtime
64
48
  version_requirements: *id003
@@ -83,7 +67,7 @@ files:
83
67
  - lib/bushido/utils.rb
84
68
  - lib/bushido/version.rb
85
69
  has_rdoc: true
86
- homepage: http://trapm.com
70
+ homepage: http://gem.bushi.do
87
71
  licenses: []
88
72
 
89
73
  post_install_message:
@@ -96,21 +80,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
96
80
  requirements:
97
81
  - - ">="
98
82
  - !ruby/object:Gem::Version
99
- segments:
100
- - 0
101
83
  version: "0"
102
84
  required_rubygems_version: !ruby/object:Gem::Requirement
103
85
  none: false
104
86
  requirements:
105
87
  - - ">="
106
88
  - !ruby/object:Gem::Version
107
- segments:
108
- - 0
109
89
  version: "0"
110
90
  requirements: []
111
91
 
112
92
  rubyforge_project: bushido
113
- rubygems_version: 1.3.7
93
+ rubygems_version: 1.5.0
114
94
  signing_key:
115
95
  specification_version: 3
116
96
  summary: Command-lin interface for bushi.do