rbenv-migrate 0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4ecdf659d12926e87bfcb55be76aea2f76382e41c2b846d67edb2d4606f6705a
4
+ data.tar.gz: a0bd87a26684ef260fe59b2eabb8e2704eece12d2e601057787c9c091ea34e5d
5
+ SHA512:
6
+ metadata.gz: '0270908d16018af97ecab7c9a0014cb00e2fcae65958feb04e302c0b0f876f2a7a42390e2c8e5217d624e0e74a40154d86ce71975381b5ba10ba4f2f224466e3'
7
+ data.tar.gz: ce9295a66861ea8656c0cee0b04b66655d9e8551ccc7891f008009a867fbd00352a9173feb8e35f2fc2b5d5a7cf9dbd631106216c6bbbebdaab2c5fb6981749c
data/.gitignore ADDED
@@ -0,0 +1,28 @@
1
+ *.gem
2
+ /.config
3
+ /coverage/
4
+ /InstalledFiles
5
+ /pkg/
6
+ /spec/reports/
7
+ /spec/examples.txt
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Documentation cache and generated files:
13
+ /.yardoc/
14
+ /_yardoc/
15
+ /doc/
16
+ /rdoc/
17
+
18
+ ## Environment normalization:
19
+ /.bundle/
20
+ /vendor/bundle
21
+ /lib/bundler/man/
22
+ Gemfile.lock
23
+ .ruby-version
24
+ .ruby-gemset
25
+
26
+ # Temp Files
27
+ .ms.tmp/
28
+ *.tmp
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source "http://rubygems.org"
2
+ gemspec
data/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ # MIT License
2
+
3
+ Copyright © 2023 Vinny Diehl
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9
+ of the Software, and to permit persons to whom the Software is furnished to do
10
+ so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,9 @@
1
+ # `rbenv-migrate`
2
+
3
+ Ruby will allow you to require gems installed on a different version managed by
4
+ `rbenv`, however when you go to uninstall that Ruby version you will need to
5
+ re-install all of your gems. This little script transfers them automatically;
6
+ just run it from the Ruby version that you want to migrate *to*, and pass in
7
+ the version you wish to migrate *from* as an argument. It will check to see
8
+ which of those gems you don't have installed in your current version, and
9
+ transfer them if compatible.
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require "bundler"
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ task dist: :build
5
+ task default: :build
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1
data/bin/rbenv-migrate ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "rbenv_migrate"
4
+
5
+ RBEMigrate::CLI.new.run
@@ -0,0 +1,49 @@
1
+ require "optimist"
2
+ require "rubygems/commands/install_command"
3
+
4
+ module RBEMigrate
5
+ class CLI
6
+ def initialize
7
+ @options = Optimist::options do
8
+ version "rbenv-migrate #{File.read(File.expand_path("../../VERSION", __FILE__)).strip}"
9
+ banner self.version
10
+ banner "Usage:"
11
+ banner " rbenv-migrate OLD_VERSION"
12
+ banner "\nOptions:"
13
+ opt :version, "display version number"
14
+ opt :help, "display this message"
15
+ educate_on_error
16
+ end
17
+
18
+ Optimist::educate if ARGV.empty?
19
+
20
+ @old_version = ARGV.first
21
+ end
22
+
23
+ def run
24
+ old_gems = gemspecs_for @old_version
25
+ current_gems = gemspecs_for RUBY_VERSION
26
+
27
+ if (gems_to_install = old_gems - current_gems).any?
28
+ command = Gem::Commands::InstallCommand.new.tap { |c| c.handle_options gems_to_install }
29
+ else
30
+ puts "Your gems in #{RUBY_VERSION} appear to be up-to-date with #{@old_version}."
31
+ exit
32
+ end
33
+
34
+ begin
35
+ command.execute
36
+ rescue Gem::SystemExitException
37
+ # Done
38
+ nil
39
+ end
40
+ end
41
+
42
+ private
43
+
44
+ def gemspecs_for(version)
45
+ gemspecs = "#{ENV['RBENV_ROOT']}/versions/#{version}/lib/ruby/gems/*/specifications/*.gemspec"
46
+ Dir.glob(File.join gemspecs).map { |s| Gem::Specification.load(s).name }
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,22 @@
1
+ Gem::Specification.new do |gem|
2
+ gem.name = "rbenv-migrate"
3
+ gem.version = File.read(File.expand_path("../VERSION", __FILE__)).strip
4
+
5
+ gem.author = "Vinny Diehl"
6
+ gem.email = "vinny.diehl@gmail.com"
7
+ gem.homepage = "https://github.com/vinnydiehl/rbenv-migrate"
8
+
9
+ gem.license = "MIT"
10
+
11
+ gem.summary = "Transfer your gems from old rbenv installs."
12
+ gem.description = "Installs all of your gems from an old version of Ruby so that you may uninstall it."
13
+
14
+ gem.bindir = "bin"
15
+ gem.executables = %w[rbenv-migrate]
16
+ gem.require_paths = %w[lib]
17
+ gem.files = `git ls-files -z`.split "\x0"
18
+
19
+ gem.required_ruby_version = "~> 3.0"
20
+
21
+ gem.add_dependency "optimist", "~> 3.0"
22
+ end
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rbenv-migrate
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Vinny Diehl
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-04-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: optimist
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ description: Installs all of your gems from an old version of Ruby so that you may
28
+ uninstall it.
29
+ email: vinny.diehl@gmail.com
30
+ executables:
31
+ - rbenv-migrate
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - ".gitignore"
36
+ - Gemfile
37
+ - LICENSE.md
38
+ - README.md
39
+ - Rakefile
40
+ - VERSION
41
+ - bin/rbenv-migrate
42
+ - lib/rbenv_migrate.rb
43
+ - rbenv-migrate.gemspec
44
+ homepage: https://github.com/vinnydiehl/rbenv-migrate
45
+ licenses:
46
+ - MIT
47
+ metadata: {}
48
+ post_install_message:
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: '3.0'
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubygems_version: 3.4.10
64
+ signing_key:
65
+ specification_version: 4
66
+ summary: Transfer your gems from old rbenv installs.
67
+ test_files: []