see 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/see +2 -0
  3. data/lib/see.rb +122 -0
  4. metadata +47 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: dfda752b5ca5cfdb39e900487e498ec27f60c769
4
+ data.tar.gz: 7e89e87b398f921ba60ec9f1fbe5a159d8749cdf
5
+ SHA512:
6
+ metadata.gz: 162dc67d03e97cb1f2a674fefa717664ac977c67bf3387d9909d1f2c14d93df91686bb1289de6941cbdb1e59b8fde67ef7538b36e3bc67bf7c8c0d9e4a48acdb
7
+ data.tar.gz: daa2d10d4d726cd8dcdab9367b4e01e720303f94a656f4e0088479464b9e6eeca14075681a59736c120247761a2e330e7f00ccd4acdc02a5b6665e0caa3a9016
data/bin/see ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env ruby
2
+ require 'see'
data/lib/see.rb ADDED
@@ -0,0 +1,122 @@
1
+ require 'colorize'
2
+ require 'travis'
3
+ require 'octokit'
4
+ require 'pivotal-tracker'
5
+ require 'yaml'
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
+ begin
105
+ config = YAML.load_file('.project.yml')
106
+ rescue
107
+ puts 'No configuration file found (tried ./.project.yml)'.yellow
108
+ puts ' (if the file exists it may be malformed)'
109
+ exit 1
110
+ end
111
+
112
+ information = []
113
+ no_information = []
114
+ config.each do |configuration|
115
+ information = []
116
+ service_name = configuration[0]
117
+ self.send(service_name, config, information, no_information)
118
+ puts information
119
+ end
120
+
121
+ puts
122
+ puts no_information.map(&:yellow)
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: see
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Michael Avila
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-18 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email: me@michaelavila.com
15
+ executables:
16
+ - see
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/see
21
+ - lib/see.rb
22
+ homepage:
23
+ licenses: []
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 2.0.14
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: Project status for programmers
46
+ test_files: []
47
+ has_rdoc: true