how_is 5.0.0 → 6.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a775e265a8f9fd63ee19be53d95b24938e15d137
4
- data.tar.gz: 199b882343ecc55d904e50c4b8b54b98e476a6df
3
+ metadata.gz: 417f8bf34cc439c2d30a35ddef05a57bd8f91605
4
+ data.tar.gz: acb4d660e2b52c831d6f43519c5859a25e6254f1
5
5
  SHA512:
6
- metadata.gz: 47cfe1ea6fe78379106597d910558d35a8226876af48f2ae520ee309146c30c966927c8882ff192f20e9db3d436402293773fbda55d11d5248ce485b248d5269
7
- data.tar.gz: b26c0c29ba44adb57335c302638704ff66f9de7b76d65d7092ef2ebbc32aaf1213b343b8d9c80a8800d1cf0a5fbc3015ef0cb2c7e8b652b98936a446f98643b3
6
+ metadata.gz: aa4ccd0b26c542676702e4b8cf437c2166729186cb67945da5ed1a47fa85f6dbb112ecdfb90114f69f21d02f2ba1329e95629caa9ab327891ce4eca74af66de1
7
+ data.tar.gz: e66e43791f6febae0884820cee777d04723fdf6b74c529e6c929d48eb4b87d285d7e632b1c66a3d316626cfc818f4da1d208f07805dc8a0e3b3ca66bbab3421a
data/.gitignore CHANGED
@@ -12,3 +12,4 @@ report.json
12
12
  report.html
13
13
  *.dat
14
14
  *.png
15
+ Thumbs.db
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/README.md CHANGED
@@ -32,6 +32,34 @@ E.g.,
32
32
 
33
33
  The above command creates a PDF containing the summary at `./report.pdf`.
34
34
 
35
+ ### Generating reports from a config file
36
+
37
+ Beyond the above, you can also create a config file — typically called
38
+ how_is.yml — and run `how_is --config YAML_CONFIG_FILE`. If your config
39
+ file is called how_is.yml, you can just run `how_is --config`.
40
+
41
+ You can see [the how_is.yml in the how-is-rubygems repository](https://github.com/how-is/how-is-rubygems/blob/gh-pages/how_is.yml)
42
+ for an example.
43
+
44
+ The config file is a YAML file. The two root keys are `repository` (the
45
+ repository name, of format USER_OR_ORG/REPOSITORY — e.g. how-is/how_is)
46
+ and `reports`.
47
+
48
+ `reports` is a hash of key/value pairs, with the keys being the type of report
49
+ ("html", "pdf", or "json") and the values being another hash.
50
+
51
+ That hash can have the following keys: `directory` (the directory to place the
52
+ report in), `filename` (the format string for filenames), and (optionally)
53
+ `frontmatter`.
54
+
55
+ `frontmatter` is a set of key/value pairs specifying frontmatter as used by
56
+ various blog engines (e.g. Jekyll), so you can set title, layout, etc.
57
+
58
+ Every value under `reports` is a format string, so you can do e.g.
59
+ `filename: "%{date}-report.html"` or (under `frontmatter`)
60
+ `title: "%{date} Report"`.
61
+
62
+
35
63
  ## Development
36
64
 
37
65
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec how_is` to use the gem in this directory, ignoring other installed copies of this gem.
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/exe/how_is CHANGED
@@ -7,6 +7,8 @@ options = {
7
7
  repository: nil,
8
8
  report_file: "report.pdf",
9
9
  from_file: nil,
10
+ use_config_file: false,
11
+ config_file: nil,
10
12
  }
11
13
 
12
14
  opts = OptionParser.new do |opts|
@@ -29,6 +31,11 @@ opts = OptionParser.new do |opts|
29
31
  exit 0
30
32
  end
31
33
 
34
+ opts.on("--config [YAML_CONFIG_FILE]", "generate reports as specified in YAML_CONFIG_FILE") do |file|
35
+ options[:use_config_file] = true
36
+ options[:config_file] = file
37
+ end
38
+
32
39
  opts.on("--from JSON_REPORT_FILE", "import JSON_REPORT_FILE instead of fetching the data again") do |file|
33
40
  options[:from_file] = file
34
41
  end
@@ -39,6 +46,12 @@ opts = OptionParser.new do |opts|
39
46
  end
40
47
  opts.parse!
41
48
 
49
+ if options[:use_config_file]
50
+ HowIs::CLI.new.from_config_file(options[:config_file])
51
+ exit
52
+ end
53
+
54
+
42
55
  unless HowIs.can_export_to?(options[:report_file])
43
56
  abort "Invalid file: #{options[:report_file]}. Supported formats: #{HowIs.supported_formats.join(', ')}"
44
57
  end
data/lib/how_is/cli.rb ADDED
@@ -0,0 +1,92 @@
1
+ require 'how_is'
2
+ require 'yaml'
3
+ require 'contracts'
4
+ require 'stringio'
5
+
6
+ C = Contracts
7
+
8
+ class HowIs::CLI
9
+ include Contracts::Core
10
+
11
+ DEFAULT_CONFIG_FILE = 'how_is.yml'
12
+
13
+ # Generates YAML frontmatter, as is used in Jekyll and other blog engines.
14
+ #
15
+ # E.g.,
16
+ # generate_frontmatter({'foo' => "bar %{baz}"}, {'baz' => "asdf"})
17
+ # => "---\nfoo: bar asdf\n"
18
+ Contract C::HashOf[C::Or[String, Symbol] => String],
19
+ C::HashOf[C::Or[String, Symbol] => C::Any] => String
20
+ def generate_frontmatter(frontmatter, report_data)
21
+ frontmatter = convert_keys(frontmatter, :to_s)
22
+ report_data = convert_keys(report_data, :to_sym)
23
+
24
+ frontmatter = frontmatter.map { |k, v|
25
+ v = v % report_data
26
+
27
+ [k, v]
28
+ }.to_h
29
+
30
+ YAML.dump(frontmatter)
31
+ end
32
+
33
+ def from_config_file(config_file = nil, **kwargs)
34
+ config_file ||= DEFAULT_CONFIG_FILE
35
+
36
+ from_config(YAML.load_file(config_file), **kwargs)
37
+ end
38
+
39
+ def from_config(config,
40
+ github: nil,
41
+ report_class: nil)
42
+ report_class ||= HowIs::Report
43
+
44
+ date = Date.strptime(Time.now.to_i.to_s, '%s')
45
+ date_string = date.strftime('%Y-%m-%d')
46
+ friendly_date = date.strftime('%B %d, %y')
47
+
48
+ analysis = HowIs.generate_analysis(repository: config['repository'], github: github)
49
+
50
+ report_data = {
51
+ repository: config['repository'],
52
+ date: date,
53
+ friendly_date: friendly_date,
54
+ }
55
+
56
+ config['reports'].map do |format, report_config|
57
+ filename = report_config['filename'] % report_data
58
+ file = File.join(report_config['directory'], filename)
59
+
60
+ report = report_class.export(analysis, format)
61
+
62
+ result = build_report(report_config['frontmatter'], report_data, report)
63
+
64
+ File.open(file, 'w') do |f|
65
+ f.puts result
66
+ end
67
+
68
+ result
69
+ end
70
+ end
71
+
72
+ def build_report(frontmatter, report_data, report)
73
+ str = StringIO.new
74
+
75
+ if frontmatter
76
+ str.puts generate_frontmatter(frontmatter, report_data)
77
+ str.puts "---"
78
+ str.puts
79
+ end
80
+
81
+ str.puts report
82
+
83
+ str.string
84
+ end
85
+
86
+ private
87
+ # convert_keys({'foo' => 'bar'}, :to_sym)
88
+ # => {:foo => 'bar'}
89
+ def convert_keys(data, method_name)
90
+ data.map {|k, v| [k.send(method_name), v]}.to_h
91
+ end
92
+ end
@@ -1,3 +1,3 @@
1
1
  module HowIs
2
- VERSION = "5.0.0"
2
+ VERSION = "6.0.0"
3
3
  end
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: 5.0.0
4
+ version: 6.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-21 00:00:00.000000000 Z
11
+ date: 2016-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: github_api
@@ -174,6 +174,7 @@ files:
174
174
  - lib/how_is.rb
175
175
  - lib/how_is/analyzer.rb
176
176
  - lib/how_is/chart.rb
177
+ - lib/how_is/cli.rb
177
178
  - lib/how_is/fetcher.rb
178
179
  - lib/how_is/pulse.rb
179
180
  - lib/how_is/report.rb
@@ -202,8 +203,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
203
  version: '0'
203
204
  requirements: []
204
205
  rubyforge_project:
205
- rubygems_version: 2.5.1
206
+ rubygems_version: 2.6.3
206
207
  signing_key:
207
208
  specification_version: 4
208
209
  summary: Quantify the health of a GitHub repository is.
209
210
  test_files: []
211
+ has_rdoc: