how_is 3.0.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f8b7397035c52022ad95011075e202e3f4e271e
4
- data.tar.gz: 1bc5444c77188717a43d667e36d84185576bb6f6
3
+ metadata.gz: 6c17d169e06ca052856a5f54f29ce731969fb360
4
+ data.tar.gz: bf8e3a5d7e9d14fc3a2c1a3872cbeaa553d02145
5
5
  SHA512:
6
- metadata.gz: 003439cd51e94bd6e7136cfae977bb8bcb1f7b5f3d9a1b5b3ebf7404f8d3d21ab668901c87565314d17bd1b2bd78e2481151c4ccbcc593b3418a006063c8e407
7
- data.tar.gz: 040161c89aa03c12083fcae5c0e944776298b75c65087c0ac5e24b0c85b8dc10312d3b6f2b7c02356dfde0835e99e678e8540aa9e8aaf27806cde3982d8db607
6
+ metadata.gz: 03befeb1658951c1f91da87e3cceaf0bd5eef367013b6e86770388116188c2cc415e0d3b1115b8cfba226fb276b2a6ce2c9aae376d56b4856d5562e9fd3b63b5
7
+ data.tar.gz: 0dcb464f1aacb367589c4670e41adac383ca2fae358a25b1f2093f04420e79597c18ad413b875432bc7ce50c6dbc5187fb40662151b4354b25b966e32898eb5a
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
- --format documentation
2
- --color
1
+ --format documentation
2
+ --color
data/CODE_OF_CONDUCT.md CHANGED
@@ -1,49 +1,49 @@
1
- # Contributor Code of Conduct
2
-
3
- As contributors and maintainers of this project, and in the interest of
4
- fostering an open and welcoming community, we pledge to respect all people who
5
- contribute through reporting issues, posting feature requests, updating
6
- documentation, submitting pull requests or patches, and other activities.
7
-
8
- We are committed to making participation in this project a harassment-free
9
- experience for everyone, regardless of level of experience, gender, gender
10
- identity and expression, sexual orientation, disability, personal appearance,
11
- body size, race, ethnicity, age, religion, or nationality.
12
-
13
- Examples of unacceptable behavior by participants include:
14
-
15
- * The use of sexualized language or imagery
16
- * Personal attacks
17
- * Trolling or insulting/derogatory comments
18
- * Public or private harassment
19
- * Publishing other's private information, such as physical or electronic
20
- addresses, without explicit permission
21
- * Other unethical or unprofessional conduct
22
-
23
- Project maintainers have the right and responsibility to remove, edit, or
24
- reject comments, commits, code, wiki edits, issues, and other contributions
25
- that are not aligned to this Code of Conduct, or to ban temporarily or
26
- permanently any contributor for other behaviors that they deem inappropriate,
27
- threatening, offensive, or harmful.
28
-
29
- By adopting this Code of Conduct, project maintainers commit themselves to
30
- fairly and consistently applying these principles to every aspect of managing
31
- this project. Project maintainers who do not follow or enforce the Code of
32
- Conduct may be permanently removed from the project team.
33
-
34
- This code of conduct applies both within project spaces and in public spaces
35
- when an individual is representing the project or its community.
36
-
37
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
- reported by contacting a project maintainer at me@duckie.co. All
39
- complaints will be reviewed and investigated and will result in a response that
40
- is deemed necessary and appropriate to the circumstances. Maintainers are
41
- obligated to maintain confidentiality with regard to the reporter of an
42
- incident.
43
-
44
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
- version 1.3.0, available at
46
- [http://contributor-covenant.org/version/1/3/0/][version]
47
-
48
- [homepage]: http://contributor-covenant.org
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at me@duckie.co. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
49
  [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in how_is.gemspec
4
- gemspec
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in how_is.gemspec
4
+ gemspec
data/LICENSE.txt CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2016 Ellen Marie Dash
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Ellen Marie Dash
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console CHANGED
@@ -1,14 +1,14 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "how_is"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "how_is"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup CHANGED
@@ -1,8 +1,8 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/how_is.gemspec CHANGED
@@ -28,7 +28,10 @@ Gem::Specification.new do |spec|
28
28
  # so this pegs Rack to the latest version that works with Ruby 2.2.0.
29
29
  spec.add_runtime_dependency "rack", "< 2.0"
30
30
 
31
+ spec.add_runtime_dependency "tessellator-fetcher", "~> 4.0.1"
32
+
31
33
  spec.add_development_dependency "bundler", "~> 1.11"
32
34
  spec.add_development_dependency "rake", "~> 10.0"
33
35
  spec.add_development_dependency "rspec", "~> 3.0"
36
+ spec.add_development_dependency 'timecop', '~> 0.8.1'
34
37
  end
@@ -90,7 +90,7 @@ module HowIs
90
90
  timestamps = issues_or_pulls.map { |iop| Date.parse(iop['created_at']).strftime('%s').to_i }
91
91
  average_timestamp = timestamps.reduce(:+) / issues_or_pulls.length
92
92
 
93
- Date.strptime(average_timestamp.to_s, '%s')
93
+ DateTime.strptime(average_timestamp.to_s, '%s')
94
94
  end
95
95
 
96
96
  # Given an Array of issues or pulls, return the average age of them.
@@ -0,0 +1,29 @@
1
+ require 'tessellator/fetcher'
2
+
3
+ module HowIs
4
+ # This entire class is a monstrous hack, because GitHub doesn't provide a good
5
+ # API for Pulse.
6
+ class Pulse
7
+ def initialize(repository)
8
+ @repository = repository
9
+ @pulse_page_response = fetch_pulse!(repository)
10
+ end
11
+
12
+ def text_summary
13
+ raise NotImplementedError
14
+ end
15
+
16
+ def html_summary
17
+ @pulse_page_response.body
18
+ .split('<div class="section diffstat-summary">').last
19
+ .split('</div>').first
20
+ .gsub('<a href="/', '<a href="https://github.com/')
21
+ .strip
22
+ end
23
+
24
+ private
25
+ def fetch_pulse!(repository, period='monthly')
26
+ Tessellator::Fetcher.new.call('get', "https://github.com/#{repository}/pulse/#{period}")
27
+ end
28
+ end
29
+ end
@@ -1,7 +1,12 @@
1
1
  require 'cgi'
2
+ require 'how_is/pulse'
2
3
 
3
4
  module HowIs
4
5
  class HtmlReport < BaseReport
6
+ def format
7
+ :html
8
+ end
9
+
5
10
  def title(_text)
6
11
  @title = _text
7
12
  @r += "<h1>#{_text}</h1>"
@@ -15,6 +20,10 @@ module HowIs
15
20
  %Q[<a href="#{url}">#{_text}</a>]
16
21
  end
17
22
 
23
+ def monthly_summary
24
+ pulse.html_summary
25
+ end
26
+
18
27
  def horizontal_bar_graph(data)
19
28
  biggest = data.map { |x| x[1] }.max
20
29
  get_percentage = ->(number_of_issues) { number_of_issues * 100 / biggest }
@@ -1,5 +1,9 @@
1
1
  module HowIs
2
2
  class JsonReport < BaseReport
3
+ def format
4
+ :json
5
+ end
6
+
3
7
  def export(&block)
4
8
  to_json
5
9
  end
@@ -3,6 +3,10 @@ require 'how_is/chart'
3
3
 
4
4
  module HowIs
5
5
  class PdfReport < BaseReport
6
+ def format
7
+ :pdf
8
+ end
9
+
6
10
  attr_accessor :pdf
7
11
 
8
12
  def title(_text)
data/lib/how_is/report.rb CHANGED
@@ -8,6 +8,15 @@ module HowIs
8
8
  ##
9
9
  # Represents a completed report.
10
10
  class BaseReport < Struct.new(:analysis)
11
+ def format
12
+ raise NotImplementedError
13
+ end
14
+
15
+ def github_pulse_summary
16
+ @pulse ||= HowIs::Pulse.new(analysis.repository)
17
+ @pulse.send("#{format}_summary")
18
+ end
19
+
11
20
  def to_h
12
21
  analysis.to_h
13
22
  end
@@ -41,6 +50,8 @@ module HowIs
41
50
  REPORT_BLOCK = proc do
42
51
  title "How is #{analysis.repository}?"
43
52
 
53
+ text github_pulse_summary
54
+
44
55
  header "Pull Requests"
45
56
  text issue_or_pr_summary "pull", "pull request"
46
57
 
@@ -1,3 +1,3 @@
1
1
  module HowIs
2
- VERSION = "3.0.0"
2
+ VERSION = "4.0.0"
3
3
  end
data/lib/how_is.rb CHANGED
@@ -1,5 +1,8 @@
1
1
  require 'how_is/version'
2
2
  require 'contracts'
3
+ require 'cacert'
4
+
5
+ Cacert.set_in_env
3
6
 
4
7
  C = Contracts
5
8
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: how_is
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ellen Marie Dash
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-13 00:00:00.000000000 Z
11
+ date: 2016-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: github_api
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "<"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '2.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: tessellator-fetcher
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 4.0.1
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 4.0.1
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: bundler
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +136,20 @@ dependencies:
122
136
  - - "~>"
123
137
  - !ruby/object:Gem::Version
124
138
  version: '3.0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: timecop
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 0.8.1
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 0.8.1
125
153
  description:
126
154
  email:
127
155
  - me@duckie.co
@@ -147,6 +175,7 @@ files:
147
175
  - lib/how_is/analyzer.rb
148
176
  - lib/how_is/chart.rb
149
177
  - lib/how_is/fetcher.rb
178
+ - lib/how_is/pulse.rb
150
179
  - lib/how_is/report.rb
151
180
  - lib/how_is/report/html.rb
152
181
  - lib/how_is/report/json.rb
@@ -173,8 +202,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
202
  version: '0'
174
203
  requirements: []
175
204
  rubyforge_project:
176
- rubygems_version: 2.5.1
205
+ rubygems_version: 2.6.3
177
206
  signing_key:
178
207
  specification_version: 4
179
208
  summary: Quantify the health of a GitHub repository is.
180
209
  test_files: []
210
+ has_rdoc: