gem_uppity 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 515841b01f59886f6cc51a3ff913837a4e872c19673b0a861186637f097f42cb
4
+ data.tar.gz: 1f6dd268f1476c488dc053e49548787bb0090904e93a4e427de0b6f3c35a63dc
5
+ SHA512:
6
+ metadata.gz: 9e763667278d4e759f53a7313a74a77b7be851dc87709c4f57c41bcef3ef426b97afe5b65760ce064f2d925d18444a4356644b894fd546f6617d47b88ef55fa0
7
+ data.tar.gz: f99a3c1aa195d1ce6232e1cf88b14f6859dff9c938d9cab045cb3e95dfd8a487e8230e173dd62369a81e5633e459d530947a38ad577af0af21de4f698417c9fb
@@ -0,0 +1,37 @@
1
+ version: 2
2
+ jobs:
3
+ build:
4
+ working_directory: ~/gem_uppity
5
+ docker:
6
+ - image: circleci/ruby:2.6.3-node
7
+ steps:
8
+ - checkout
9
+
10
+ - type: cache-restore
11
+ name: Restore bundle cache
12
+ key: gem-uppity-bundle-{{ checksum "Gemfile.lock" }}
13
+
14
+ - run:
15
+ name: Configure Bundler
16
+ command: |
17
+ echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV
18
+ source $BASH_ENV
19
+ gem install bundler
20
+
21
+ - run:
22
+ name: Bundle Install
23
+ command: bundle install --path vendor/bundle
24
+
25
+ - type: cache-save
26
+ name: Store bundle cache
27
+ key: gem-uppity-bundle-{{ checksum "Gemfile.lock" }}
28
+ paths:
29
+ - vendor/bundle
30
+
31
+ - run:
32
+ name: Rubocop
33
+ command: bundle exec rubocop
34
+
35
+ - run:
36
+ name: Run Rspec specs
37
+ command: bundle exec rspec
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ .byebug_history
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,104 @@
1
+ # This is the configuration used to check the rubocop source code.
2
+
3
+ require:
4
+ - rubocop/cop/internal_affairs
5
+ - rubocop-rspec
6
+
7
+ AllCops:
8
+ Exclude:
9
+ - 'vendor/**/*'
10
+ - 'spec/fixtures/**/*'
11
+ - 'tmp/**/*'
12
+ TargetRubyVersion: 2.6
13
+
14
+ Naming/PredicateName:
15
+ # Method define macros for dynamically generated method.
16
+ MethodDefinitionMacros:
17
+ - define_method
18
+ - define_singleton_method
19
+ - def_node_matcher
20
+ - def_node_search
21
+
22
+ Style/FrozenStringLiteralComment:
23
+ EnforcedStyle: always
24
+
25
+ Style/FormatStringToken:
26
+ # Because we parse a lot of source codes from strings. Percent arrays
27
+ # look like unannotated format string tokens to this cop.
28
+ Exclude:
29
+ - spec/**/*
30
+
31
+ Style/IpAddresses:
32
+ # The test for this cop includes strings that would cause offenses
33
+ Exclude:
34
+ - spec/rubocop/cop/style/ip_addresses_spec.rb
35
+
36
+ Layout/EndOfLine:
37
+ EnforcedStyle: lf
38
+
39
+ Layout/ClassStructure:
40
+ Enabled: true
41
+ Categories:
42
+ module_inclusion:
43
+ - include
44
+ - prepend
45
+ - extend
46
+ ExpectedOrder:
47
+ - module_inclusion
48
+ - constants
49
+ - public_class_methods
50
+ - initializer
51
+ - instance_methods
52
+ - protected_methods
53
+ - private_methods
54
+
55
+ Layout/IndentHeredoc:
56
+ EnforcedStyle: powerpack
57
+
58
+ # Trailing white space is meaningful in code examples
59
+ Layout/TrailingWhitespace:
60
+ AllowInHeredoc: true
61
+
62
+ Lint/AmbiguousBlockAssociation:
63
+ Exclude:
64
+ - 'spec/**/*.rb'
65
+
66
+ Lint/InterpolationCheck:
67
+ Exclude:
68
+ - 'spec/**/*.rb'
69
+
70
+ Lint/UselessAccessModifier:
71
+ MethodCreatingMethods:
72
+ - 'def_matcher'
73
+ - 'def_node_matcher'
74
+
75
+ Lint/BooleanSymbol:
76
+ Enabled: false
77
+
78
+ Metrics/AbcSize:
79
+ Max: 20
80
+
81
+ Metrics/CyclomaticComplexity:
82
+ Max: 10
83
+
84
+ Metrics/LineLength:
85
+ Enabled: false
86
+
87
+ Metrics/BlockLength:
88
+ Enabled: false
89
+
90
+ Metrics/ModuleLength:
91
+ Exclude:
92
+ - 'spec/**/*.rb'
93
+
94
+ RSpec/PredicateMatcher:
95
+ EnforcedStyle: inflected
96
+
97
+ RSpec/NestedGroups:
98
+ Max: 7
99
+
100
+ RSpec/MultipleExpectations:
101
+ Max: 2
102
+
103
+ RSpec/ExampleLength:
104
+ Enabled: false
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ gem_uppity
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.6.3
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.1
7
+ before_install: gem install bundler -v 2.0.1
@@ -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 tgourley@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/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
5
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,58 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ gem_uppity (0.1.0)
5
+ bundler (~> 2.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.0)
11
+ byebug (11.0.1)
12
+ diff-lcs (1.3)
13
+ irb (1.0.0)
14
+ jaro_winkler (1.5.2)
15
+ parallel (1.17.0)
16
+ parser (2.6.3.0)
17
+ ast (~> 2.4.0)
18
+ rainbow (3.0.0)
19
+ rake (12.3.2)
20
+ rspec (3.8.0)
21
+ rspec-core (~> 3.8.0)
22
+ rspec-expectations (~> 3.8.0)
23
+ rspec-mocks (~> 3.8.0)
24
+ rspec-core (3.8.0)
25
+ rspec-support (~> 3.8.0)
26
+ rspec-expectations (3.8.3)
27
+ diff-lcs (>= 1.2.0, < 2.0)
28
+ rspec-support (~> 3.8.0)
29
+ rspec-mocks (3.8.0)
30
+ diff-lcs (>= 1.2.0, < 2.0)
31
+ rspec-support (~> 3.8.0)
32
+ rspec-support (3.8.0)
33
+ rubocop (0.68.1)
34
+ jaro_winkler (~> 1.5.1)
35
+ parallel (~> 1.10)
36
+ parser (>= 2.5, != 2.5.1.1)
37
+ rainbow (>= 2.2.2, < 4.0)
38
+ ruby-progressbar (~> 1.7)
39
+ unicode-display_width (>= 1.4.0, < 1.6)
40
+ rubocop-rspec (1.32.0)
41
+ rubocop (>= 0.60.0)
42
+ ruby-progressbar (1.10.0)
43
+ unicode-display_width (1.5.0)
44
+
45
+ PLATFORMS
46
+ ruby
47
+
48
+ DEPENDENCIES
49
+ byebug (~> 11.0.1)
50
+ gem_uppity!
51
+ irb (~> 1.0.0)
52
+ rake (~> 12.3.2)
53
+ rspec (~> 3.8.0)
54
+ rubocop (~> 0.68.1)
55
+ rubocop-rspec (~> 1.32.0)
56
+
57
+ BUNDLED WITH
58
+ 2.0.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Tim Gourley
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,66 @@
1
+ # GemUppity
2
+
3
+ ![CircleCI branch](https://img.shields.io/circleci/project/github/bratta/gem_uppity/master.svg)
4
+ ![GitHub](https://img.shields.io/github/license/bratta/gem_uppity.svg)
5
+ ![GitHub issues](https://img.shields.io/github/issues/bratta/gem_uppity.svg)
6
+ ![Gem](https://img.shields.io/gem/v/gem_uppity.svg)
7
+
8
+ This gem is probably a bad idea.
9
+
10
+ The code needs love. It needs specs. It needs better ways of doing things like how it shells out to the `gem` command to search for the latest version of the gem on Rubyforge.
11
+
12
+ It works for my use case, but it might/will fail for you if your Gemfile is more complicated than the I designed this for.
13
+
14
+ This is a long way of saying that your mileage may vary.
15
+
16
+ ## Installation
17
+
18
+ Add this line to your application's Gemfile:
19
+
20
+ ```ruby
21
+ gem 'gem_uppity'
22
+ ```
23
+
24
+ And then execute:
25
+
26
+ $ bundle
27
+
28
+ Or install it yourself as:
29
+
30
+ $ gem install gem_uppity
31
+
32
+ ## Usage
33
+
34
+ You can call it with a path to a `Gemfile`:
35
+
36
+ ```bash
37
+ $ gem_uppity /path/to/Gemfile > Gemfile.new
38
+ ```
39
+
40
+ The `Gemfile` needs to have been used and a `Gemfile.lock` needs to have been generated by a call to `bundle install` beforehand.
41
+
42
+ Alternatively, you can navigate to the path beforehand:
43
+
44
+ ```bash
45
+ $ cd /path/to/my/bundler/project
46
+ $ gem_uppity > Gemfile.new
47
+ $
48
+ ```
49
+
50
+ ## Development
51
+
52
+ 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.
53
+
54
+ 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).
55
+
56
+ ## Contributing
57
+
58
+ Bug reports and pull requests are welcome on GitHub at https://github.com/bratta/gem_uppity. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
59
+
60
+ ## License
61
+
62
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
63
+
64
+ ## Code of Conduct
65
+
66
+ Everyone interacting in the GemUppity project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/bratta/gem_uppity/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
4
+ require 'bundler/setup'
5
+ require 'gem_uppity'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +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
data/exe/gem_uppity ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
4
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
5
+ require 'gem_uppity'
6
+
7
+ gu = GemUppity::Upper.new(ARGV[0])
8
+ gu.upgrade
@@ -0,0 +1,37 @@
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 'gem_uppity/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'gem_uppity'
9
+ spec.version = GemUppity::VERSION
10
+ spec.authors = ['Tim Gourley']
11
+ spec.email = ['tgourley@gmail.com']
12
+
13
+ spec.summary = 'Upgrade all gems in your Gemfile to the latest version on Rubyforge'
14
+ spec.description = 'Provides a starting point to modernizing an older Bundler-based ruby application'
15
+ spec.homepage = 'https://github.com/bratta/gem_uppity'
16
+ spec.license = 'MIT'
17
+
18
+ # Specify which files should be added to the gem when it is released.
19
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
21
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ end
23
+ spec.bindir = 'exe'
24
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
+ spec.require_paths = ['lib']
26
+
27
+ # Required Dependencies
28
+ spec.add_dependency 'bundler', '~> 2.0'
29
+
30
+ # Development Dependencies
31
+ spec.add_development_dependency 'byebug', '~> 11.0.1'
32
+ spec.add_development_dependency 'irb', '~> 1.0.0'
33
+ spec.add_development_dependency 'rake', '~> 12.3.2'
34
+ spec.add_development_dependency 'rspec', '~> 3.8.0'
35
+ spec.add_development_dependency 'rubocop', '~> 0.68.1'
36
+ spec.add_development_dependency 'rubocop-rspec', '~> 1.32.0'
37
+ end
data/lib/gem_uppity.rb ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rubygems'
4
+ require 'pathname'
5
+ require 'bundler'
6
+
7
+ require 'gem_uppity/version'
8
+ require 'gem_uppity/upper'
9
+
10
+ # Define the module namespace for this gem
11
+ module GemUppity
12
+ end
@@ -0,0 +1,126 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This code works but it needs some love to make it robust.
4
+ # It handles 90% of use cases but needs tests. There's also
5
+ # probably better ways to do some of the things, such as
6
+ # getting the latest version of a particular gem. Help me
7
+ # help you and submit a PR if you see any way to improve it!
8
+
9
+ require 'rubygems'
10
+ require 'pathname'
11
+ require 'bundler'
12
+
13
+ # This is where the magic happens
14
+ module GemUppity
15
+ # Upper Class; performs the upgrade
16
+ class Upper
17
+ attr_accessor :gemfile, :lockfile
18
+
19
+ def initialize(gemfile = nil)
20
+ @gemfile = gemfile || File.join(Dir.pwd, 'Gemfile')
21
+ @lockfile = "#{@gemfile}.lock"
22
+
23
+ raise IOError, 'Cannot find a valid Gemfile in the specified name or current directory' unless File.file?(@gemfile)
24
+ raise IOError, 'Cannot find a valid Gemfile.lock in the specified name or current directory' unless File.file?(@lockfile)
25
+ end
26
+
27
+ def upgrade
28
+ current_directory = Dir.pwd
29
+ pathname = Pathname.new(@gemfile)
30
+
31
+ Dir.chdir(pathname.dirname)
32
+ definition = Bundler::Definition.build(@gemfile, @lockfile, false)
33
+ print_header_for_definition(definition)
34
+ dependencies = grouped_dependencies(definition.dependencies)
35
+ print_grouped_dependencies(dependencies)
36
+ Dir.chdir(current_directory)
37
+ end
38
+
39
+ private
40
+
41
+ def print_header_for_definition(definition)
42
+ puts warning_comment
43
+ puts "\n"
44
+ puts "source 'https://rubygems.org'\n\n"
45
+ ruby_version = definition.ruby_version&.versions&.first
46
+ puts "ruby '#{ruby_version}'\n\n" if ruby_version
47
+ end
48
+
49
+ def grouped_dependencies(dependencies)
50
+ {}.tap do |group|
51
+ dependencies.each do |dependency|
52
+ group[dependency.groups] ? group[dependency.groups] << dependency : group[dependency.groups] = [dependency]
53
+ end
54
+ end
55
+ end
56
+
57
+ def print_grouped_dependencies(dependencies, spacing = '')
58
+ dependencies.keys.each do |group|
59
+ unless group == [:default]
60
+ puts "\ngroup :#{group.join(', :')} do"
61
+ spacing = ' '
62
+ end
63
+ dependencies[group].each do |dependency|
64
+ print_dependency_info(dependency, spacing)
65
+ end
66
+ puts 'end' unless group == [:default]
67
+ end
68
+ end
69
+
70
+ def print_dependency_info(dependency, spacing = '')
71
+ if dependency.source.is_a?(Bundler::Source::Git)
72
+ print_github_dependency(dependency, spacing)
73
+ else
74
+ print_basic_dependency(dependency, spacing)
75
+ end
76
+ end
77
+
78
+ def print_github_dependency(dependency, spacing = '')
79
+ puts "#{spacing}gem '#{dependency.name}',"
80
+ puts "#{spacing} git: '#{dependency.source.uri}',"
81
+ puts "#{spacing} branch: '#{dependency.source.branch}'"
82
+ end
83
+
84
+ def print_basic_dependency(dependency, spacing = '')
85
+ original_version_string = get_original_version_string(dependency)
86
+ version_string = original_version_string
87
+ version = latest_version_of(dependency.name)
88
+ version_string = "'~> #{version}'" if version
89
+ require_string = get_autorequire_string(dependency.autorequire)
90
+ puts "#{spacing}gem '#{dependency.name}', #{version_string}#{require_string} # #{original_version_string}"
91
+ end
92
+
93
+ def latest_version_of(gem_name)
94
+ output = `gem search --no-verbose -r ^#{gem_name}$`.chomp
95
+ matches = output.match(/^#{gem_name} \(([.\d]+).*\)$/)
96
+ matches && matches.length == 2 ? matches[1] : nil
97
+ end
98
+
99
+ def get_original_version_string(dependency)
100
+ versions = dependency.requirement.to_s.split(/,/)
101
+ versions.map { |version| "'#{version.to_s.strip}'" }.join(', ')
102
+ end
103
+
104
+ def get_autorequire_string(requires)
105
+ autorequire_string = ''
106
+ if requires
107
+ autorequire_string = requires.count.positive? ? ", require: '#{requires.join(', ')}'" : ', require: false'
108
+ end
109
+ autorequire_string
110
+ end
111
+
112
+ def warning_comment
113
+ <<~WARNING_COMMENT
114
+ # !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
115
+ # Gemfile generated by Gem Uppity
116
+ # -------------------------------
117
+ # Use at your own risk! This will attempt to use the latest
118
+ # version of gems in your Gemfile regardless of their current
119
+ # versions, formatting a new Gemfile with all versions specified
120
+ # where possible. Currently, gems specified with git repositories
121
+ # are left as-is.
122
+ # !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
123
+ WARNING_COMMENT
124
+ end
125
+ end
126
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Version number
4
+ module GemUppity
5
+ VERSION = '0.1.0'
6
+ end
metadata ADDED
@@ -0,0 +1,163 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gem_uppity
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Tim Gourley
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-05-09 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: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: byebug
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 11.0.1
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 11.0.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: irb
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.0.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 12.3.2
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 12.3.2
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 3.8.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 3.8.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.68.1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.68.1
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.32.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 1.32.0
111
+ description: Provides a starting point to modernizing an older Bundler-based ruby
112
+ application
113
+ email:
114
+ - tgourley@gmail.com
115
+ executables:
116
+ - gem_uppity
117
+ extensions: []
118
+ extra_rdoc_files: []
119
+ files:
120
+ - ".circleci/config.yml"
121
+ - ".gitignore"
122
+ - ".rspec"
123
+ - ".rubocop.yml"
124
+ - ".ruby-gemset"
125
+ - ".ruby-version"
126
+ - ".travis.yml"
127
+ - CODE_OF_CONDUCT.md
128
+ - Gemfile
129
+ - Gemfile.lock
130
+ - LICENSE.txt
131
+ - README.md
132
+ - Rakefile
133
+ - bin/console
134
+ - bin/setup
135
+ - exe/gem_uppity
136
+ - gem_uppity.gemspec
137
+ - lib/gem_uppity.rb
138
+ - lib/gem_uppity/upper.rb
139
+ - lib/gem_uppity/version.rb
140
+ homepage: https://github.com/bratta/gem_uppity
141
+ licenses:
142
+ - MIT
143
+ metadata: {}
144
+ post_install_message:
145
+ rdoc_options: []
146
+ require_paths:
147
+ - lib
148
+ required_ruby_version: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ required_rubygems_version: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ requirements: []
159
+ rubygems_version: 3.0.3
160
+ signing_key:
161
+ specification_version: 4
162
+ summary: Upgrade all gems in your Gemfile to the latest version on Rubyforge
163
+ test_files: []