circle_ci_build_status 0.1.0
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 +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +30 -0
- data/Rakefile +2 -0
- data/bin/build +9 -0
- data/circle_ci_build_status.gemspec +28 -0
- data/lib/circle_ci_build_status/version.rb +3 -0
- data/lib/circle_ci_build_status.rb +49 -0
- metadata +153 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 52c99ab350221b920823f10a3a26277629ee5567
|
4
|
+
data.tar.gz: 6f0c2adbedc930b578eeb6eed99180b776e52593
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 339f63e0b851e087c0935bd9f971d202b2954358fd21f90c5ce6a396bab66bf014ac3e823a1272711c947c75d650c7cca75dca9d54c6eae796825b28e4bc3fef
|
7
|
+
data.tar.gz: 6e531cfc0665633a2e7120b3cafa31ca48e312aaa8cb70ade21af2d7187a7125eeb3124b209066d7cd6756842cc37160015688564e01bf5e02d829dcbc291d2c
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Alex Foster
|
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,30 @@
|
|
1
|
+
# CircleCiBuildStatus
|
2
|
+
|
3
|
+
A CLI that will get the build status of your project.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Install the gem
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem install circle_ci_build_status
|
11
|
+
```
|
12
|
+
|
13
|
+
Export your Circle CI token and your Github handle in your .bash_profile
|
14
|
+
|
15
|
+
```bash
|
16
|
+
export CIRCLE_CI_TOKEN=<token value>
|
17
|
+
export GITHUB_NAME=<github name>
|
18
|
+
```
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
Run ```build status``` in the root of your project.
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
|
26
|
+
1. Fork it ( https://github.com/[my-github-username]/circle_ci_build_status/fork )
|
27
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
28
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
29
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
30
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/build
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'circle_ci_build_status/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "circle_ci_build_status"
|
8
|
+
spec.version = CircleCiBuildStatus::VERSION
|
9
|
+
spec.authors = ["Alex Foster"]
|
10
|
+
spec.email = ["alexjfno1@gmail.com"]
|
11
|
+
spec.summary = %q{A CLI that can quicky print the status of your build in the terminal.}
|
12
|
+
spec.description = %q{A CLI that will get the build status based on your current project and branch name and print it in the terminal.}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = ["build"]
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "nori"
|
22
|
+
spec.add_dependency "faraday"
|
23
|
+
spec.add_dependency "nokogiri"
|
24
|
+
spec.add_dependency "colorize"
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "pry"
|
28
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require "circle_ci_build_status/version"
|
2
|
+
require "nori"
|
3
|
+
require "faraday"
|
4
|
+
require "colorize"
|
5
|
+
|
6
|
+
module CircleCiBuildStatus
|
7
|
+
|
8
|
+
class ProjectNotFound < StandardError ; end
|
9
|
+
|
10
|
+
class Build
|
11
|
+
def status
|
12
|
+
print_status(project_details["Projects"]["Project"]["@lastBuildStatus"])
|
13
|
+
rescue ProjectNotFound
|
14
|
+
print_error
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def build_circle_ci_url
|
20
|
+
"https://circleci.com/gh/#{ENV["GITHUB_USER"]}/#{project_name}/tree/#{current_branch}.cc.xml?circle-token=#{ENV["CIRCLE_CI_TOKEN"]}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def project_details
|
24
|
+
response = ::Faraday.get(build_circle_ci_url)
|
25
|
+
raise ProjectNotFound if response.status == 404
|
26
|
+
::Nori.new.parse(response.body)
|
27
|
+
end
|
28
|
+
|
29
|
+
def project_name
|
30
|
+
Dir.pwd =~ /.*\/(.*?)$/ ; $1
|
31
|
+
end
|
32
|
+
|
33
|
+
def current_branch
|
34
|
+
(`git rev-parse --abbrev-ref HEAD`).strip
|
35
|
+
end
|
36
|
+
|
37
|
+
def print_status(status)
|
38
|
+
puts
|
39
|
+
puts "Project: " + project_name.cyan
|
40
|
+
puts "Branch: " + current_branch.yellow
|
41
|
+
puts "Build Status: " + status.green
|
42
|
+
puts
|
43
|
+
end
|
44
|
+
|
45
|
+
def print_error
|
46
|
+
puts "\nWe can't seem to find the " + "#{project_name}".cyan + " project with the branch " + "#{current_branch}".yellow + " on Circle CI\n\n"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
metadata
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: circle_ci_build_status
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alex Foster
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: nori
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: nokogiri
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: colorize
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.7'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.7'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '10.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '10.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: A CLI that will get the build status based on your current project and
|
112
|
+
branch name and print it in the terminal.
|
113
|
+
email:
|
114
|
+
- alexjfno1@gmail.com
|
115
|
+
executables:
|
116
|
+
- build
|
117
|
+
extensions: []
|
118
|
+
extra_rdoc_files: []
|
119
|
+
files:
|
120
|
+
- ".gitignore"
|
121
|
+
- Gemfile
|
122
|
+
- LICENSE.txt
|
123
|
+
- README.md
|
124
|
+
- Rakefile
|
125
|
+
- bin/build
|
126
|
+
- circle_ci_build_status.gemspec
|
127
|
+
- lib/circle_ci_build_status.rb
|
128
|
+
- lib/circle_ci_build_status/version.rb
|
129
|
+
homepage: ''
|
130
|
+
licenses:
|
131
|
+
- MIT
|
132
|
+
metadata: {}
|
133
|
+
post_install_message:
|
134
|
+
rdoc_options: []
|
135
|
+
require_paths:
|
136
|
+
- lib
|
137
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
requirements: []
|
148
|
+
rubyforge_project:
|
149
|
+
rubygems_version: 2.2.2
|
150
|
+
signing_key:
|
151
|
+
specification_version: 4
|
152
|
+
summary: A CLI that can quicky print the status of your build in the terminal.
|
153
|
+
test_files: []
|