bundler-updater 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
+ SHA1:
3
+ metadata.gz: b5db1cca0b6f4dfd17c24b9cdc8760705d110727
4
+ data.tar.gz: 0550670e20707290d4ef2bfc70e6949e7eef5a70
5
+ SHA512:
6
+ metadata.gz: 340fb48193b2fa2a97bb3c122fc4b466fac4af68baff5d2a73f5b17a57adf6df21ce1732bad58ceb7dee77b0606d59e7ad6cd45602bc4ff231ac71ff9a71907a
7
+ data.tar.gz: aa061f5fa1da49a445739a3b1f7fdbc79e1cceb4b9580f4c9f83552e50fa5ba31ee58f75805efee1b1f2c58c05288b19f0720a331131934c69a0d520ef321a98
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bundler-updater.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Ryan Sonnek
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # Bundler::Updater
2
+ > Updating your entire bundle is dangerous.
3
+ > Updating your gems one at a time is tedious.
4
+
5
+ bundler-updater interactively walks you through updating outdated gems
6
+ and gives you the power to choose what gems to update.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ $ gem install bundler-updater
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ Execute `bundler-updater` command and respond to prompts for
17
+ selecting what gems to update.
18
+
19
+ ```bash
20
+ $ bundler-updater
21
+ > Update my_gem from 0.0.1 to 0.0.2? (y/n) y
22
+ > Update another_gem from 1.0.0 to 2.0.0? (y/n) n
23
+ >
24
+ > Updating my_gem...
25
+ ```
26
+
27
+ ## TODO
28
+ Contribute this gem to core bundler gem as an enhancement to the core bundler project.
29
+
30
+ ```bash
31
+ $ bundle update --interactive
32
+ ```
33
+
34
+ ## Contributing
35
+
36
+ 1. Fork it ( https://github.com/[my-github-username]/bundler-updater/fork )
37
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
38
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
39
+ 4. Push to the branch (`git push origin my-new-feature`)
40
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/bundler/updater/cli'
4
+ Bundler::Updater::CLI.start(ARGV)
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bundler/updater/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bundler-updater"
8
+ spec.version = Bundler::Updater::VERSION
9
+ spec.authors = ["Ryan Sonnek"]
10
+ spec.email = ["ryan@codecrate.com"]
11
+ spec.summary = %q{Helper script to intelligently update your Gemfile}
12
+ spec.description = %q{Don't update *all* of your gems at once.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency 'thor'
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.7"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency 'rspec'
26
+ spec.add_development_dependency 'pry'
27
+ end
@@ -0,0 +1,72 @@
1
+ require 'thor'
2
+
3
+ module Bundler
4
+ module Updater
5
+ class CLI < Thor::Group
6
+ desc "Update outdated gems interactively"
7
+ def update
8
+ say "No outdated gems to update" if outdated_gems_to_update.empty?
9
+ outdated_gems_to_update.each do |gem_name|
10
+ say "Updating #{gem_name}..."
11
+ `bundle update #{gem_name}`
12
+ end
13
+ end
14
+
15
+ private
16
+
17
+ # see bundler/lib/bundler/cli/outdated.rb
18
+ def outdated_gems_to_update
19
+ @gems_to_update ||= begin
20
+ gems_to_update = []
21
+
22
+ all_gem_specs.each do |current_spec|
23
+ active_spec = bundle_spec(current_spec)
24
+ next if active_spec.nil?
25
+
26
+ if spec_outdated?(current_spec, active_spec)
27
+ spec_version = "#{active_spec.version}#{active_spec.git_version}"
28
+ current_version = "#{current_spec.version}#{current_spec.git_version}"
29
+
30
+ if yes?("Update #{active_spec.name} from #{current_version} to #{spec_version}? (y/n)")
31
+ gems_to_update << active_spec.name
32
+ end
33
+ end
34
+ end
35
+ gems_to_update
36
+ end
37
+ end
38
+
39
+ def spec_outdated?(current_spec, active_spec)
40
+ gem_outdated = Gem::Version.new(active_spec.version) > Gem::Version.new(current_spec.version)
41
+ git_outdated = current_spec.git_version != active_spec.git_version
42
+
43
+ gem_outdated || git_outdated
44
+ end
45
+
46
+ def bundle_spec(current_spec)
47
+ active_spec = bundle_definition.index[current_spec.name].sort_by { |b| b.version }
48
+ if !current_spec.version.prerelease? && !options[:pre] && active_spec.size > 1
49
+ active_spec = active_spec.delete_if { |b| b.respond_to?(:version) && b.version.prerelease? }
50
+ end
51
+ active_spec.last
52
+ end
53
+
54
+ def all_gem_specs
55
+ current_specs = Bundler.ui.silence { Bundler.load.specs }
56
+ current_dependencies = {}
57
+ Bundler.ui.silence { Bundler.load.dependencies.each { |dep| current_dependencies[dep.name] = dep } }
58
+ gemfile_specs, dependency_specs = current_specs.partition { |spec| current_dependencies.has_key? spec.name }
59
+ [gemfile_specs.sort_by(&:name), dependency_specs.sort_by(&:name)].flatten
60
+ end
61
+
62
+ def bundle_definition
63
+ @definition ||= begin
64
+ Bundler.definition.validate_ruby!
65
+ definition = Bundler.definition(true)
66
+ definition.resolve_remotely!
67
+ definition
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,5 @@
1
+ module Bundler
2
+ module Updater
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ require "bundler/updater/version"
2
+
3
+ module Bundler
4
+ module Updater
5
+ # Your code goes here...
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,125 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bundler-updater
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Sonnek
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Don't update *all* of your gems at once.
84
+ email:
85
+ - ryan@codecrate.com
86
+ executables:
87
+ - bundler-updater
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - Gemfile
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
96
+ - bin/bundler-updater
97
+ - bundler-updater.gemspec
98
+ - lib/bundler/updater.rb
99
+ - lib/bundler/updater/cli.rb
100
+ - lib/bundler/updater/version.rb
101
+ homepage: ''
102
+ licenses:
103
+ - MIT
104
+ metadata: {}
105
+ post_install_message:
106
+ rdoc_options: []
107
+ require_paths:
108
+ - lib
109
+ required_ruby_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ requirements: []
120
+ rubyforge_project:
121
+ rubygems_version: 2.2.2
122
+ signing_key:
123
+ specification_version: 4
124
+ summary: Helper script to intelligently update your Gemfile
125
+ test_files: []