see 0.0.3 → 0.0.6
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/bin/see +1 -0
- data/lib/see/plugins/circle.rb +46 -0
- data/lib/see/plugins/github.rb +42 -0
- data/lib/see/plugins/pivotal.rb +49 -0
- data/lib/see/plugins/travis.rb +30 -0
- data/lib/see/plugins.rb +22 -0
- data/lib/see/runner.rb +40 -0
- data/lib/see.rb +6 -123
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5574e99ef0143f88e2ff3091ed46dbb35d727090
|
4
|
+
data.tar.gz: 5b11a2ab44119bb4b7e7e1deae49658e52c66faa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f5b1f5f13745af2183efbc96f3878f81bc2ccc5a218d7e285064767b9916d1888331c8df5623d0d68f26a3e2f0e184f39aa7bcd059017c959f2e0b9ea2d5b5e
|
7
|
+
data.tar.gz: 0e28c840f7e5c491453ac5e2e13d6ccc1dfd181428a55f162139d1e0e2fdcb25bd995ff8f79ee33868d888aff674df22f5449ce649e15f7a5b50ac390da20113
|
data/bin/see
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
|
2
|
+
module See
|
3
|
+
module Plugins
|
4
|
+
class Circle
|
5
|
+
def config_name
|
6
|
+
'circle'
|
7
|
+
end
|
8
|
+
|
9
|
+
def run(config, info, no_info)
|
10
|
+
CircleCi.configure do |config|
|
11
|
+
config.token = '6cb3ee6ee8ed3b2399bfae16294ef2291cfde9bb'
|
12
|
+
end
|
13
|
+
|
14
|
+
response = CircleCi::Project.recent_builds(config['circle']['account'], config['circle']['repository'])
|
15
|
+
info << "Latest Builds:".light_blue
|
16
|
+
response.body.each do |thing|
|
17
|
+
time = "(#{thing['stop_time']})".blue if thing['stop_time']
|
18
|
+
if thing['status'].match(/failed|not_run/)
|
19
|
+
status = thing['status'].red
|
20
|
+
else
|
21
|
+
status = thing['status'].green
|
22
|
+
end
|
23
|
+
info << " - #{status} #{thing["vcs_revision"][0..8].light_yellow} #{("#"+thing['build_num'].to_s).black} #{thing['subject']} #{thing['author_name'].cyan} #{time}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def xrun(config, info, no_info)
|
28
|
+
client = Travis::Client.new
|
29
|
+
|
30
|
+
repository = config["travis"]["repository"]
|
31
|
+
builds = client.repo(repository).recent_builds.map do |build|
|
32
|
+
time = "(#{build.finished_at.strftime("%b %e,%l:%M %p")})".blue
|
33
|
+
state = build.failed? ? build.state.capitalize.red : build.state.capitalize.green
|
34
|
+
" - #{state} #{build.commit.short_sha.light_yellow} #{build.commit.subject} #{build.job_ids.to_s.light_magenta} #{time}"
|
35
|
+
end
|
36
|
+
|
37
|
+
if builds.count > 0
|
38
|
+
info << "Latest Builds:".light_blue
|
39
|
+
info.concat(builds)
|
40
|
+
else
|
41
|
+
no_info << "No available build status".yellow
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'octokit'
|
2
|
+
|
3
|
+
module See
|
4
|
+
module Plugins
|
5
|
+
class GitHub
|
6
|
+
def config_name
|
7
|
+
'github'
|
8
|
+
end
|
9
|
+
|
10
|
+
def run(config, info, no_info)
|
11
|
+
client = Octokit::Client.new :access_token => ENV['GITHUB_ACCESS_TOKEN']
|
12
|
+
account = config['github']['account']
|
13
|
+
repository = config['github']['repository']
|
14
|
+
github_name = [account, repository].join '/'
|
15
|
+
|
16
|
+
pull_requests = client.pull_requests(github_name)
|
17
|
+
if pull_requests.count > 0
|
18
|
+
info << "Open pull requests:".light_blue
|
19
|
+
pull_requests.each do |pull_request|
|
20
|
+
username = "[#{pull_request.user.login}]".cyan
|
21
|
+
time = "(#{pull_request.updated_at.strftime("%b %e,%l:%M %p")})".blue
|
22
|
+
info << " - #{pull_request.title} #{username} #{time}"
|
23
|
+
end
|
24
|
+
else
|
25
|
+
no_info << "No open pull requests"
|
26
|
+
end
|
27
|
+
|
28
|
+
issues = client.issues(github_name)
|
29
|
+
if issues.count > 0
|
30
|
+
info << "Open issues:".light_blue
|
31
|
+
issues.each do |issue|
|
32
|
+
username = "[#{issue.user.login}]".cyan
|
33
|
+
time = "(#{issue.updated_at.strftime("%b %e,%l:%M %p")})".blue
|
34
|
+
info << " - #{issue.title} #{username} #{time}"
|
35
|
+
end
|
36
|
+
else
|
37
|
+
no_info << "No open issues"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'pivotal-tracker'
|
2
|
+
|
3
|
+
module See
|
4
|
+
module Plugins
|
5
|
+
class Pivotal
|
6
|
+
def config_name
|
7
|
+
"pivotal"
|
8
|
+
end
|
9
|
+
|
10
|
+
def run(config, info, no_info)
|
11
|
+
PivotalTracker::Client.token = ENV['PIVOTAL_TRACKER_ACCESS_TOKEN']
|
12
|
+
project = PivotalTracker::Project.find(config['pivotal']['project'])
|
13
|
+
|
14
|
+
next_unowned_story = nil
|
15
|
+
has_current = false
|
16
|
+
stories = []
|
17
|
+
project.stories.all.each do |story|
|
18
|
+
next if story.accepted_at != nil
|
19
|
+
if story.owned_by == nil and not next_unowned_story
|
20
|
+
next_unowned_story = story
|
21
|
+
elsif story.owned_by
|
22
|
+
has_current = true
|
23
|
+
owner = "[#{story.owned_by}]".cyan
|
24
|
+
time = "(#{story.created_at.strftime("%b %e,%l:%M %p")})".blue
|
25
|
+
id = "#{story.id}".light_yellow
|
26
|
+
stories << " - #{story.name} #{owner} #{id} #{time}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
if stories.length > 0
|
31
|
+
info << "Stories being worked on:".light_blue
|
32
|
+
info << stories
|
33
|
+
else
|
34
|
+
no_info << "No stories being worked on"
|
35
|
+
end
|
36
|
+
|
37
|
+
if next_unowned_story
|
38
|
+
info << "Next story that can be worked on:".light_blue
|
39
|
+
time = "(#{next_unowned_story.created_at.strftime("%b %e,%l:%M %p")})".blue
|
40
|
+
id = "#{next_unowned_story.id}".light_yellow
|
41
|
+
name = next_unowned_story.name
|
42
|
+
info << " - #{name} #{id} #{time}"
|
43
|
+
else
|
44
|
+
no_info << "No stories ready to work on"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'travis/client'
|
2
|
+
|
3
|
+
module See
|
4
|
+
module Plugins
|
5
|
+
|
6
|
+
class TravisCI
|
7
|
+
def config_name
|
8
|
+
'travis'
|
9
|
+
end
|
10
|
+
|
11
|
+
def run(config, info, no_info)
|
12
|
+
client = Travis::Client.new
|
13
|
+
|
14
|
+
repository = config["travis"]["repository"]
|
15
|
+
builds = client.repo(repository).recent_builds.map do |build|
|
16
|
+
time = "(#{build.finished_at.strftime("%b %e,%l:%M %p")})".blue
|
17
|
+
state = build.failed? ? build.state.capitalize.red : build.state.capitalize.green
|
18
|
+
" - #{state} #{build.commit.short_sha.light_yellow} #{build.commit.subject} #{build.job_ids.to_s.light_magenta} #{time}"
|
19
|
+
end
|
20
|
+
|
21
|
+
if builds.count > 0
|
22
|
+
info << "Latest Builds:".light_blue
|
23
|
+
info.concat(builds)
|
24
|
+
else
|
25
|
+
no_info << "No available build status".yellow
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/see/plugins.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
module See
|
2
|
+
module Plugins
|
3
|
+
require 'colorize'
|
4
|
+
require 'circleci'
|
5
|
+
|
6
|
+
def self.run_plugin(name, config, info, no_info)
|
7
|
+
plugins = See::Plugins.constants.map do |const|
|
8
|
+
plugin = See::Plugins.const_get(const).new
|
9
|
+
end.select do |plugin|
|
10
|
+
plugin.config_name == name
|
11
|
+
end
|
12
|
+
|
13
|
+
plugins.each do |plugin|
|
14
|
+
plugin.run(config, info, no_info)
|
15
|
+
end
|
16
|
+
|
17
|
+
if plugins.empty?
|
18
|
+
puts "No plugin found with the name \"#{name}\"".light_red
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/see/runner.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module See
|
4
|
+
class Runner
|
5
|
+
def self.run
|
6
|
+
Runner.new.run
|
7
|
+
end
|
8
|
+
|
9
|
+
def run
|
10
|
+
#
|
11
|
+
# Whole thing happens in two major steps:
|
12
|
+
# 1. load ./sights.yml
|
13
|
+
# (fail if it doesn't exist)
|
14
|
+
#
|
15
|
+
# 2. provide information from each configured plugin
|
16
|
+
# (provide content at the top and no content at the bottom)
|
17
|
+
#
|
18
|
+
config_path = "#{Dir.pwd}/sights.yml"
|
19
|
+
begin
|
20
|
+
config = YAML.load_file(config_path)
|
21
|
+
rescue
|
22
|
+
puts "No configuration file found (tried #{config_path})".yellow
|
23
|
+
puts ' (if the file exists it may be malformed)'
|
24
|
+
exit 1
|
25
|
+
end
|
26
|
+
|
27
|
+
info = []
|
28
|
+
no_info = []
|
29
|
+
config.each do |configuration|
|
30
|
+
info = []
|
31
|
+
name = configuration[0]
|
32
|
+
See::Plugins.run_plugin(name, config, info, no_info)
|
33
|
+
puts info
|
34
|
+
end
|
35
|
+
|
36
|
+
puts
|
37
|
+
puts no_info.map(&:yellow)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/see.rb
CHANGED
@@ -1,123 +1,6 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
require '
|
4
|
-
require '
|
5
|
-
require '
|
6
|
-
|
7
|
-
def github(config, info, no_info)
|
8
|
-
if config.has_key?('github')
|
9
|
-
client = Octokit::Client.new :access_token => ENV['GITHUB_ACCESS_TOKEN']
|
10
|
-
account = config['github']['account']
|
11
|
-
repository = config['github']['repository']
|
12
|
-
github_name = [account, repository].join '/'
|
13
|
-
|
14
|
-
pull_requests = client.pull_requests(github_name)
|
15
|
-
if pull_requests.count > 0
|
16
|
-
info << "Open pull requests:".light_blue
|
17
|
-
pull_requests.each do |pull_request|
|
18
|
-
username = "[#{pull_request.user.login}]".cyan
|
19
|
-
time = "(#{pull_request.updated_at.strftime("%b %e,%l:%M %p")})".blue
|
20
|
-
info << " - #{pull_request.title} #{username} #{time}"
|
21
|
-
end
|
22
|
-
else
|
23
|
-
no_info << "No open pull requests"
|
24
|
-
end
|
25
|
-
|
26
|
-
issues = client.issues(github_name)
|
27
|
-
if issues.count > 0
|
28
|
-
info << "Open issues:".light_blue
|
29
|
-
issues.each do |issue|
|
30
|
-
username = "[#{issue.user.login}]".cyan
|
31
|
-
time = "(#{issue.updated_at.strftime("%b %e,%l:%M %p")})".blue
|
32
|
-
info << " - #{issue.title} #{username} #{time}"
|
33
|
-
end
|
34
|
-
else
|
35
|
-
no_info << "No open issues"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def pivotal(config, info, no_info)
|
41
|
-
if config.has_key?('pivotal')
|
42
|
-
PivotalTracker::Client.token = ENV['PIVOTAL_TRACKER_ACCESS_TOKEN']
|
43
|
-
project = PivotalTracker::Project.find(config['pivotal']['project'])
|
44
|
-
|
45
|
-
next_unowned_story = nil
|
46
|
-
has_current = false
|
47
|
-
stories = []
|
48
|
-
project.stories.all.each do |story|
|
49
|
-
next if story.accepted_at != nil
|
50
|
-
if story.owned_by == nil and not next_unowned_story
|
51
|
-
next_unowned_story = story
|
52
|
-
elsif story.owned_by
|
53
|
-
has_current = true
|
54
|
-
owner = "[#{story.owned_by}]".cyan
|
55
|
-
time = "(#{story.created_at.strftime("%b %e,%l:%M %p")})".blue
|
56
|
-
id = "#{story.id}".light_yellow
|
57
|
-
stories << " - #{story.name} #{owner} #{id} #{time}"
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
if stories.length > 0
|
62
|
-
info << "Stories being worked on:".light_blue
|
63
|
-
info << stories
|
64
|
-
else
|
65
|
-
no_info << "No stories being worked on"
|
66
|
-
end
|
67
|
-
|
68
|
-
if next_unowned_story
|
69
|
-
info << "Next story that can be worked on:".light_blue
|
70
|
-
time = "(#{next_unowned_story.created_at.strftime("%b %e,%l:%M %p")})".blue
|
71
|
-
id = "#{next_unowned_story.id}".light_yellow
|
72
|
-
name = next_unowned_story.name
|
73
|
-
info << " - #{name} #{id} #{time}"
|
74
|
-
else
|
75
|
-
no_info << "No stories ready to work on"
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
def travis(config, info, no_info)
|
81
|
-
if config.has_key?('travis')
|
82
|
-
client = Travis::Client.new
|
83
|
-
|
84
|
-
repository = config["travis"]["repository"]
|
85
|
-
builds = client.repo(repository).recent_builds.map do |build|
|
86
|
-
time = "(#{build.finished_at.strftime("%b %e,%l:%M %p")})".blue
|
87
|
-
state = build.failed? ? build.state.capitalize.red : build.state.capitalize.green
|
88
|
-
" - #{state} #{build.commit.short_sha.light_yellow} #{build.commit.subject} #{build.job_ids.to_s.light_magenta} #{time}"
|
89
|
-
end
|
90
|
-
|
91
|
-
if builds.count > 0
|
92
|
-
info << "Latest Builds:".light_blue
|
93
|
-
info.concat(builds)
|
94
|
-
else
|
95
|
-
no_info << "No available build status".yellow
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
#
|
101
|
-
# Processing of plugins
|
102
|
-
#
|
103
|
-
|
104
|
-
config_path = "#{Dir.pwd}/sights.yml"
|
105
|
-
begin
|
106
|
-
config = YAML.load_file(config_path)
|
107
|
-
rescue
|
108
|
-
puts "No configuration file found (tried #{config_path})".yellow
|
109
|
-
puts ' (if the file exists it may be malformed)'
|
110
|
-
exit 1
|
111
|
-
end
|
112
|
-
|
113
|
-
information = []
|
114
|
-
no_information = []
|
115
|
-
config.each do |configuration|
|
116
|
-
information = []
|
117
|
-
service_name = configuration[0]
|
118
|
-
self.send(service_name, config, information, no_information)
|
119
|
-
puts information
|
120
|
-
end
|
121
|
-
|
122
|
-
puts
|
123
|
-
puts no_information.map(&:yellow)
|
1
|
+
require 'see/plugins'
|
2
|
+
require 'see/plugins/github'
|
3
|
+
require 'see/plugins/pivotal'
|
4
|
+
require 'see/plugins/travis'
|
5
|
+
require 'see/plugins/circle'
|
6
|
+
require 'see/runner'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: see
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Avila
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: circleci
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description:
|
70
84
|
email: me@michaelavila.com
|
71
85
|
executables:
|
@@ -74,6 +88,12 @@ extensions: []
|
|
74
88
|
extra_rdoc_files: []
|
75
89
|
files:
|
76
90
|
- bin/see
|
91
|
+
- lib/see/plugins.rb
|
92
|
+
- lib/see/plugins/github.rb
|
93
|
+
- lib/see/plugins/pivotal.rb
|
94
|
+
- lib/see/plugins/travis.rb
|
95
|
+
- lib/see/plugins/circle.rb
|
96
|
+
- lib/see/runner.rb
|
77
97
|
- lib/see.rb
|
78
98
|
homepage:
|
79
99
|
licenses: []
|