see 0.0.15 → 0.0.16

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6dfd09f371cb9b482be160f5cee9dd45f021babd
4
- data.tar.gz: a02a09842f3163b6e6fbfce3ae223cf9da28e302
3
+ metadata.gz: 7035c27e915dbe766b60f7ecc9eb3764db841947
4
+ data.tar.gz: 7b820a12f58cea28f4c0753d5e32a428d4662975
5
5
  SHA512:
6
- metadata.gz: 9932d03b657781b0c54d32eda0c1de1f8d3e7f827df0477013f10f9d6b32f9f12f7ba564eb00707f95cd8068a5cbbc7b702889d97ae1d38a045fafe281ca6dc3
7
- data.tar.gz: 602a8811c2ab6cd597614617165d80cd5f3f87d52ab0a3225c21793f4daab8ebb459815ed0518bb75014e4182782742d1b826c639b834c8c001a0aca5ed7d418
6
+ metadata.gz: bc25228a41b4ffcedabb5c7ae525ff548ef42b4175dce644d0c73499dbef870ded4ce3a4ea9950ded8c3f18bb74e6fb3d42bc70cc9424f53ecd800f22cc06a1d
7
+ data.tar.gz: 9490d1f7d280502c2c25c191a78385d32f21697ec755180d9affbfbeefd6b683ddbb059b16ea3e95aac09c30e7408be0700237148de996ce9722dd91866ac58e
@@ -7,11 +7,13 @@ module See
7
7
  'circle'
8
8
  end
9
9
 
10
- def run(config, info, no_info)
10
+ def run(config)
11
+ info = []
11
12
  token = ENV['CIRCLE_CI_ACCESS_TOKEN']
12
13
  unless token
13
- no_info << "CircleCI - " + "You must set CIRCLE_CI_ACCESS_TOKEN env variable".red
14
- return
14
+ info << "\nCircle CI".light_red
15
+ info << " You must set CIRCLE_CI_ACCESS_TOKEN env variable".red
16
+ return info
15
17
  end
16
18
 
17
19
  CircleCi.configure do |cfg|
@@ -20,14 +22,15 @@ module See
20
22
 
21
23
  response = CircleCi::Project.recent_builds(config['circle']['account'], config['circle']['repository'])
22
24
  if response.errors.length > 0
23
- info << "\nCircleCI - " + "Errors encountered:".red
25
+ info << "\nCircle CI - " + "Errors encountered:".red
24
26
  response.errors.each do |error|
25
27
  info << " - " + "Error #{error.code}:".red + " #{JSON.parse(error.message)['message'].strip}"
26
28
  end
27
- return
29
+ return info
28
30
  end
29
31
 
30
- info << "\nCircleCI - " + "Latest Builds:".light_blue
32
+ info << "\nCircle CI".light_magenta
33
+ info << " Latest Builds:".light_blue
31
34
  response.body[0..4].each do |thing|
32
35
  if thing['committer_date']
33
36
  time = "- #{Date.parse(thing['committer_date']).strftime("%b %e,%l:%M %p")}".black
@@ -42,8 +45,9 @@ module See
42
45
  else
43
46
  name = ""
44
47
  end
45
- info << " - #{status.capitalize} #{thing["vcs_revision"][0..8].light_yellow} #{("#"+thing['build_num'].to_s).light_green} #{thing['subject']} #{name} #{time}"
48
+ info << " - #{status.capitalize} #{thing["vcs_revision"][0..8].light_yellow} #{("#"+thing['build_num'].to_s).light_green} #{thing['subject']} #{name} #{time}"
46
49
  end
50
+ info
47
51
  end
48
52
  end
49
53
  end
@@ -7,35 +7,45 @@ module See
7
7
  'github'
8
8
  end
9
9
 
10
- def run(config, info, no_info)
11
- client = Octokit::Client.new :access_token => ENV['GITHUB_ACCESS_TOKEN']
10
+ def run(config)
11
+ info = []
12
+ token = ENV['GITHUB_ACCESS_TOKEN']
13
+ unless token
14
+ info << "\nGitHub".light_red
15
+ info << " You must set GITHUB_ACCESS_TOKEN env variable".red
16
+ return info
17
+ end
18
+
19
+ client = Octokit::Client.new :access_token => token
12
20
  account = config['github']['account']
13
21
  repository = config['github']['repository']
14
22
  github_name = [account, repository].join '/'
15
23
 
16
24
  pull_requests = client.pull_requests(github_name)
25
+ info << "\nGitHub".light_magenta
17
26
  if pull_requests.count > 0
18
- info << "\nGitHub - " + "Open pull requests:".light_blue
27
+ info << " Open pull requests:".light_blue
19
28
  pull_requests.each do |pull_request|
20
29
  username = "[#{pull_request.user.login}]".cyan
21
30
  time = "- #{pull_request.updated_at.strftime("%b %e,%l:%M %p")}".black
22
- info << " - #{pull_request.title} #{username} #{time}"
31
+ info << " - #{pull_request.title} #{username} #{time}"
23
32
  end
24
33
  else
25
- no_info << "GitHub - " + "No open pull requests".yellow
34
+ info << " No open pull requests".yellow
26
35
  end
27
36
 
28
37
  issues = client.issues(github_name)
29
38
  if issues.count > 0
30
- info << "\nGitHub - " + "Open issues:".light_blue
39
+ info << " Open issues:".light_blue
31
40
  issues.each do |issue|
32
41
  username = "[#{issue.user.login}]".cyan
33
42
  time = "- #{issue.updated_at.strftime("%b %e,%l:%M %p")}".black
34
- info << " - #{issue.title} #{username} #{time}"
43
+ info << " - #{issue.title} #{username} #{time}"
35
44
  end
36
45
  else
37
- no_info << "GitHub - " + "No open issues".yellow
46
+ info << "No open issues".yellow
38
47
  end
48
+ info
39
49
  end
40
50
  end
41
51
  end
@@ -7,11 +7,13 @@ module See
7
7
  "pivotal"
8
8
  end
9
9
 
10
- def run(config, info, no_info)
10
+ def run(config)
11
+ info = []
11
12
  token = ENV['PIVOTAL_TRACKER_ACCESS_TOKEN']
12
13
  unless token
13
- no_info << "Tracker - " + "You must set PIVOTAL_TRACKER_ACCESS_TOKEN env variable".red
14
- return
14
+ info << "\nPivotal Tracker".light_red
15
+ info << " You must set PIVOTAL_TRACKER_ACCESS_TOKEN env variable".red
16
+ return info
15
17
  end
16
18
 
17
19
  PivotalTracker::Client.token = token
@@ -19,6 +21,7 @@ module See
19
21
 
20
22
  next_unowned_story = nil
21
23
  has_current = false
24
+
22
25
  stories = []
23
26
  project.stories.all.each do |story|
24
27
  next if story.accepted_at != nil
@@ -33,22 +36,25 @@ module See
33
36
  end
34
37
  end
35
38
 
39
+ info << "\nPivotal Tracker".light_magenta
36
40
  if stories.length > 0
37
- info << "\nTracker - " + "Stories being worked on:".light_blue
41
+ info << " Stories being worked on:".light_blue
38
42
  info << stories
39
43
  else
40
- no_info << "Tracker - " + "No stories being worked on".yellow
44
+ info << " No stories being worked on".yellow
41
45
  end
42
46
 
47
+
43
48
  if next_unowned_story
44
- info << "\nTracker - " + "Next story that can be worked on:".light_blue
49
+ info << " Next story that can be worked on:".light_blue
45
50
  time = "- #{next_unowned_story.created_at.strftime("%b %e,%l:%M %p")}".black
46
51
  id = "#{next_unowned_story.id}".light_yellow
47
52
  name = next_unowned_story.name
48
- info << " - #{name} #{id} #{time}"
53
+ info << " - #{id} #{name} #{time}"
49
54
  else
50
- no_info << "Tracker - " + "No stories ready to work on".yellow
55
+ info << "No stories ready to work on".yellow
51
56
  end
57
+ info
52
58
  end
53
59
  end
54
60
  end
@@ -7,7 +7,8 @@ module See
7
7
  'travis'
8
8
  end
9
9
 
10
- def run(config, info, no_info)
10
+ def run(config)
11
+ info = []
11
12
  repository = config["travis"]["repository"]
12
13
  builds = Travis::Repository.find(repository).recent_builds[0..4].map do |build|
13
14
  time = ( build.finished_at ? "- #{build.finished_at.strftime("%b %e,%l:%M %p")}" : "- running" ).black
@@ -16,15 +17,19 @@ module See
16
17
  else
17
18
  state = build.unsuccessful? ? build.state.capitalize.red : build.state.capitalize.green
18
19
  end
19
- " - #{state} #{build.commit.short_sha.light_yellow} #{("#"+build.number).light_green} #{build.commit.subject} #{time}"
20
+ name = "[#{build.commit.author_name}]".cyan
21
+ " - #{state} #{build.commit.short_sha.light_yellow} #{("#"+build.number).light_green} #{build.commit.subject} #{name} #{time}"
20
22
  end
21
23
 
22
24
  if builds.count > 0
23
- info << "\nTravis - " + "Latest Builds:".light_blue
25
+ info << "\nTravis".light_magenta
26
+ info << " Latest Builds:".light_blue
24
27
  info.concat(builds)
25
28
  else
26
- no_info << "Travis - " + "No available build status".yellow
29
+ info << "Travis"
30
+ info << "No available build status".yellow
27
31
  end
32
+ info
28
33
  end
29
34
  end
30
35
  end
data/lib/see/plugins.rb CHANGED
@@ -3,20 +3,22 @@ module See
3
3
  require 'colorize'
4
4
  require 'circleci'
5
5
 
6
- def self.run_plugin(name, config, info, no_info)
6
+ def self.run_plugin(name, config)
7
7
  plugins = See::Plugins.constants.map do |const|
8
8
  plugin = See::Plugins.const_get(const).new
9
9
  end.select do |plugin|
10
10
  plugin.config_name == name
11
11
  end
12
12
 
13
+ info = []
13
14
  plugins.each do |plugin|
14
- plugin.run(config, info, no_info)
15
+ info.concat(plugin.run(config))
15
16
  end
16
17
 
17
18
  if plugins.empty?
18
19
  puts "No plugin found with the name \"#{name}\"".light_red
19
20
  end
21
+ info
20
22
  end
21
23
  end
22
24
  end
data/lib/see/runner.rb CHANGED
@@ -35,29 +35,18 @@ module See
35
35
  threads = []
36
36
  config.each do |cfg|
37
37
  threads << Thread.new do
38
- See::Plugins.run_plugin(cfg[0], config, good=[], bad=[])
39
- Thread.current[:good] = good
40
- Thread.current[:bad] = bad
38
+ Thread.current[:lines] = See::Plugins.run_plugin(cfg[0], config)
41
39
  end
42
40
  end
41
+ puts
42
+
43
+ progress.kill
43
44
 
44
- good = []
45
- bad = []
46
45
  threads.each do |t|
47
46
  t.join
48
- good << t[:good] if t[:good]
49
- bad << t[:bad] if t[:bad]
47
+ t[:lines].each { |line| puts line }
50
48
  end
51
-
52
- progress.kill
53
- puts
54
-
55
- good.sort_by {|a| a[0]}.each {|g| puts g}
56
49
  puts
57
- unless bad.empty?
58
- puts bad.sort
59
- puts
60
- end
61
50
  end
62
51
  end
63
52
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: see
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Avila