organize_gemfile 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -1
- data/Gemfile +6 -8
- data/Gemfile.lock +18 -18
- data/README.md +2 -0
- data/Rakefile +2 -1
- data/exe/organize_gemfile +1 -1
- data/lib/organize_gemfile/gemfile_group.rb +7 -1
- data/lib/organize_gemfile/version.rb +1 -1
- data/lib/organize_gemfile.rb +50 -12
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e792164dde3e1157e0f179ab1fa026958c556b097436aacbd0bdaf829c52f76
|
4
|
+
data.tar.gz: 3b867429dade0acb09cb736ee9cd069e8265a4fd8f3d5a2b5cee3e15772bc54c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3da6ad4029a3b19f9c1d823906a48f0b267a10a6faedeb082d85025573b8ce671d731852884d0ab72d06178574f077fdd8fae553e5baac8ab238bcf77f07d83
|
7
|
+
data.tar.gz: c0a1e837ff3ad854566c54b6f9593e0cdd4d048cf719055efedd509ca6dbe5d076087a827223cf7e8e9325d873b5d7b083247b1916c4088217259a34c0522614
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -1,10 +1,8 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
source "https://rubygems.org"
|
2
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
4
3
|
|
5
|
-
#
|
6
|
-
|
7
|
-
|
8
|
-
gem "
|
9
|
-
gem "
|
10
|
-
gem "standard", "~> 1.3"
|
4
|
+
gem "minitest", "~> 5.0" # minitest provides a complete suite of testing facilities supporting TDD, BDD, mocking, and benchmarking
|
5
|
+
gem "organize_gemfile" # Organize your Gemfile with annotations
|
6
|
+
gem "rake", "~> 13.0" # Rake is a Make-like program implemented in Ruby
|
7
|
+
gem "standard", "~> 1.3" # Ruby Style Guide, with linter & automatic code fixer
|
8
|
+
gem "bump", "~> 0.6" # Bump is a command line tool to help you version your Ruby projects
|
data/Gemfile.lock
CHANGED
@@ -1,48 +1,48 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
organize_gemfile (0.1.0)
|
5
|
-
|
6
1
|
GEM
|
7
2
|
remote: https://rubygems.org/
|
8
3
|
specs:
|
9
4
|
ast (2.4.2)
|
10
|
-
|
5
|
+
bump (0.10.0)
|
6
|
+
json (2.6.2)
|
7
|
+
minitest (5.16.3)
|
8
|
+
organize_gemfile (0.1.0)
|
11
9
|
parallel (1.22.1)
|
12
|
-
parser (3.1.2.
|
10
|
+
parser (3.1.2.1)
|
13
11
|
ast (~> 2.4.1)
|
14
12
|
rainbow (3.1.1)
|
15
13
|
rake (13.0.6)
|
16
14
|
regexp_parser (2.5.0)
|
17
15
|
rexml (3.2.5)
|
18
|
-
rubocop (1.
|
16
|
+
rubocop (1.35.1)
|
17
|
+
json (~> 2.3)
|
19
18
|
parallel (~> 1.10)
|
20
|
-
parser (>= 3.1.
|
19
|
+
parser (>= 3.1.2.1)
|
21
20
|
rainbow (>= 2.2.2, < 4.0)
|
22
21
|
regexp_parser (>= 1.8, < 3.0)
|
23
22
|
rexml (>= 3.2.5, < 4.0)
|
24
|
-
rubocop-ast (>= 1.
|
23
|
+
rubocop-ast (>= 1.20.1, < 2.0)
|
25
24
|
ruby-progressbar (~> 1.7)
|
26
25
|
unicode-display_width (>= 1.4.0, < 3.0)
|
27
|
-
rubocop-ast (1.
|
26
|
+
rubocop-ast (1.21.0)
|
28
27
|
parser (>= 3.1.1.0)
|
29
|
-
rubocop-performance (1.
|
28
|
+
rubocop-performance (1.14.3)
|
30
29
|
rubocop (>= 1.7.0, < 2.0)
|
31
30
|
rubocop-ast (>= 0.4.0)
|
32
31
|
ruby-progressbar (1.11.0)
|
33
|
-
standard (1.
|
34
|
-
rubocop (= 1.
|
35
|
-
rubocop-performance (= 1.
|
36
|
-
unicode-display_width (2.
|
32
|
+
standard (1.16.1)
|
33
|
+
rubocop (= 1.35.1)
|
34
|
+
rubocop-performance (= 1.14.3)
|
35
|
+
unicode-display_width (2.2.0)
|
37
36
|
|
38
37
|
PLATFORMS
|
39
38
|
arm64-darwin-21
|
40
39
|
|
41
40
|
DEPENDENCIES
|
41
|
+
bump (~> 0.6)
|
42
42
|
minitest (~> 5.0)
|
43
|
-
organize_gemfile
|
43
|
+
organize_gemfile
|
44
44
|
rake (~> 13.0)
|
45
45
|
standard (~> 1.3)
|
46
46
|
|
47
47
|
BUNDLED WITH
|
48
|
-
2.3.
|
48
|
+
2.3.17
|
data/README.md
CHANGED
data/Rakefile
CHANGED
data/exe/organize_gemfile
CHANGED
@@ -20,7 +20,13 @@ 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
|
+
if spec[:version] && spec[:version] != ">= 0"
|
24
|
+
version_parts = []
|
25
|
+
spec[:version].split(",").each do |version|
|
26
|
+
version_parts << "\"#{version.strip}\""
|
27
|
+
end
|
28
|
+
parts << version_parts.join(", ")
|
29
|
+
end
|
24
30
|
parts << "require: \"#{spec[:requires].first}\"" if spec[:requires].first && spec[:requires].first != spec[:name]
|
25
31
|
parts << "require: false" if spec[:requires] == []
|
26
32
|
parts << "platforms: %i[ #{spec[:platforms].join(" ")} ]" if spec[:platforms].any?
|
data/lib/organize_gemfile.rb
CHANGED
@@ -1,24 +1,62 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require_relative
|
5
|
-
require_relative
|
6
|
-
require_relative
|
3
|
+
require_relative 'organize_gemfile/bundle_parser.rb'
|
4
|
+
require_relative 'organize_gemfile/gemfile_group.rb'
|
5
|
+
require_relative 'organize_gemfile/builder.rb'
|
6
|
+
require_relative 'organize_gemfile/version'
|
7
|
+
require 'optparse'
|
7
8
|
|
8
9
|
module OrganizeGemfile
|
9
|
-
class Error < StandardError
|
10
|
+
class Error < StandardError
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.execute(*args)
|
14
|
+
options = parse_options(args)
|
15
|
+
|
16
|
+
gemfile_path = options[:gemfile] ||= File.expand_path('Gemfile')
|
17
|
+
unless File.exist?(gemfile_path)
|
18
|
+
puts "Gemfile not found at #{gemfile_path}"
|
19
|
+
return
|
20
|
+
end
|
10
21
|
|
11
|
-
|
12
|
-
|
13
|
-
|
22
|
+
gemfile_lock_path = Pathname.new(gemfile_path).parent.join('Gemfile.lock')
|
23
|
+
unless gemfile_lock_path.exist?
|
24
|
+
puts "Gemfile.lock not found at #{gemfile_lock_path}. Be sure to run `bundle install` before running this command."
|
25
|
+
return
|
26
|
+
end
|
14
27
|
|
15
|
-
gemfile_lock_path = File.expand_path(
|
16
|
-
raise
|
28
|
+
gemfile_lock_path = File.expand_path('Gemfile.lock')
|
29
|
+
raise 'Gemfile.lock not found' unless File.exist?(gemfile_lock_path)
|
17
30
|
|
18
31
|
parser = BundleParser.new(gemfile_path, gemfile_lock_path)
|
19
32
|
ruby_version = parser.ruby_version
|
20
33
|
groups = parser.groups
|
21
|
-
builder =
|
22
|
-
|
34
|
+
builder =
|
35
|
+
Builder.new(gemfile_path, ruby_version: ruby_version, groups: groups)
|
36
|
+
revised_gemfile = builder.build
|
37
|
+
|
38
|
+
File.open(gemfile_path, 'w') { |f| f.write(revised_gemfile) }
|
39
|
+
|
40
|
+
puts 'Gemfile organized!'
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.parse_options(args)
|
44
|
+
options = {}
|
45
|
+
|
46
|
+
opts = OptionParser.new
|
47
|
+
opts.banner = 'Usage: organize_gemfile [options]'
|
48
|
+
|
49
|
+
opts.on('-h', '--help', 'Prints this help') do
|
50
|
+
puts opts
|
51
|
+
exit
|
52
|
+
end
|
53
|
+
|
54
|
+
opts.on('-gPATH', '--gemfile=PATH', 'Path to Gemfile') do |path|
|
55
|
+
options[:gemfile] = File.expand_path(path)
|
56
|
+
end
|
57
|
+
|
58
|
+
opts.parse!(into: options)
|
59
|
+
|
60
|
+
options
|
23
61
|
end
|
24
62
|
end
|
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.1
|
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-09-
|
11
|
+
date: 2022-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Organize your Gemfile with annotations
|
14
14
|
email:
|
@@ -42,7 +42,7 @@ metadata:
|
|
42
42
|
homepage_uri: https://github.com/coderberry/organize_gemfile
|
43
43
|
source_code_uri: https://github.com/coderberry/organize_gemfile
|
44
44
|
changelog_uri: https://github.com/coderberry/organize_gemfile/CHANGELOG.md
|
45
|
-
post_install_message:
|
45
|
+
post_install_message:
|
46
46
|
rdoc_options: []
|
47
47
|
require_paths:
|
48
48
|
- lib
|
@@ -57,8 +57,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
57
|
- !ruby/object:Gem::Version
|
58
58
|
version: '0'
|
59
59
|
requirements: []
|
60
|
-
rubygems_version: 3.
|
61
|
-
signing_key:
|
60
|
+
rubygems_version: 3.1.6
|
61
|
+
signing_key:
|
62
62
|
specification_version: 4
|
63
63
|
summary: Organize your Gemfile with annotations
|
64
64
|
test_files: []
|