wo 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/wo/client.rb +2 -0
- data/lib/wo/configure.rb +6 -4
- data/lib/wo/hook.rb +1 -1
- data/lib/wo/version.rb +1 -1
- data/spec/wo/client_spec.rb +48 -0
- data/spec/wo/configure_spec.rb +27 -0
- data/spec/wo/hook/zsh_spec.rb +38 -0
- data/spec/wo/hook_spec.rb +13 -0
- data/spec/wo/loader_spec.rb +23 -0
- data/spec/wo/response/format/timeline_spec.rb +21 -0
- data/spec/wo/response_spec.rb +13 -0
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b326d8f66bd632e93e302c4fefde6a01b4bd14d
|
4
|
+
data.tar.gz: 0813e65ec3072f0db08fab711cda12f2e96ab645
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d88122203da9ec79b815e1c029a7cd5900943c1ad53887bb8454db35dfbadd87d904a2e8ec394e7d3c38facb987b6d76ae99081bd5097e77bff014ec89d016d
|
7
|
+
data.tar.gz: 80b60796291f2046e48716cbd53274904ce05f48bc1dcf1b98f881f8dededd95c8d7667bbad363b6477f9ec354cb024de8bcfa8d1582101d58444cd447dc29d8
|
data/README.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# wo
|
2
2
|
|
3
|
+
[](https://travis-ci.org/wo-app/wo)
|
4
|
+
[](https://codeclimate.com/github/wo-app/wo)
|
5
|
+
[](https://codeclimate.com/github/wo-app/wo)
|
6
|
+
|
3
7
|
CLI and Ruby client for [wo server](https://github.com/wo-app/wo-server)
|
4
8
|
|
5
9
|
Instration
|
data/lib/wo/client.rb
CHANGED
data/lib/wo/configure.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module WO
|
2
2
|
class Configure
|
3
|
+
attr_reader :token, :repo, :branch, :user_name
|
4
|
+
|
3
5
|
def initialize(options = {})
|
4
6
|
[:token, :repo, :branch, :user_name].each do |key|
|
5
7
|
next unless value = options[key]
|
@@ -9,10 +11,10 @@ module WO
|
|
9
11
|
|
10
12
|
def to_h
|
11
13
|
{
|
12
|
-
"organization[token]"
|
13
|
-
"doing[repo]"
|
14
|
-
"doing[branch]"
|
15
|
-
"user[name]"
|
14
|
+
"organization[token]" => @token,
|
15
|
+
"doing[repo]" => @repo,
|
16
|
+
"doing[branch]" => @branch,
|
17
|
+
"user[name]" => @user_name,
|
16
18
|
}
|
17
19
|
end
|
18
20
|
end
|
data/lib/wo/hook.rb
CHANGED
data/lib/wo/version.rb
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe WO::Client do
|
4
|
+
let(:client) { described_class.new }
|
5
|
+
|
6
|
+
describe "#initialize" do
|
7
|
+
it "assigns default API url" do
|
8
|
+
expect(client.api_url).to eq WO::Client::API_URL
|
9
|
+
end
|
10
|
+
|
11
|
+
it "assigns API url" do
|
12
|
+
client = described_class.new(url: "http://test.com")
|
13
|
+
|
14
|
+
expect(client.api_url).to eq "http://test.com"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#doings" do
|
19
|
+
it "returns WO::Response instance" do
|
20
|
+
options = {}
|
21
|
+
|
22
|
+
allow_any_instance_of(WO::Configure).to receive(:to_h) { {} }
|
23
|
+
allow(Faraday).to receive(:get) { double(Faraday::Response) }
|
24
|
+
|
25
|
+
expect(client.doings(options)).to be_a WO::Response
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "#create_doing" do
|
30
|
+
it "returns WO::Response instance" do
|
31
|
+
options = {}
|
32
|
+
|
33
|
+
allow_any_instance_of(WO::Configure).to receive(:to_h) { {} }
|
34
|
+
allow(Faraday).to receive(:post) { double(Faraday::Response) }
|
35
|
+
|
36
|
+
expect(client.create_doing(options)).to be_a WO::Response
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "#create_organization" do
|
41
|
+
it "returns WO::Response instance" do
|
42
|
+
allow_any_instance_of(WO::Configure).to receive(:to_h) { {} }
|
43
|
+
allow(Faraday).to receive(:post) { double(Faraday::Response) }
|
44
|
+
|
45
|
+
expect(client.create_organization).to be_a WO::Response
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe WO::Configure do
|
4
|
+
let(:configure) { described_class.new(token: "token", repo: "repo", branch: "branch", user_name: "user_name") }
|
5
|
+
|
6
|
+
describe "#initialize" do
|
7
|
+
it "assigns instance variables" do
|
8
|
+
expect(configure.token).to eq "token"
|
9
|
+
expect(configure.repo).to eq "repo"
|
10
|
+
expect(configure.branch).to eq "branch"
|
11
|
+
expect(configure.user_name).to eq "user_name"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "#to_h" do
|
16
|
+
it "returns WO::Response instance" do
|
17
|
+
configure_hash = {
|
18
|
+
"organization[token]" => "token",
|
19
|
+
"doing[repo]" => "repo",
|
20
|
+
"doing[branch]" => "branch",
|
21
|
+
"user[name]" => "user_name",
|
22
|
+
}
|
23
|
+
|
24
|
+
expect(configure.to_h).to eq configure_hash
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe WO::Hook::Zsh do
|
4
|
+
let(:zsh) { described_class.new }
|
5
|
+
|
6
|
+
describe "#hook" do
|
7
|
+
it "returns hook for zsh" do
|
8
|
+
hook = %(
|
9
|
+
_wo_hook() {
|
10
|
+
repo_path=`git rev-parse --show-toplevel 2>&1`
|
11
|
+
|
12
|
+
if [[ "$?" == 0 ]] ; then
|
13
|
+
token=`cat ${repo_path}/.wo 2>&1`
|
14
|
+
|
15
|
+
if [[ "$?" == 0 ]] ; then
|
16
|
+
repo=`basename ${repo_path}`
|
17
|
+
branch=`git rev-parse --abbrev-ref HEAD`
|
18
|
+
user_name=`git config user.name`
|
19
|
+
|
20
|
+
wo doing ${repo} ${branch} ${user_name}
|
21
|
+
fi
|
22
|
+
fi
|
23
|
+
}
|
24
|
+
|
25
|
+
_wo_hook_background() {
|
26
|
+
(_wo_hook &)
|
27
|
+
}
|
28
|
+
|
29
|
+
typeset -ag precmd_functions
|
30
|
+
if [[ -z $precmd_functions[(r)_wo_hook_background] ]]; then
|
31
|
+
precmd_functions+=_wo_hook_background;
|
32
|
+
fi
|
33
|
+
)
|
34
|
+
|
35
|
+
expect(zsh.hook).to eq hook
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe WO::Loader do
|
4
|
+
let(:loader) { described_class.new }
|
5
|
+
|
6
|
+
describe "#config" do
|
7
|
+
it "returns config hash" do
|
8
|
+
config_hash = { "url" => "https://wo-app.herokuapp.com",
|
9
|
+
"token" => "dfddda19-e44d-4f9f-8e51-8eeb9df9fa1e" }
|
10
|
+
|
11
|
+
expect(loader.config).to eq (config_hash)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "#to_h" do
|
16
|
+
it "returns config hash" do
|
17
|
+
config_hash = { url: "https://wo-app.herokuapp.com",
|
18
|
+
token: "dfddda19-e44d-4f9f-8e51-8eeb9df9fa1e" }
|
19
|
+
|
20
|
+
expect(loader.to_h).to eq config_hash
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe WO::Response::Format::Timeline do
|
4
|
+
class Timeline
|
5
|
+
include WO::Response::Format::Timeline
|
6
|
+
end
|
7
|
+
|
8
|
+
let(:timeline) { Timeline.new }
|
9
|
+
|
10
|
+
describe "#to_timeline" do
|
11
|
+
it "returns timeline" do
|
12
|
+
doings = { "users" => [ { "name" => "name",
|
13
|
+
"recent_repo" => "recent_repo",
|
14
|
+
"recent_branch" => "recent_branch",
|
15
|
+
"time_ago" => "time_ago" } ] }
|
16
|
+
allow(timeline).to receive(:to_json) { doings }
|
17
|
+
|
18
|
+
expect(timeline.to_timeline).to eq ["\e[1m\e[32mname: \e[37mrecent_repo/recent_branch \e[30mtime_ago\e[0m"]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe WO::Response do
|
4
|
+
|
5
|
+
describe "#to_json" do
|
6
|
+
it "returns response json" do
|
7
|
+
faraday_response = double(Faraday::Response, body: '{"repo":"test"}')
|
8
|
+
response = described_class.new(faraday_response)
|
9
|
+
|
10
|
+
expect(response.to_json).to eq ({ "repo" => "test" })
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masahiro Saito
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -63,6 +63,13 @@ files:
|
|
63
63
|
- lib/wo/response/format/timeline.rb
|
64
64
|
- lib/wo/version.rb
|
65
65
|
- spec/spec_helper.rb
|
66
|
+
- spec/wo/client_spec.rb
|
67
|
+
- spec/wo/configure_spec.rb
|
68
|
+
- spec/wo/hook/zsh_spec.rb
|
69
|
+
- spec/wo/hook_spec.rb
|
70
|
+
- spec/wo/loader_spec.rb
|
71
|
+
- spec/wo/response/format/timeline_spec.rb
|
72
|
+
- spec/wo/response_spec.rb
|
66
73
|
- wo.gemspec
|
67
74
|
homepage: https://github.com/wo-app/wo
|
68
75
|
licenses:
|