wl 0.0.1 → 0.0.2
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/.rvmrc +1 -0
- data/README.md +2 -0
- data/lib/wl/cli.rb +9 -3
- data/lib/wl/version.rb +1 -1
- data/spec/helpers/capture_output.rb +14 -0
- data/spec/helpers/vcr.rb +7 -0
- data/spec/spec_helper.rb +4 -5
- data/spec/wl/cli_spec.rb +21 -13
- data/wl.gemspec +1 -0
- metadata +24 -3
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use 1.9.3@wl --create
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# wl
|
2
2
|
|
3
|
+
[](http://travis-ci.org/hiremaga/wl) [](https://codeclimate.com/github/hiremaga/wl)
|
4
|
+
|
3
5
|
`wl` is an unofficial Ruby client and command line interface for the truly awesome [Wunderlist](http://www.6wunderkinder.com/wunderlist)
|
4
6
|
|
5
7
|
## Installation
|
data/lib/wl/cli.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'thor'
|
2
|
+
require 'highline'
|
2
3
|
|
3
4
|
module Wl
|
4
5
|
class CLI < Thor
|
@@ -6,13 +7,18 @@ module Wl
|
|
6
7
|
option :email, desc: 'Wunderlist email'
|
7
8
|
option :password, desc: 'Wunderlist password'
|
8
9
|
def login
|
9
|
-
email = options[:email] || ask('Wunderlist email:')
|
10
|
-
password = options[:password] || ask('Wunderlist password:')
|
10
|
+
email = options[:email] || ui.ask('Wunderlist email: ')
|
11
|
+
password = options[:password] || ui.ask('Wunderlist password: ') { |q| q.echo = '*' }
|
11
12
|
|
12
13
|
client = Wl::Client.new
|
13
14
|
login = client.login(email, password)
|
14
15
|
|
15
|
-
say login.to_json
|
16
|
+
ui.say login.to_json
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
def ui
|
21
|
+
@ui ||= HighLine.new
|
16
22
|
end
|
17
23
|
end
|
18
24
|
end
|
data/lib/wl/version.rb
CHANGED
data/spec/helpers/vcr.rb
ADDED
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
2
|
require 'wl'
|
3
|
-
require 'vcr'
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
c.
|
4
|
+
Dir['spec/helpers/**/*.rb'].each { |helper| require File.expand_path(helper) }
|
5
|
+
|
6
|
+
RSpec.configure do |c|
|
7
|
+
c.include CaptureOutput
|
9
8
|
end
|
data/spec/wl/cli_spec.rb
CHANGED
@@ -2,11 +2,15 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module Wl
|
4
4
|
describe CLI do
|
5
|
+
subject do
|
6
|
+
Wl::CLI.start(args)
|
7
|
+
end
|
8
|
+
|
5
9
|
context "by default" do
|
6
10
|
let(:args) { [] }
|
7
11
|
|
8
12
|
it 'prints helpful information by default' do
|
9
|
-
output = capture(:stdout) {
|
13
|
+
output = capture(:stdout) { subject }
|
10
14
|
output.should include("help [TASK]")
|
11
15
|
end
|
12
16
|
end
|
@@ -15,22 +19,26 @@ module Wl
|
|
15
19
|
let(:args) { %w"login --email fake@example.com --password fakepass" }
|
16
20
|
|
17
21
|
it 'retrieves a token on behalf of the user' do
|
18
|
-
output = capture(:stdout) {
|
22
|
+
output = capture(:stdout) { subject }
|
19
23
|
output.should include('"name":"fake@example.com"')
|
20
24
|
end
|
21
|
-
end
|
22
25
|
|
23
|
-
|
24
|
-
|
25
|
-
stream = stream.to_s
|
26
|
-
eval "$#{stream} = StringIO.new"
|
27
|
-
yield
|
28
|
-
result = eval("$#{stream}").string
|
29
|
-
ensure
|
30
|
-
eval("$#{stream} = #{stream.upcase}")
|
31
|
-
end
|
26
|
+
context 'when an email and password are not provided' do
|
27
|
+
let(:args) { %w"login" }
|
32
28
|
|
33
|
-
|
29
|
+
it 'asks the user for each' do
|
30
|
+
ui = mock(HighLine).as_null_object
|
31
|
+
HighLine.stub(new: ui)
|
32
|
+
ui.should_receive(:ask).with('Wunderlist email: ').and_return('foo@example.com')
|
33
|
+
ui.should_receive(:ask).with('Wunderlist password: ').and_return('foopass')
|
34
|
+
|
35
|
+
client = mock(Wl::Client)
|
36
|
+
Wl::Client.stub(new: client)
|
37
|
+
client.should_receive(:login).with('foo@example.com', 'foopass')
|
38
|
+
|
39
|
+
subject
|
40
|
+
end
|
41
|
+
end
|
34
42
|
end
|
35
43
|
end
|
36
44
|
end
|
data/wl.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: highline
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
30
46
|
- !ruby/object:Gem::Dependency
|
31
47
|
name: api_smith
|
32
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,6 +150,7 @@ extra_rdoc_files: []
|
|
134
150
|
files:
|
135
151
|
- .gitignore
|
136
152
|
- .rspec
|
153
|
+
- .rvmrc
|
137
154
|
- .travis.yml
|
138
155
|
- Gemfile
|
139
156
|
- LICENSE.txt
|
@@ -146,6 +163,8 @@ files:
|
|
146
163
|
- lib/wl/login.rb
|
147
164
|
- lib/wl/version.rb
|
148
165
|
- spec/cassettes/login.yml
|
166
|
+
- spec/helpers/capture_output.rb
|
167
|
+
- spec/helpers/vcr.rb
|
149
168
|
- spec/spec_helper.rb
|
150
169
|
- spec/wl/cli_spec.rb
|
151
170
|
- spec/wl/client_spec.rb
|
@@ -166,7 +185,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
166
185
|
version: '0'
|
167
186
|
segments:
|
168
187
|
- 0
|
169
|
-
hash:
|
188
|
+
hash: 777019882129541853
|
170
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
190
|
none: false
|
172
191
|
requirements:
|
@@ -175,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
194
|
version: '0'
|
176
195
|
segments:
|
177
196
|
- 0
|
178
|
-
hash:
|
197
|
+
hash: 777019882129541853
|
179
198
|
requirements: []
|
180
199
|
rubyforge_project:
|
181
200
|
rubygems_version: 1.8.25
|
@@ -185,6 +204,8 @@ summary: ! '`wl` is an unofficial Ruby client and command line interface for the
|
|
185
204
|
awesome Wunderlist'
|
186
205
|
test_files:
|
187
206
|
- spec/cassettes/login.yml
|
207
|
+
- spec/helpers/capture_output.rb
|
208
|
+
- spec/helpers/vcr.rb
|
188
209
|
- spec/spec_helper.rb
|
189
210
|
- spec/wl/cli_spec.rb
|
190
211
|
- spec/wl/client_spec.rb
|