bundler-stats 0.0.1 → 1.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 +4 -4
- data/CODE_OF_CONDUCT.md +74 -0
- data/MIT-LICENSE +20 -0
- data/README.md +53 -0
- data/lib/bundler/stats/calculator.rb +14 -3
- data/lib/bundler/stats/cli.rb +5 -2
- data/lib/bundler/stats/version.rb +1 -1
- data/spec/lib/bundler/stats/calculator_spec.rb +4 -2
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2759369de6f085751c3c523a46b935fe5a5d9ca6
|
4
|
+
data.tar.gz: 1889fbb9f46a05b076af3ce0522bcb32b811ac8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b500aed73652a0c28d8fc6558d96a37ebcf6b1c5df86b7ae5e7b335acd6326d122c7e101f99f46ae3e7c5954c10406bd0ad579a07a3c7e60093c6b701be3ac08
|
7
|
+
data.tar.gz: af29e97ae66a15ac098558f834d505e34286267be9ba9acf3650da791135a13b036b1c5cc1b69ade3c9d9e0d8a312a061f22736473070c31e5df0efca9f80d3b
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at jmmastey@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2016 Joseph Mastey
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
Bundler Stats
|
2
|
+
=============
|
3
|
+
|
4
|
+
You remember that time someone yanked their library and the entire Node
|
5
|
+
universe fell apart? Yeah, me too. And all the thinkpieces that came out just
|
6
|
+
aftward were right: you should be careful about what you include in your
|
7
|
+
project.
|
8
|
+
|
9
|
+
This project gives you some tools you can use with your existing Gemfile to
|
10
|
+
determine which gems are including long trees of data, and which you can
|
11
|
+
potentially remove.
|
12
|
+
|
13
|
+
Installation
|
14
|
+
------------
|
15
|
+
|
16
|
+
You don't need to include `bundler-stats` in your Gemfile, just
|
17
|
+
`gem install bundler-stats`. Unless you wanted to build automation around its
|
18
|
+
usage, in which case, add it to your Gemfile instead.
|
19
|
+
|
20
|
+
|
21
|
+
Usage
|
22
|
+
------------
|
23
|
+
|
24
|
+
> bundle-stats help
|
25
|
+
Commands:
|
26
|
+
bundle-stats help [COMMAND] # Describe available commands or one specific command
|
27
|
+
bundle-stats show TARGET # Prints the dependency tree for a single gem in your Gemfile
|
28
|
+
bundle-stats stats # Displays basic stats about the gems in your Gemfile
|
29
|
+
bundle-stats version # Prints the bundler-stats version
|
30
|
+
|
31
|
+
Or just run `bundle-stats` anywhere within your ruby project. You can emit JSON
|
32
|
+
for automatic consumption with `-f json`.
|
33
|
+
|
34
|
+
|
35
|
+
Contributing
|
36
|
+
------------
|
37
|
+
|
38
|
+
Contributions are very welcome. Fork, fix, submit pulls.
|
39
|
+
|
40
|
+
Contribution is expected to conform to the [Contributor Covenant](https://github.com/jmmastey/bundler-stats/blob/master/CODE_OF_CONDUCT.md).
|
41
|
+
|
42
|
+
|
43
|
+
Credits
|
44
|
+
-------
|
45
|
+
|
46
|
+
Thanks to the many kind people at [RailsCamp East 2016](http://east.railscamp.com)
|
47
|
+
for the help, the ideas, and the support.
|
48
|
+
|
49
|
+
|
50
|
+
License
|
51
|
+
-------
|
52
|
+
|
53
|
+
This software is released under the [MIT License](https://github.com/jmmastey/bundler-stats/blob/master/MIT-LICENSE).
|
@@ -9,7 +9,10 @@ module Bundler
|
|
9
9
|
raise ArgumentError unless File.readable?(lockfile_path)
|
10
10
|
raise ArgumentError unless File.readable?(gemfile_path)
|
11
11
|
|
12
|
-
@gemfile = Bundler::Dsl.new
|
12
|
+
@gemfile = Bundler::Dsl.new
|
13
|
+
@gemfile.eval_gemfile(gemfile_path)
|
14
|
+
@gemfile = @gemfile.dependencies
|
15
|
+
raise ArgumentError, "Couldn't parse Gemfile at #{gemfile_path.realdirpath}" unless @gemfile
|
13
16
|
|
14
17
|
lock_contents = File.read(lockfile_path)
|
15
18
|
@parser = Bundler::LockfileParser.new(lock_contents)
|
@@ -34,11 +37,19 @@ module Bundler
|
|
34
37
|
alias_method :to_h, :stats
|
35
38
|
|
36
39
|
def summary
|
37
|
-
{
|
38
|
-
|
40
|
+
{ declared: @gemfile.count,
|
41
|
+
unpinned: unpinned_gems.count,
|
42
|
+
total: @parser.specs.count,
|
43
|
+
github: github_gems.count,
|
39
44
|
}
|
40
45
|
end
|
41
46
|
|
47
|
+
def github_gems
|
48
|
+
@gemfile.select do |dep|
|
49
|
+
dep.source && dep.source.options.include?("github")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
42
53
|
def unpinned_gems
|
43
54
|
@gemfile.reject { |dep| dep.specific? }
|
44
55
|
end
|
data/lib/bundler/stats/cli.rb
CHANGED
@@ -54,8 +54,11 @@ module Bundler
|
|
54
54
|
end
|
55
55
|
say "+------------------------------|-----------------|-----------------+"
|
56
56
|
say ""
|
57
|
-
say "Declared Gems:
|
57
|
+
say "Declared Gems: #{summary[:declared]}"
|
58
|
+
say "Total Gems: #{summary[:total]}"
|
58
59
|
say ""
|
60
|
+
say "Unpinned Versions: #{summary[:unpinned]}"
|
61
|
+
say "Github Refs: #{summary[:github]}"
|
59
62
|
end
|
60
63
|
|
61
64
|
def draw_show(stats, target)
|
@@ -78,7 +81,7 @@ module Bundler
|
|
78
81
|
end
|
79
82
|
|
80
83
|
def gemfile_path
|
81
|
-
cwd = Pathname.new("
|
84
|
+
cwd = Pathname.new("./")
|
82
85
|
until cwd.realdirpath.root? do
|
83
86
|
return (cwd + "Gemfile") if File.exist?(cwd + "Gemfile")
|
84
87
|
cwd = cwd.parent
|
@@ -94,8 +94,10 @@ describe Bundler::Stats::Calculator do
|
|
94
94
|
target = calculator.summary
|
95
95
|
|
96
96
|
expect(target).to be_a(Hash)
|
97
|
-
expect(target).to include(:
|
98
|
-
expect(target).to include(:
|
97
|
+
expect(target).to include(:declared)
|
98
|
+
expect(target).to include(:total)
|
99
|
+
expect(target).to include(:unpinned)
|
100
|
+
expect(target).to include(:github)
|
99
101
|
end
|
100
102
|
end
|
101
103
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bundler-stats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joseph Mastey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -86,11 +86,16 @@ email: jmmastey@gmail.com
|
|
86
86
|
executables:
|
87
87
|
- bundle-stats
|
88
88
|
extensions: []
|
89
|
-
extra_rdoc_files:
|
89
|
+
extra_rdoc_files:
|
90
|
+
- CODE_OF_CONDUCT.md
|
91
|
+
- README.md
|
90
92
|
files:
|
91
93
|
- .gitignore
|
94
|
+
- CODE_OF_CONDUCT.md
|
92
95
|
- Gemfile
|
93
96
|
- Guardfile
|
97
|
+
- MIT-LICENSE
|
98
|
+
- README.md
|
94
99
|
- bin/bundle-stats
|
95
100
|
- bundler-stats.gemspec
|
96
101
|
- lib/bundler/stats.rb
|