winnie 0.0.7 → 0.0.8

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/CHANGELOG.rdoc ADDED
@@ -0,0 +1,10 @@
1
+ === master
2
+
3
+ Features:
4
+ * Added CHANGELOG file
5
+ * Added basic docs to Readme
6
+
7
+ === 0.0.7 (March 28, 2011)
8
+
9
+ Features:
10
+ * Added --api-key option
data/README.rdoc CHANGED
@@ -1,6 +1,54 @@
1
1
  = winnie
2
2
 
3
- Winnie command line client.
3
+ Winnie gem is a command-line tool for interacting with your applications hosted on Winnie Cloud. Gem allows running Ruby commands against your applications.
4
+
5
+ == Installation & Configuration
6
+
7
+ Winnie gem is available at rubygems.org. In order to install it, issue the following command:
8
+
9
+ gem install winnie
10
+
11
+ Type below command and enter API key. Your API key can be found at your account page.
12
+
13
+ winnie auth
14
+
15
+ Your API key will be validated
16
+
17
+ Type your Winnie API key
18
+ Key: secretapikey
19
+ Your winnie API key is OK!
20
+
21
+ == Usage
22
+
23
+ Type winnie help command for usage info.
24
+
25
+ Available commands:
26
+
27
+ auth Configure your winnie api key
28
+ command <command or file> Run ruby command, a file with commands can be given
29
+ list List your applications
30
+ help Show this information
31
+
32
+ Available options:
33
+
34
+ -a, --app APP Specify app code name
35
+ -k, --api-key API-KEY Specify API key
36
+
37
+ === Command
38
+
39
+ Command allows you to run ruby commands against your application via script/runner (or 'rails runner' in Rails 3). There are two ways to run commands.
40
+
41
+ 1. Pass a command as command line parameter:
42
+
43
+ winnie command --app code-name Foo.delete_all
44
+
45
+ 2. Specify a ruby file with commands, it's good for more complicated commands or a set of commands:
46
+
47
+ # foo.rb
48
+ puts Foo.outdated.count
49
+ Foo.outdated.each { |f| f.refresh }
50
+
51
+ winnie command --app code-name foo.rb
4
52
 
5
53
  = Meta
6
54
 
data/lib/winnie/client.rb CHANGED
@@ -54,11 +54,11 @@ module Winnie
54
54
 
55
55
  def process_response(response)
56
56
  # TODO: this fragment could look better
57
- if [404, 500, 401].include?(response.code)
57
+ if [404, 500, 302].include?(response.code)
58
58
  exception = case response.code
59
59
  when 404; ResourceNotFoundException
60
60
  when 500; CommandFailedException
61
- when 401; raise UnauthorizedException.new
61
+ when 302; raise UnauthorizedException.new
62
62
  end
63
63
 
64
64
  error = JSON.parse(response.body)['error']
@@ -14,11 +14,11 @@ module Winnie
14
14
  return if args.empty?
15
15
 
16
16
  OptionParser.new do |opts|
17
- opts.on("-a", "--app [CODE_NAME]", :text, "Run for given application") do |a|
17
+ opts.on("-a", "--app [CODE-NAME]", :text, "Run for given application") do |a|
18
18
  @code_name = a
19
19
  end
20
20
 
21
- opts.on("-k", "--api-key [API KEY]", :text, "Authorize command for given api key") do |k|
21
+ opts.on("-k", "--api-key [API-KEY]", :text, "Authorize command for given api key") do |k|
22
22
  @api_key = k
23
23
  end
24
24
  end.parse!(@args)
@@ -2,10 +2,17 @@ module Winnie
2
2
  module Commands
3
3
  class Help < Base
4
4
  def run
5
+ display 'Available commands:'
6
+ display ''
5
7
  display_columns 'auth', 'Configure your winnie api key'
6
8
  display_columns 'command <command or file>', 'Run ruby command, a file with commands can be given'
7
9
  display_columns 'list', 'List your applications'
8
10
  display_columns 'help', 'Show this information'
11
+ display ''
12
+ display_columns 'Available options:'
13
+ display ''
14
+ display_columns '-a, --app APP', 'Specify app code name'
15
+ display_columns '-k, --api-key API-KEY', 'Specify API key'
9
16
  end
10
17
  end
11
18
  end
@@ -1,3 +1,3 @@
1
1
  module Winnie
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
data/spec/client_spec.rb CHANGED
@@ -60,9 +60,9 @@ describe Winnie::Client do
60
60
  @client.get('/api/account')
61
61
  end
62
62
 
63
- context "on 401 response code" do
63
+ context "on 302 response code" do
64
64
  it "should raise UnauthorizedException" do
65
- @response.stub(:code).and_return(401)
65
+ @response.stub(:code).and_return(302)
66
66
  lambda {
67
67
  @client.get('/api/account')
68
68
  }.should raise_error(Winnie::Client::UnauthorizedException)
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: winnie
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 7
10
- version: 0.0.7
5
+ version: 0.0.8
11
6
  platform: ruby
12
7
  authors:
13
8
  - winnie
@@ -15,8 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-03-28 00:00:00 +02:00
19
- default_executable:
13
+ date: 2011-04-29 00:00:00 Z
20
14
  dependencies:
21
15
  - !ruby/object:Gem::Dependency
22
16
  name: json
@@ -26,9 +20,6 @@ dependencies:
26
20
  requirements:
27
21
  - - ">="
28
22
  - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
23
  version: "0"
33
24
  type: :runtime
34
25
  version_requirements: *id001
@@ -40,9 +31,6 @@ dependencies:
40
31
  requirements:
41
32
  - - ">="
42
33
  - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
34
  version: "0"
47
35
  type: :runtime
48
36
  version_requirements: *id002
@@ -54,11 +42,6 @@ dependencies:
54
42
  requirements:
55
43
  - - ~>
56
44
  - !ruby/object:Gem::Version
57
- hash: 7
58
- segments:
59
- - 2
60
- - 2
61
- - 0
62
45
  version: 2.2.0
63
46
  type: :development
64
47
  version_requirements: *id003
@@ -70,9 +53,6 @@ dependencies:
70
53
  requirements:
71
54
  - - ">="
72
55
  - !ruby/object:Gem::Version
73
- hash: 3
74
- segments:
75
- - 0
76
56
  version: "0"
77
57
  type: :development
78
58
  version_requirements: *id004
@@ -84,9 +64,6 @@ dependencies:
84
64
  requirements:
85
65
  - - ">="
86
66
  - !ruby/object:Gem::Version
87
- hash: 3
88
- segments:
89
- - 0
90
67
  version: "0"
91
68
  type: :development
92
69
  version_requirements: *id005
@@ -101,6 +78,7 @@ extra_rdoc_files: []
101
78
 
102
79
  files:
103
80
  - .gitignore
81
+ - CHANGELOG.rdoc
104
82
  - Gemfile
105
83
  - LICENSE
106
84
  - README.rdoc
@@ -123,7 +101,6 @@ files:
123
101
  - spec/spec_helper.rb
124
102
  - spec/winnie_spec.rb
125
103
  - winnie.gemspec
126
- has_rdoc: true
127
104
  homepage: http://winniecloud.com
128
105
  licenses: []
129
106
 
@@ -137,25 +114,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
137
114
  requirements:
138
115
  - - ">="
139
116
  - !ruby/object:Gem::Version
140
- hash: 3
141
- segments:
142
- - 0
143
117
  version: "0"
144
118
  required_rubygems_version: !ruby/object:Gem::Requirement
145
119
  none: false
146
120
  requirements:
147
121
  - - ">="
148
122
  - !ruby/object:Gem::Version
149
- hash: 3
150
- segments:
151
- - 0
152
123
  version: "0"
153
124
  requirements: []
154
125
 
155
126
  rubyforge_project: winnie
156
- rubygems_version: 1.6.2
127
+ rubygems_version: 1.7.2
157
128
  signing_key:
158
129
  specification_version: 3
159
130
  summary: Winnie command line tool
160
131
  test_files: []
161
132
 
133
+ has_rdoc: