bickle 0.0.1
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 +17 -0
- data/.rspec +2 -0
- data/.travis.yml +10 -0
- data/Gemfile +4 -0
- data/Guardfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +26 -0
- data/Rakefile +7 -0
- data/bickle.gemspec +30 -0
- data/bin/bickle +6 -0
- data/lib/bickle.rb +22 -0
- data/lib/bickle/build.rb +67 -0
- data/lib/bickle/build_repository.rb +21 -0
- data/lib/bickle/builds.rb +24 -0
- data/lib/bickle/color_decorator.rb +21 -0
- data/lib/bickle/errors.rb +6 -0
- data/lib/bickle/http_client.rb +9 -0
- data/lib/bickle/humanize_decorator.rb +18 -0
- data/lib/bickle/length_decorator.rb +37 -0
- data/lib/bickle/repository.rb +25 -0
- data/lib/bickle/response_parser.rb +12 -0
- data/lib/bickle/runner.rb +67 -0
- data/lib/bickle/thor_builds_table.rb +19 -0
- data/lib/bickle/version.rb +3 -0
- data/spec/bickle_spec.rb +14 -0
- data/spec/build_repository_spec.rb +21 -0
- data/spec/build_spec.rb +23 -0
- data/spec/color_decorator_spec.rb +14 -0
- data/spec/http_client_spec.rb +13 -0
- data/spec/humanize_decorator_spec.rb +11 -0
- data/spec/length_decorator_spec.rb +25 -0
- data/spec/repository_spec.rb +35 -0
- data/spec/response_parser_spec.rb +16 -0
- data/spec/spec_helper.rb +26 -0
- metadata +234 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Jiri Pospisil
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# Bickle
|
2
|
+
|
3
|
+
Bickle is a tool to display build status from terminal.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ gem install bickle
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
### Display last builds of a repository
|
12
|
+
|
13
|
+
$ bickle builds rails/rails
|
14
|
+
|
15
|
+
See `bickle help builds` for all available options.
|
16
|
+
|
17
|
+
## TODO
|
18
|
+
- `bickle build 123` - Display details about particular build
|
19
|
+
|
20
|
+
## Contributing
|
21
|
+
|
22
|
+
1. Fork it
|
23
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
24
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
25
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
26
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/bickle.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'bickle/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "bickle"
|
8
|
+
gem.version = Bickle::VERSION
|
9
|
+
gem.authors = ["Jiri Pospisil"]
|
10
|
+
gem.email = ["mekishizufu@gmail.com"]
|
11
|
+
gem.description = %q{Bickle is a tool to display your build status from your terminal.}
|
12
|
+
gem.summary = %q{Bickle is a tool to display your build status from your terminal.}
|
13
|
+
gem.homepage = ""
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_dependency "rest-client", "~> 1.6.7"
|
21
|
+
gem.add_dependency "json", "~> 1.7.5"
|
22
|
+
|
23
|
+
gem.add_development_dependency "rake", "~> 0.9.2"
|
24
|
+
gem.add_development_dependency "guard", "~> 1.5.4"
|
25
|
+
gem.add_development_dependency "rb-inotify", "~> 0.8.8"
|
26
|
+
gem.add_development_dependency "guard-rspec", "~> 2.1.2"
|
27
|
+
gem.add_development_dependency "rspec", "~> 2.11.0"
|
28
|
+
gem.add_development_dependency "pry", "~> 0.9.10"
|
29
|
+
gem.add_development_dependency "pry-nav", "~> 0.2.2"
|
30
|
+
end
|
data/bin/bickle
ADDED
data/lib/bickle.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require "bickle/version"
|
2
|
+
require "bickle/errors"
|
3
|
+
|
4
|
+
require "rest_client"
|
5
|
+
require "delegate"
|
6
|
+
|
7
|
+
module Bickle
|
8
|
+
autoload :Runner, "bickle/runner"
|
9
|
+
|
10
|
+
autoload :Build, "bickle/build"
|
11
|
+
autoload :Repository, "bickle/repository"
|
12
|
+
autoload :BuildRepository, "bickle/build_repository"
|
13
|
+
|
14
|
+
autoload :LengthDecorator, "bickle/length_decorator"
|
15
|
+
autoload :HumanizeDecorator, "bickle/humanize_decorator"
|
16
|
+
autoload :ColorDecorator, "bickle/color_decorator"
|
17
|
+
|
18
|
+
autoload :HttpClient, "bickle/http_client"
|
19
|
+
autoload :ResponseParser, "bickle/response_parser"
|
20
|
+
|
21
|
+
autoload :ThorBuildsTable, "bickle/thor_builds_table"
|
22
|
+
end
|
data/lib/bickle/build.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
module Bickle
|
2
|
+
class Build
|
3
|
+
def initialize(build)
|
4
|
+
@build = build
|
5
|
+
end
|
6
|
+
|
7
|
+
def id
|
8
|
+
@build["id"]
|
9
|
+
end
|
10
|
+
|
11
|
+
def repository_id
|
12
|
+
@build["repository_id"]
|
13
|
+
end
|
14
|
+
|
15
|
+
def number
|
16
|
+
@build["number"]
|
17
|
+
end
|
18
|
+
|
19
|
+
def state
|
20
|
+
@build["state"]
|
21
|
+
end
|
22
|
+
|
23
|
+
def result
|
24
|
+
@build["result"]
|
25
|
+
end
|
26
|
+
|
27
|
+
def started_at
|
28
|
+
@build["started_at"]
|
29
|
+
end
|
30
|
+
|
31
|
+
def finished_at
|
32
|
+
@build["finished_at"]
|
33
|
+
end
|
34
|
+
|
35
|
+
def duration
|
36
|
+
@build["duration"]
|
37
|
+
end
|
38
|
+
|
39
|
+
def commit
|
40
|
+
@build["commit"]
|
41
|
+
end
|
42
|
+
|
43
|
+
def branch
|
44
|
+
@build["branch"]
|
45
|
+
end
|
46
|
+
|
47
|
+
def message
|
48
|
+
message = @build["message"]
|
49
|
+
end
|
50
|
+
|
51
|
+
def event_type
|
52
|
+
@build["event_type"]
|
53
|
+
end
|
54
|
+
|
55
|
+
def pass?
|
56
|
+
result == 0
|
57
|
+
end
|
58
|
+
|
59
|
+
def fail?
|
60
|
+
result == 1
|
61
|
+
end
|
62
|
+
|
63
|
+
def pending?
|
64
|
+
result == nil
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Bickle
|
2
|
+
class BuildRepository
|
3
|
+
BUILDS_URI = "https://api.travis-ci.org/repos/%s/builds.json"
|
4
|
+
|
5
|
+
def initialize(repository, client = HttpClient, response_parser = ResponseParser)
|
6
|
+
@repository = repository
|
7
|
+
@client = client
|
8
|
+
@response_parser = response_parser
|
9
|
+
end
|
10
|
+
|
11
|
+
def fetch(limit = 25)
|
12
|
+
response = @client.get(BUILDS_URI % @repository.name)
|
13
|
+
|
14
|
+
builds = @response_parser.parse(response).map do |build|
|
15
|
+
Build.new(build)
|
16
|
+
end
|
17
|
+
|
18
|
+
builds.first(limit)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require "json"
|
2
|
+
|
3
|
+
module Bickle
|
4
|
+
class Builds
|
5
|
+
BUILDS_URI = "https://api.travis-ci.org/repos/%s/builds.json"
|
6
|
+
DEFAULT_NUMBER = 25
|
7
|
+
|
8
|
+
def initialize(repository, options = {})
|
9
|
+
@repository = repository
|
10
|
+
@options = options
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.for(repository, options = {})
|
14
|
+
new(repository, options).for
|
15
|
+
end
|
16
|
+
|
17
|
+
def for(client = HttpClient, response_parser = ResponseParser)
|
18
|
+
response = client.get(BUILDS_URI % @repository)
|
19
|
+
builds = response_parser.parse(response)
|
20
|
+
|
21
|
+
builds.first(@options["number_of_builds"] || DEFAULT_NUMBER)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Bickle
|
2
|
+
class ColorDecorator < SimpleDelegator
|
3
|
+
def initialize(build, shell)
|
4
|
+
@build = build
|
5
|
+
@shell = shell
|
6
|
+
super(@build)
|
7
|
+
end
|
8
|
+
|
9
|
+
def result
|
10
|
+
res = @build.result
|
11
|
+
|
12
|
+
if @build.pass?
|
13
|
+
@shell.set_color(res, :green)
|
14
|
+
elsif @build.fail?
|
15
|
+
@shell.set_color(res, :red)
|
16
|
+
else
|
17
|
+
@shell.set_color(res, :yellow)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Bickle
|
2
|
+
class LengthDecorator < SimpleDelegator
|
3
|
+
def initialize(build, column_widths = {})
|
4
|
+
@build = build
|
5
|
+
@column_widths = column_widths
|
6
|
+
|
7
|
+
super(@build)
|
8
|
+
end
|
9
|
+
|
10
|
+
def state
|
11
|
+
normalize_width(@build.state, "state", 10)
|
12
|
+
end
|
13
|
+
|
14
|
+
def commit
|
15
|
+
normalize_width(@build.commit, "commit", 5)
|
16
|
+
end
|
17
|
+
|
18
|
+
def branch
|
19
|
+
normalize_width(@build.branch, "branch", 10)
|
20
|
+
end
|
21
|
+
|
22
|
+
def message
|
23
|
+
message = @build.message
|
24
|
+
message = message.gsub(/\s+/, " ")
|
25
|
+
message = message.strip
|
26
|
+
|
27
|
+
normalize_width(message, "message", 50)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def normalize_width(value, key, default)
|
33
|
+
width = Integer(@column_widths[key] || default)
|
34
|
+
value[0...width]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Bickle
|
2
|
+
class Repository
|
3
|
+
def initialize(repository_name)
|
4
|
+
@repository_name = parse_name(repository_name)
|
5
|
+
end
|
6
|
+
|
7
|
+
def name
|
8
|
+
@repository_name
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def parse_name(name)
|
14
|
+
regex = "[A-Za-z0-9_-]+"
|
15
|
+
|
16
|
+
if name =~ Regexp.new("^#{regex}\/#{regex}$")
|
17
|
+
name
|
18
|
+
elsif name =~ Regexp.new("^#{regex}$")
|
19
|
+
"#{name}/#{name}"
|
20
|
+
else
|
21
|
+
raise InvalidRepositoryNameError
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require "thor"
|
2
|
+
|
3
|
+
module Bickle
|
4
|
+
class Runner < Thor
|
5
|
+
|
6
|
+
desc "builds REPOSITORY", "Show latest builds of a repository"
|
7
|
+
long_desc <<-D
|
8
|
+
Show latest builds of a given repository. The repository
|
9
|
+
must be publicly available through the Travis API.
|
10
|
+
|
11
|
+
The format of [REPOSITORY] is "username/repository". Note that
|
12
|
+
if the username is the same as the repository name, you can use
|
13
|
+
"foo" instead of "foo/foo".
|
14
|
+
|
15
|
+
Examples:
|
16
|
+
|
17
|
+
$ bickle builds rails\n
|
18
|
+
$ bickle builds plataformatec/devise -n 10\n
|
19
|
+
$ bickle builds ryanb/cancan -c id message result\n
|
20
|
+
$ bickle builds pry/pry -c id message result -w message:20
|
21
|
+
D
|
22
|
+
|
23
|
+
method_option :"number-of-builds", :type => :numeric, :aliases => "-n", :default => 25, :desc => "Number of builds to display"
|
24
|
+
method_option :columns, :type => :array, :aliases => "-c", :default => ["id", "branch", "commit", "message", "state", "result"], :desc => "Columns to display"
|
25
|
+
method_option :"columns-width", :type => :hash, :aliases => "-w", :default => {}, :desc => "Width of specified columns"
|
26
|
+
method_option :"no-color", :type => :boolean, :aliases => "-b", :default => false, :desc => "Do not use colors"
|
27
|
+
method_option :"no-humanize", :type => :boolean, :aliases => "-h", :default => false, :desc => "Do not translate result values"
|
28
|
+
|
29
|
+
def builds(repository_name)
|
30
|
+
repository = Repository.new(repository_name)
|
31
|
+
|
32
|
+
builds = BuildRepository.new(repository).
|
33
|
+
fetch(options["number-of-builds"])
|
34
|
+
|
35
|
+
builds = builds.map do |build|
|
36
|
+
LengthDecorator.new(build, options["columns-width"])
|
37
|
+
end
|
38
|
+
|
39
|
+
builds = builds.map do |build|
|
40
|
+
HumanizeDecorator.new(build)
|
41
|
+
end unless options["no-humanize"]
|
42
|
+
|
43
|
+
builds = builds.map do |build|
|
44
|
+
ColorDecorator.new(build, shell)
|
45
|
+
end unless options["no-color"]
|
46
|
+
|
47
|
+
table = ThorBuildsTable.new(options["columns"], builds, shell)
|
48
|
+
table.render
|
49
|
+
end
|
50
|
+
|
51
|
+
desc "show ID", "Show details about build with the given ID"
|
52
|
+
long_desc <<-D
|
53
|
+
Show details about build with the given ID. The ID must be
|
54
|
+
associated with a publicly available repository. You can get
|
55
|
+
the ID by using the "builds" command.
|
56
|
+
|
57
|
+
Example:
|
58
|
+
|
59
|
+
$ bickle build 123
|
60
|
+
D
|
61
|
+
|
62
|
+
def build(id)
|
63
|
+
say "Not implemented yet."
|
64
|
+
exit 0
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Bickle
|
2
|
+
class ThorBuildsTable
|
3
|
+
def initialize(headers, builds, shell)
|
4
|
+
@headers = headers
|
5
|
+
@builds = builds
|
6
|
+
@shell = shell
|
7
|
+
end
|
8
|
+
|
9
|
+
def render
|
10
|
+
rows = @builds.map do |build|
|
11
|
+
@headers.map do |header|
|
12
|
+
build.send header
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
@shell.print_table(rows)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/spec/bickle_spec.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Bickle
|
4
|
+
describe Bickle do
|
5
|
+
it "returns builds for the given repository" do
|
6
|
+
HttpClient.should_receive(:get) { "[{\"result\": 0}]"}
|
7
|
+
|
8
|
+
argv = ["builds", "rails", "-c", "result"]
|
9
|
+
capture(:stdout) do
|
10
|
+
Runner.start(argv)
|
11
|
+
end.should include "PASS"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Bickle
|
4
|
+
describe BuildRepository do
|
5
|
+
it "returns builds" do
|
6
|
+
http_client = mock("HttpClient")
|
7
|
+
http_client.should_receive(:get) { "[{\"id\":1}, {\"id\":2}]"}
|
8
|
+
|
9
|
+
builds = BuildRepository.new(Repository.new("rails"), http_client)
|
10
|
+
builds.fetch.length.should equal 2
|
11
|
+
end
|
12
|
+
|
13
|
+
it "returns limited amount of results" do
|
14
|
+
http_client = mock("HttpClient")
|
15
|
+
http_client.should_receive(:get) { "[{\"id\":1}, {\"id\":2}]"}
|
16
|
+
|
17
|
+
builds = BuildRepository.new(Repository.new("rails"), http_client)
|
18
|
+
builds.fetch(1).length.should equal 1
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/spec/build_spec.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
module Bickle
|
2
|
+
describe Build do
|
3
|
+
it "returns plain build values" do
|
4
|
+
build = {
|
5
|
+
"id" => 42,
|
6
|
+
}
|
7
|
+
|
8
|
+
build = Build.new(build)
|
9
|
+
build.id.should == 42
|
10
|
+
end
|
11
|
+
|
12
|
+
it "reports correct status" do
|
13
|
+
build_pass = Build.new("result" => 0)
|
14
|
+
build_pass.pass?.should be_true
|
15
|
+
|
16
|
+
build_fail = Build.new("result" => 1)
|
17
|
+
build_fail.fail?.should be_true
|
18
|
+
|
19
|
+
build_pending = Build.new("result" => nil)
|
20
|
+
build_pending.pending?.should be_true
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Bickle
|
4
|
+
describe ColorDecorator do
|
5
|
+
it "applies colors to the output" do
|
6
|
+
build = mock("Build", :"pass?" => true, :result => 0)
|
7
|
+
shell = mock("Shell")
|
8
|
+
shell.should_receive(:set_color).with(build.result, :green) { "_PASS_" }
|
9
|
+
|
10
|
+
decorator = ColorDecorator.new(build, shell)
|
11
|
+
decorator.result.should include("_PASS_")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Bickle
|
4
|
+
describe HttpClient do
|
5
|
+
it "handles standard errors" do
|
6
|
+
RestClient.should_receive(:get).with("foo").and_raise(StandardError)
|
7
|
+
|
8
|
+
expect do
|
9
|
+
HttpClient.get("foo")
|
10
|
+
end.to raise_error(HttpClientError)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Bickle
|
4
|
+
describe LengthDecorator do
|
5
|
+
it "limits the output when explicitly asked" do
|
6
|
+
build = mock("Build", :message => "abcd")
|
7
|
+
decorator = LengthDecorator.new(build, "message" => 2)
|
8
|
+
decorator.message.should == "ab"
|
9
|
+
end
|
10
|
+
|
11
|
+
it "applies default limits" do
|
12
|
+
build = mock("Build",
|
13
|
+
:state => "a" * 15,
|
14
|
+
:commit => "a" * 10,
|
15
|
+
:branch => "a" * 15,
|
16
|
+
:message => "a" * 55)
|
17
|
+
|
18
|
+
decorator = LengthDecorator.new(build)
|
19
|
+
decorator.state.should == "a" * 10
|
20
|
+
decorator.commit.should == "a" * 5
|
21
|
+
decorator.branch.should == "a" * 10
|
22
|
+
decorator.message.should == "a" * 50
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Bickle
|
4
|
+
describe Repository do
|
5
|
+
it "returns repo name when valid given" do
|
6
|
+
repository = Repository.new("rails/rails")
|
7
|
+
repository.name.should == "rails/rails"
|
8
|
+
end
|
9
|
+
|
10
|
+
it "allows to use a shortened version of repository name" do
|
11
|
+
repository = Repository.new("rails")
|
12
|
+
repository.name.should == "rails/rails"
|
13
|
+
end
|
14
|
+
|
15
|
+
it "raises error if name contains invalid characters" do
|
16
|
+
expect do
|
17
|
+
repository = Repository.new("ra ls")
|
18
|
+
end.to raise_error(InvalidRepositoryNameError)
|
19
|
+
|
20
|
+
expect do
|
21
|
+
repository = Repository.new("rails/)(&@#")
|
22
|
+
end.to raise_error(InvalidRepositoryNameError)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "allows underscores and dashes in the repo name" do
|
26
|
+
expect do
|
27
|
+
repository = Repository.new("foo-bar/foo_bar")
|
28
|
+
end.not_to raise_error(InvalidRepositoryNameError)
|
29
|
+
|
30
|
+
expect do
|
31
|
+
repository = Repository.new("foo_bar")
|
32
|
+
end.not_to raise_error(InvalidRepositoryNameError)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Bickle
|
4
|
+
describe ResponseParser do
|
5
|
+
it "returns JSON when given valid input" do
|
6
|
+
result = ResponseParser.parse("{\"a\": 123}")
|
7
|
+
result.should == {"a" => 123}
|
8
|
+
end
|
9
|
+
|
10
|
+
it "returns error on invalid input" do
|
11
|
+
expect do
|
12
|
+
ResponseParser.parse("foo")
|
13
|
+
end.to raise_error(InvalidResponseError)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require "bundler"
|
2
|
+
Bundler.setup
|
3
|
+
|
4
|
+
require "bickle"
|
5
|
+
|
6
|
+
RSpec.configure do |config|
|
7
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
8
|
+
config.run_all_when_everything_filtered = true
|
9
|
+
config.filter_run :focus
|
10
|
+
|
11
|
+
config.order = "random"
|
12
|
+
|
13
|
+
# https://github.com/wycats/thor/blob/master/spec/spec_helper.rb#L41
|
14
|
+
def capture(stream)
|
15
|
+
begin
|
16
|
+
stream = stream.to_s
|
17
|
+
eval "$#{stream} = StringIO.new"
|
18
|
+
yield
|
19
|
+
result = eval("$#{stream}").string
|
20
|
+
ensure
|
21
|
+
eval("$#{stream} = #{stream.upcase}")
|
22
|
+
end
|
23
|
+
|
24
|
+
result
|
25
|
+
end
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,234 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bickle
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jiri Pospisil
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-11-24 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rest-client
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.6.7
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.6.7
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: json
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.7.5
|
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: 1.7.5
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.9.2
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.9.2
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: guard
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.5.4
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.5.4
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rb-inotify
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 0.8.8
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.8.8
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: guard-rspec
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 2.1.2
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 2.1.2
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rspec
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 2.11.0
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 2.11.0
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: pry
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ~>
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 0.9.10
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ~>
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: 0.9.10
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: pry-nav
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ~>
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: 0.2.2
|
150
|
+
type: :development
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ~>
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: 0.2.2
|
158
|
+
description: Bickle is a tool to display your build status from your terminal.
|
159
|
+
email:
|
160
|
+
- mekishizufu@gmail.com
|
161
|
+
executables:
|
162
|
+
- bickle
|
163
|
+
extensions: []
|
164
|
+
extra_rdoc_files: []
|
165
|
+
files:
|
166
|
+
- .gitignore
|
167
|
+
- .rspec
|
168
|
+
- .travis.yml
|
169
|
+
- Gemfile
|
170
|
+
- Guardfile
|
171
|
+
- LICENSE.txt
|
172
|
+
- README.md
|
173
|
+
- Rakefile
|
174
|
+
- bickle.gemspec
|
175
|
+
- bin/bickle
|
176
|
+
- lib/bickle.rb
|
177
|
+
- lib/bickle/build.rb
|
178
|
+
- lib/bickle/build_repository.rb
|
179
|
+
- lib/bickle/builds.rb
|
180
|
+
- lib/bickle/color_decorator.rb
|
181
|
+
- lib/bickle/errors.rb
|
182
|
+
- lib/bickle/http_client.rb
|
183
|
+
- lib/bickle/humanize_decorator.rb
|
184
|
+
- lib/bickle/length_decorator.rb
|
185
|
+
- lib/bickle/repository.rb
|
186
|
+
- lib/bickle/response_parser.rb
|
187
|
+
- lib/bickle/runner.rb
|
188
|
+
- lib/bickle/thor_builds_table.rb
|
189
|
+
- lib/bickle/version.rb
|
190
|
+
- spec/bickle_spec.rb
|
191
|
+
- spec/build_repository_spec.rb
|
192
|
+
- spec/build_spec.rb
|
193
|
+
- spec/color_decorator_spec.rb
|
194
|
+
- spec/http_client_spec.rb
|
195
|
+
- spec/humanize_decorator_spec.rb
|
196
|
+
- spec/length_decorator_spec.rb
|
197
|
+
- spec/repository_spec.rb
|
198
|
+
- spec/response_parser_spec.rb
|
199
|
+
- spec/spec_helper.rb
|
200
|
+
homepage: ''
|
201
|
+
licenses: []
|
202
|
+
post_install_message:
|
203
|
+
rdoc_options: []
|
204
|
+
require_paths:
|
205
|
+
- lib
|
206
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
207
|
+
none: false
|
208
|
+
requirements:
|
209
|
+
- - ! '>='
|
210
|
+
- !ruby/object:Gem::Version
|
211
|
+
version: '0'
|
212
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
213
|
+
none: false
|
214
|
+
requirements:
|
215
|
+
- - ! '>='
|
216
|
+
- !ruby/object:Gem::Version
|
217
|
+
version: '0'
|
218
|
+
requirements: []
|
219
|
+
rubyforge_project:
|
220
|
+
rubygems_version: 1.8.23
|
221
|
+
signing_key:
|
222
|
+
specification_version: 3
|
223
|
+
summary: Bickle is a tool to display your build status from your terminal.
|
224
|
+
test_files:
|
225
|
+
- spec/bickle_spec.rb
|
226
|
+
- spec/build_repository_spec.rb
|
227
|
+
- spec/build_spec.rb
|
228
|
+
- spec/color_decorator_spec.rb
|
229
|
+
- spec/http_client_spec.rb
|
230
|
+
- spec/humanize_decorator_spec.rb
|
231
|
+
- spec/length_decorator_spec.rb
|
232
|
+
- spec/repository_spec.rb
|
233
|
+
- spec/response_parser_spec.rb
|
234
|
+
- spec/spec_helper.rb
|