bundler-changelogs 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7c318b9f2474221ae1926a065c181c994a5539d6c9a6e7821d743cfb62a0fa95
4
+ data.tar.gz: 4101c7fbef0398eeeeb92adb2cf057669b3153f5e1eba692f338448310311c3e
5
+ SHA512:
6
+ metadata.gz: 47df55d41bf5e20e9891666e909a1313a6fc19fb97960932c0556881de7a9f86ed64f96ebf00bf953a8bff2e241b3d98b54f64672cda3677d7d796aa7a1f69d7
7
+ data.tar.gz: 0d18f97b167a973f2d768168c34adee085d4f841b437aa07191c1465f7f72ac7f107e94b4024b005d1cfb1427ec173f9257bde1a740864887359f663bc53b4da
@@ -0,0 +1,58 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ bundler-changelogs (0.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.0)
10
+ coderay (1.1.2)
11
+ docile (1.3.1)
12
+ jaro_winkler (1.5.1)
13
+ json (2.1.0)
14
+ method_source (0.9.2)
15
+ minitest (5.11.3)
16
+ net-ssh (5.0.2)
17
+ parallel (1.12.1)
18
+ parser (2.5.3.0)
19
+ ast (~> 2.4.0)
20
+ powerpack (0.1.2)
21
+ pry (0.12.2)
22
+ coderay (~> 1.1.0)
23
+ method_source (~> 0.9.0)
24
+ rainbow (3.0.0)
25
+ rake (12.3.1)
26
+ rubocop (0.60.0)
27
+ jaro_winkler (~> 1.5.1)
28
+ parallel (~> 1.10)
29
+ parser (>= 2.5, != 2.5.1.1)
30
+ powerpack (~> 0.1)
31
+ rainbow (>= 2.2.2, < 4.0)
32
+ ruby-progressbar (~> 1.7)
33
+ unicode-display_width (~> 1.4.0)
34
+ ruby-progressbar (1.10.0)
35
+ simplecov (0.16.1)
36
+ docile (~> 1.1)
37
+ json (>= 1.8, < 3)
38
+ simplecov-html (~> 0.10.0)
39
+ simplecov-html (0.10.2)
40
+ tiny_struct (0.0.1)
41
+ unicode-display_width (1.4.0)
42
+
43
+ PLATFORMS
44
+ ruby
45
+
46
+ DEPENDENCIES
47
+ bundler (~> 1.16)
48
+ bundler-changelogs!
49
+ minitest (~> 5.11)
50
+ net-ssh
51
+ pry
52
+ rake (~> 12.3)
53
+ rubocop (~> 0.58)
54
+ simplecov (~> 0.15)
55
+ tiny_struct
56
+
57
+ BUNDLED WITH
58
+ 1.16.6
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ Gemfile.lock
data/.rubocop.yml ADDED
@@ -0,0 +1,9 @@
1
+ AllCops:
2
+ DisplayCopNames: true
3
+ DisplayStyleGuide: true
4
+ TargetRubyVersion: 2.5
5
+ Exclude:
6
+ - 'vendor/**/*'
7
+
8
+ Style/Documentation:
9
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm: 2.5.1
3
+ cache: bundler
4
+ script: bundle exec rake && bundle exec rubocop
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ gem 'pry', group: :test
8
+ gem 'net-ssh', group: :foo
9
+ gem 'tiny_struct', group: :bar
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Kevin Deisz
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 ADDED
@@ -0,0 +1,25 @@
1
+ # Bundler::Changelogs
2
+
3
+ A bundler plugin that shows changelogs of your gem dependencies that specify changelog urls [not yet filtered to git version updates].
4
+
5
+ ## Installation
6
+
7
+ $ bundle plugin install bundler-changelogs
8
+
9
+ ## Usage
10
+
11
+ $ bundle changelogs
12
+
13
+ ## Development
14
+
15
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests.
16
+
17
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
18
+
19
+ ## Contributing
20
+
21
+ Bug reports and pull requests are welcome on GitHub at https://github.com/jdar/bundler-changelogs.
22
+
23
+ ## License
24
+
25
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rake/testtask'
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << 'test'
8
+ t.libs << 'lib'
9
+ t.test_files = FileList['test/**/*_test.rb']
10
+ end
11
+
12
+ task default: :test
data/bin/changelogs ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'bundler/changelogs'
6
+
7
+ #TODO: call exec
data/bin/rubocop ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rubocop' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ bundle_binstub = File.expand_path('bundle', __dir__)
12
+ load(bundle_binstub) if File.file?(bundle_binstub)
13
+
14
+ require 'pathname'
15
+ ENV['BUNDLE_GEMFILE'] ||=
16
+ File.expand_path('../../Gemfile', Pathname.new(__FILE__).realpath)
17
+
18
+ require 'rubygems'
19
+ require 'bundler/setup'
20
+
21
+ load Gem.bin_path('rubocop', 'rubocop')
data/bin/setup ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'bundler/changelogs/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'bundler-changelogs'
9
+ spec.version = Bundler::Changelogs::VERSION
10
+ spec.authors = ['Darius Roberts']
11
+ spec.email = ['darius.roberts@gmail.com']
12
+
13
+ spec.summary = 'A bundler plugin that shows changelogs of ' \
14
+ 'your gem dependencies that specify changelog urls [not yet filtered to git version updates].'
15
+ spec.homepage = 'https://github.com/jdar/bundler-changelogs'
16
+ spec.license = 'MIT'
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
+ f.match(%r{^(test|spec|features)/})
20
+ end
21
+ spec.bindir = 'exe'
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ['lib']
24
+
25
+ spec.add_development_dependency 'bundler', '~> 1.16'
26
+ spec.add_development_dependency 'minitest', '~> 5.11'
27
+ spec.add_development_dependency 'rake', '~> 12.3'
28
+ spec.add_development_dependency 'rubocop', '~> 0.58'
29
+ spec.add_development_dependency 'simplecov', '~> 0.15'
30
+ end
@@ -0,0 +1,110 @@
1
+ # frozen_string_literal: true
2
+ require 'stringio'
3
+ require 'pathname'
4
+ require 'fileutils'
5
+ require 'bundler/changelogs/version'
6
+
7
+ module Bundler
8
+ module Changelogs
9
+ class Command
10
+ Plugin::API.command('changelogs', self)
11
+ attr_accessor :current_lockfile_parsed
12
+ attr_accessor :previous_lockfile_parsed
13
+
14
+ # Justification for not using gems.locked
15
+ # need a callback in lifecycle to ensure non-git-managed-locks populate a git-managed file
16
+ ::Bundler::Plugin.add_hook('after-install-all') do |dependencies|
17
+ FileUtils.cp Bundler.default_lockfile, '.changelogs_gems.locked'
18
+ end
19
+
20
+ def exec(_name, args)
21
+ if args.any?
22
+ Bundler.require(:default, *args.map!(&:to_sym))
23
+ else
24
+ Bundler.require
25
+ end
26
+
27
+ current_lockfile = '.changelogs_gems.locked'
28
+ previous_lockfile_content = `git show #{Bundler.settings[:changlog_commit] || "HEAD"}:#{current_lockfile}`
29
+
30
+ self.current_lockfile_parsed = Bundler::LockfileParser.new(Bundler.read_file(current_lockfile))
31
+ self.previous_lockfile_parsed = Bundler::LockfileParser.new(previous_lockfile_content)
32
+
33
+ ARGV.clear
34
+ gems = get_gems_with_changelogs
35
+ binding.pry
36
+ if gems.empty?
37
+ Bundler.ui.error("Up to date. Nothing to show. Or: you already commmited the bundle changes to git? You can specify a range of git commits like this: TODO")
38
+ return
39
+ end
40
+
41
+ io = StringIO.new
42
+ write_changelog_output!(gems,io)
43
+ io.rewind
44
+
45
+ changelog_output_path = Bundler.settings[:changelog_output_path]
46
+ if changelog_output_path
47
+ path = Pathname.new(changelog_output_path)
48
+ path.open("w+"){|f| f.puts io.read }
49
+
50
+ #TODO: how to get CWD, crossplatform? Then, remove this verbosity.
51
+ #TODO: other than error...
52
+ Bundler.ui.info("Changelogs written to: #{path}")
53
+ else
54
+ Bundler.ui.info(io.read)
55
+ end
56
+
57
+ end
58
+
59
+ require 'pry'
60
+ private
61
+
62
+ def gems_excluding_bundler_plugins
63
+ current_lockfile_parsed.dependencies.map do |token, dep|
64
+ #TODO: next if dep is a plugin
65
+
66
+ #don't bother showing changelogs unless it's a named gemfile AND it's an update (we shouldn't care about whole new named gems.)
67
+ next unless previous_lockfile_parsed.dependencies[token]
68
+
69
+ token
70
+ end.compact
71
+ end
72
+
73
+ def get_gems_with_changelogs
74
+ gems = []
75
+ for name in gems_excluding_bundler_plugins
76
+ require name
77
+ gem_obj = get_constant(name)
78
+ if gem_obj[:changelog]
79
+ #TODO: filter changelog string.
80
+ #applicable_changelog_text = ...
81
+ #if applicable_changelog_text.to_s.length > 0
82
+ gems << gem_obj
83
+ #end
84
+ else
85
+ Bundler.ui.error("Skipping #{name}. Found gem, but no changelog is formally specified. But you can poke around yourself: TODO, path to repo for #{name}.")
86
+ end
87
+ end
88
+ gems
89
+ rescue LoadError
90
+ Bundler.ui.error("Skipping #{name}. Couldn't load gem and therefore could not find a changlog.")
91
+ end
92
+
93
+ def write_changelog_output!(gems,io)
94
+ for gem_obj in gems
95
+ #TODO: if gem_obj is a simpledelegate, just ask for the precomputed diff
96
+ io.puts(gem_obj[:changelog])
97
+ end
98
+ nil
99
+ end
100
+
101
+
102
+ def get_constant(name)
103
+ Object.const_get(name)
104
+ rescue NameError
105
+ Bundler.ui.error("Could not find constant #{name}")
106
+ exit 1
107
+ end
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ module Changelogs
5
+ VERSION = '0.0.1'
6
+ end
7
+ end
data/plugins.rb ADDED
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/changelogs'
metadata ADDED
@@ -0,0 +1,130 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bundler-changelogs
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Darius Roberts
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-11-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.11'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.11'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '12.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '12.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.58'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.58'
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.15'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.15'
83
+ description:
84
+ email:
85
+ - darius.roberts@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".changelogs_gems.locked"
91
+ - ".gitignore"
92
+ - ".rubocop.yml"
93
+ - ".travis.yml"
94
+ - Gemfile
95
+ - LICENSE
96
+ - README.md
97
+ - Rakefile
98
+ - bin/changelogs
99
+ - bin/rubocop
100
+ - bin/setup
101
+ - bundler-changelogs.gemspec
102
+ - lib/bundler/changelogs.rb
103
+ - lib/bundler/changelogs/version.rb
104
+ - plugins.rb
105
+ homepage: https://github.com/jdar/bundler-changelogs
106
+ licenses:
107
+ - MIT
108
+ metadata: {}
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ requirements: []
124
+ rubyforge_project:
125
+ rubygems_version: 2.7.6
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: A bundler plugin that shows changelogs of your gem dependencies that specify
129
+ changelog urls [not yet filtered to git version updates].
130
+ test_files: []