organize_gemfile 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -3
- data/Gemfile.lock +1 -1
- data/Rakefile +3 -2
- data/exe/organize_gemfile +1 -1
- data/lib/organize_gemfile/builder.rb +2 -2
- data/lib/organize_gemfile/bundle_parser.rb +9 -2
- data/lib/organize_gemfile/gemfile_group.rb +10 -1
- data/lib/organize_gemfile/version.rb +1 -1
- data/lib/organize_gemfile.rb +14 -14
- metadata +6 -7
- data/organize_gemfile.gemspec +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22aa5242f1a189d3cddddb4b6086c50c89d948d18d6cb047dce073d3599399be
|
4
|
+
data.tar.gz: e4f5d8a161d25ee9368a22ec3c20761319702c130abd89462dcc708cf0a54a86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6dc94259988d8048341aaa16f096815b92b68fbe6715f6d0898496b1dc58b7c5fc6200c2c8d29d70d557928f1925f5b1f2873cd362442f7e9d4204960ecb10e2
|
7
|
+
data.tar.gz: 6e9e5390bc008577cdaed3fac08c4bc604e11b2a309bf2dd50242319b7d0b23cce999b15043e0e4072af1fae74156b2e3b6520394cbc4a6c3f546c15e0e15fa4
|
data/Gemfile
CHANGED
@@ -2,7 +2,7 @@ source "https://rubygems.org"
|
|
2
2
|
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
3
3
|
|
4
4
|
gem "minitest", "~> 5.0" # minitest provides a complete suite of testing facilities supporting TDD, BDD, mocking, and benchmarking
|
5
|
-
gem "organize_gemfile"
|
6
|
-
gem "rake", "~> 13.0"
|
5
|
+
gem "organize_gemfile" # Organize your Gemfile with annotations
|
6
|
+
gem "rake", "~> 13.0" # Rake is a Make-like program implemented in Ruby
|
7
7
|
gem "standard", "~> 1.3" # Ruby Style Guide, with linter & automatic code fixer
|
8
|
-
gem "bump", "~> 0.6"
|
8
|
+
gem "bump", "~> 0.6" # Bump is a command line tool to help you version your Ruby projects
|
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
@@ -21,12 +21,13 @@ task :build do
|
|
21
21
|
system "gem build #{GEM_NAME}.gemspec"
|
22
22
|
end
|
23
23
|
|
24
|
-
task :
|
24
|
+
task install: :build do
|
25
25
|
system "gem install #{GEM_NAME}-#{GEM_VERSION}.gem"
|
26
26
|
end
|
27
27
|
|
28
|
-
task :
|
28
|
+
task publish: :build do
|
29
29
|
system "gem push #{GEM_NAME}-#{GEM_VERSION}.gem"
|
30
|
+
system "gem push --key github --host https://rubygems.pkg.github.com/coderberry #{GEM_NAME}-#{GEM_VERSION}.gem"
|
30
31
|
end
|
31
32
|
|
32
33
|
task :clean do
|
data/exe/organize_gemfile
CHANGED
@@ -6,7 +6,7 @@ module OrganizeGemfile
|
|
6
6
|
@gemfile_path = gemfile_path
|
7
7
|
@ruby_version = ruby_version
|
8
8
|
@groups = groups
|
9
|
-
|
9
|
+
build
|
10
10
|
end
|
11
11
|
|
12
12
|
def build
|
@@ -45,4 +45,4 @@ module OrganizeGemfile
|
|
45
45
|
@groups["default"]
|
46
46
|
end
|
47
47
|
end
|
48
|
-
end
|
48
|
+
end
|
@@ -38,6 +38,13 @@ module OrganizeGemfile
|
|
38
38
|
spec = specs.key?(dep.name) ? specs[dep.name] : nil
|
39
39
|
spec = spec&.to_spec
|
40
40
|
|
41
|
+
version = dep.requirement.to_s
|
42
|
+
if version.nil? || version == "" || version == ">= 0"
|
43
|
+
if spec&.version
|
44
|
+
version = "~> #{spec.version}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
41
48
|
{
|
42
49
|
name: dep.name,
|
43
50
|
summary: spec&.summary,
|
@@ -47,10 +54,10 @@ module OrganizeGemfile
|
|
47
54
|
branch: dep.branch,
|
48
55
|
platforms: dep.platforms,
|
49
56
|
gemfile: dep.gemfile,
|
50
|
-
version:
|
57
|
+
version: version,
|
51
58
|
source: dep.source,
|
52
59
|
requires: @requires[dep.name],
|
53
|
-
appear_at_top:
|
60
|
+
appear_at_top: dep.name.include?("dotenv/rails-now")
|
54
61
|
}
|
55
62
|
end
|
56
63
|
end
|
@@ -20,6 +20,7 @@ module OrganizeGemfile
|
|
20
20
|
spec_lines = specs.sort_by { |s| s[:name] }.map do |spec|
|
21
21
|
parts = []
|
22
22
|
parts << "gem \"#{spec[:name]}\""
|
23
|
+
|
23
24
|
if spec[:version] && spec[:version] != ">= 0"
|
24
25
|
version_parts = []
|
25
26
|
spec[:version].split(",").each do |version|
|
@@ -27,8 +28,13 @@ module OrganizeGemfile
|
|
27
28
|
end
|
28
29
|
parts << version_parts.join(", ")
|
29
30
|
end
|
30
|
-
|
31
|
+
|
32
|
+
require_name = spec[:requires]&.first
|
33
|
+
if require_name != spec[:name] && !require_name.nil? && require_name != ""
|
34
|
+
parts << "require: \"#{require_name}\""
|
35
|
+
end
|
31
36
|
parts << "require: false" if spec[:requires] == []
|
37
|
+
parts << "path: \"#{spec[:source].path}\"" if spec[:source]
|
32
38
|
parts << "platforms: %i[ #{spec[:platforms].join(" ")} ]" if spec[:platforms].any?
|
33
39
|
line = parts.join(", ")
|
34
40
|
|
@@ -46,6 +52,9 @@ module OrganizeGemfile
|
|
46
52
|
if spec[:summary]
|
47
53
|
line = line.ljust(max_length)
|
48
54
|
line += " # #{spec[:summary]}"
|
55
|
+
if spec[:homepage]
|
56
|
+
line += " [#{spec[:homepage]}]"
|
57
|
+
end
|
49
58
|
end
|
50
59
|
lines << indent_spaces + line
|
51
60
|
end
|
data/lib/organize_gemfile.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require_relative
|
5
|
-
require_relative
|
6
|
-
require_relative
|
7
|
-
require
|
3
|
+
require_relative "organize_gemfile/bundle_parser"
|
4
|
+
require_relative "organize_gemfile/gemfile_group"
|
5
|
+
require_relative "organize_gemfile/builder"
|
6
|
+
require_relative "organize_gemfile/version"
|
7
|
+
require "optparse"
|
8
8
|
|
9
9
|
module OrganizeGemfile
|
10
10
|
class Error < StandardError
|
@@ -13,20 +13,20 @@ module OrganizeGemfile
|
|
13
13
|
def self.execute(*args)
|
14
14
|
options = parse_options(args)
|
15
15
|
|
16
|
-
gemfile_path = options[:gemfile] ||= File.expand_path(
|
16
|
+
gemfile_path = options[:gemfile] ||= File.expand_path("Gemfile")
|
17
17
|
unless File.exist?(gemfile_path)
|
18
18
|
puts "Gemfile not found at #{gemfile_path}"
|
19
19
|
return
|
20
20
|
end
|
21
21
|
|
22
|
-
gemfile_lock_path = Pathname.new(gemfile_path).parent.join(
|
22
|
+
gemfile_lock_path = Pathname.new(gemfile_path).parent.join("Gemfile.lock")
|
23
23
|
unless gemfile_lock_path.exist?
|
24
24
|
puts "Gemfile.lock not found at #{gemfile_lock_path}. Be sure to run `bundle install` before running this command."
|
25
25
|
return
|
26
26
|
end
|
27
27
|
|
28
|
-
gemfile_lock_path = File.expand_path(
|
29
|
-
raise
|
28
|
+
gemfile_lock_path = File.expand_path("Gemfile.lock")
|
29
|
+
raise "Gemfile.lock not found" unless File.exist?(gemfile_lock_path)
|
30
30
|
|
31
31
|
parser = BundleParser.new(gemfile_path, gemfile_lock_path)
|
32
32
|
ruby_version = parser.ruby_version
|
@@ -35,23 +35,23 @@ module OrganizeGemfile
|
|
35
35
|
Builder.new(gemfile_path, ruby_version: ruby_version, groups: groups)
|
36
36
|
revised_gemfile = builder.build
|
37
37
|
|
38
|
-
File.
|
38
|
+
File.write(gemfile_path, revised_gemfile)
|
39
39
|
|
40
|
-
puts
|
40
|
+
puts "Gemfile organized!"
|
41
41
|
end
|
42
42
|
|
43
43
|
def self.parse_options(args)
|
44
44
|
options = {}
|
45
45
|
|
46
46
|
opts = OptionParser.new
|
47
|
-
opts.banner =
|
47
|
+
opts.banner = "Usage: organize_gemfile [options]"
|
48
48
|
|
49
|
-
opts.on(
|
49
|
+
opts.on("-h", "--help", "Prints this help") do
|
50
50
|
puts opts
|
51
51
|
exit
|
52
52
|
end
|
53
53
|
|
54
|
-
opts.on(
|
54
|
+
opts.on("-gPATH", "--gemfile=PATH", "Path to Gemfile") do |path|
|
55
55
|
options[:gemfile] = File.expand_path(path)
|
56
56
|
end
|
57
57
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: organize_gemfile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Berry
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Organize your Gemfile with annotations
|
14
14
|
email:
|
@@ -32,7 +32,6 @@ files:
|
|
32
32
|
- lib/organize_gemfile/bundle_parser.rb
|
33
33
|
- lib/organize_gemfile/gemfile_group.rb
|
34
34
|
- lib/organize_gemfile/version.rb
|
35
|
-
- organize_gemfile.gemspec
|
36
35
|
- sig/organize_gemfile.rbs
|
37
36
|
homepage: https://github.com/coderberry/organize_gemfile
|
38
37
|
licenses:
|
@@ -42,7 +41,7 @@ metadata:
|
|
42
41
|
homepage_uri: https://github.com/coderberry/organize_gemfile
|
43
42
|
source_code_uri: https://github.com/coderberry/organize_gemfile
|
44
43
|
changelog_uri: https://github.com/coderberry/organize_gemfile/CHANGELOG.md
|
45
|
-
post_install_message:
|
44
|
+
post_install_message:
|
46
45
|
rdoc_options: []
|
47
46
|
require_paths:
|
48
47
|
- lib
|
@@ -57,8 +56,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
56
|
- !ruby/object:Gem::Version
|
58
57
|
version: '0'
|
59
58
|
requirements: []
|
60
|
-
rubygems_version: 3.
|
61
|
-
signing_key:
|
59
|
+
rubygems_version: 3.3.7
|
60
|
+
signing_key:
|
62
61
|
specification_version: 4
|
63
62
|
summary: Organize your Gemfile with annotations
|
64
63
|
test_files: []
|
data/organize_gemfile.gemspec
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "lib/organize_gemfile/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "organize_gemfile"
|
7
|
-
spec.version = OrganizeGemfile::VERSION
|
8
|
-
spec.authors = ["Eric Berry"]
|
9
|
-
spec.email = ["eric@berry.sh"]
|
10
|
-
|
11
|
-
spec.summary = "Organize your Gemfile with annotations"
|
12
|
-
spec.description = spec.summary
|
13
|
-
spec.homepage = "https://github.com/coderberry/organize_gemfile"
|
14
|
-
spec.license = "MIT"
|
15
|
-
spec.required_ruby_version = ">= 2.6.0"
|
16
|
-
|
17
|
-
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
18
|
-
|
19
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
-
spec.metadata["source_code_uri"] = spec.homepage
|
21
|
-
spec.metadata["changelog_uri"] = "#{spec.homepage}/CHANGELOG.md"
|
22
|
-
|
23
|
-
# Specify which files should be added to the gem when it is released.
|
24
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
26
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
27
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
28
|
-
end
|
29
|
-
end
|
30
|
-
spec.bindir = "exe"
|
31
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
32
|
-
spec.require_paths = ["lib"]
|
33
|
-
|
34
|
-
# Uncomment to register a new dependency of your gem
|
35
|
-
# spec.add_dependency "example-gem", "~> 1.0"
|
36
|
-
|
37
|
-
# For more information and examples about making a new gem, check out our
|
38
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
39
|
-
end
|