gemsmith 14.9.0 → 15.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/README.adoc +0 -1
  5. data/bin/gemsmith +0 -3
  6. data/lib/gemsmith.rb +0 -2
  7. data/lib/gemsmith/cli.rb +13 -12
  8. data/lib/gemsmith/credentials.rb +10 -8
  9. data/lib/gemsmith/gem/requirement.rb +2 -2
  10. data/lib/gemsmith/gem/specification.rb +3 -2
  11. data/lib/gemsmith/generators/base.rb +5 -3
  12. data/lib/gemsmith/generators/bundler.rb +5 -1
  13. data/lib/gemsmith/generators/documentation.rb +1 -2
  14. data/lib/gemsmith/generators/git.rb +4 -1
  15. data/lib/gemsmith/identity.rb +1 -1
  16. data/lib/gemsmith/rake/builder.rb +9 -6
  17. data/lib/gemsmith/rake/publisher.rb +5 -3
  18. data/lib/gemsmith/rake/tasks.rb +5 -2
  19. data/lib/gemsmith/templates/%gem_name%/%gem_name%.gemspec.tt +4 -35
  20. data/lib/gemsmith/templates/%gem_name%/Gemfile.tt +45 -0
  21. data/lib/gemsmith/templates/%gem_name%/Rakefile.tt +1 -0
  22. data/lib/gemsmith/templates/%gem_name%/bin/console.tt +2 -4
  23. data/lib/gemsmith/templates/%gem_name%/circle.yml.tt +4 -3
  24. data/lib/gemsmith/templates/%gem_name%/lib/generators/%gem_path%/install/install_generator.rb.tt +3 -1
  25. data/lib/gemsmith/templates/%gem_name%/lib/generators/%gem_path%/upgrade/upgrade_generator.rb.tt +1 -1
  26. data/lib/gemsmith/templates/%gem_name%/spec/lib/%gem_path%/cli_spec.rb.tt +5 -2
  27. data/lib/gemsmith/templates/%gem_name%/spec/spec_helper.rb.tt +1 -4
  28. data/lib/gemsmith/templates/%gem_name%/spec/support/shared_contexts/temp_dir.rb.tt +1 -1
  29. metadata +32 -216
  30. metadata.gz.sig +0 -0
  31. data/lib/gemsmith/generators/git_cop.rb +0 -14
  32. data/lib/gemsmith/git.rb +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72a6951abdd81a9acab4dffbedb9c927dbae2b1e29e5f10e20270490d93ba433
4
- data.tar.gz: 9252720b8cab46469734560191e82e0c81506ebd1d502dd5352d9763bc76666e
3
+ metadata.gz: 651c889805c8d1c0a08a214d6fa464ca66ee6ee8fa07c3ab6898eb017b325542
4
+ data.tar.gz: 2060034279e140f6706600e40a395c351cf3d6b121b295fda84b47ca17f564a1
5
5
  SHA512:
6
- metadata.gz: b81ccadb170bfd7e036ec406846e7aa69b3c36d8993f0202ec3af131dec03de9f5e96426dc69ab62d60efb343216f81806cb166b235ce5980e8c2c5ea38c90d4
7
- data.tar.gz: 8a93cc11e0790faa62a718e28a43c5979ef412965d91d8968273a727aaf3def25c6548d6ebff450329d8a7649b790a2947dbd2a3e769cd447599b7a75e1af77f
6
+ metadata.gz: 531b44e972e654f5e5f53137ea5be17cb623df2da9200c572165612ec51368be7749ab4defb9d533a4063683d5d8db9568829ea120d4e1aefcdcc0e4ac28761b
7
+ data.tar.gz: e96043ee09c39cb908514dd0e047a45606022e592b361569baeaea2111865bbad88884efeff194874e7b9aae1921b0fbd5911362caae0d6f3a92625feaebb88f
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -94,7 +94,6 @@ For more gem generation options, type: `gemsmith --help --generate`
94
94
  [--circle-ci], [--no-circle-ci] # Add Circle CI support.
95
95
  [--cli], [--no-cli] # Add CLI support.
96
96
  [--engine], [--no-engine] # Add Rails Engine support.
97
- [--git-cop], [--no-git-cop] # Add Git Cop support. DEPRECATED: Use Git Lint instead.
98
97
  [--git-lint], [--no-git-lint] # Add Git Lint support.
99
98
  # Default: true
100
99
  [--git-hub], [--no-git-hub] # Add GitHub support.
@@ -1,9 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- # TODO: Remove once the Pattern Matching feature is fully supported.
5
- Warning[:experimental] = false
6
-
7
4
  require "gemsmith"
8
5
  require "gemsmith/cli"
9
6
  require "gemsmith/identity"
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "gemsmith/identity"
4
- require "gemsmith/git"
5
4
  require "gemsmith/credentials"
6
5
  require "gemsmith/errors/base"
7
6
  require "gemsmith/errors/requirement_conversion"
@@ -19,7 +18,6 @@ require "gemsmith/generators/cli"
19
18
  require "gemsmith/generators/documentation"
20
19
  require "gemsmith/generators/gem"
21
20
  require "gemsmith/generators/git"
22
- require "gemsmith/generators/git_cop"
23
21
  require "gemsmith/generators/git_lint"
24
22
  require "gemsmith/generators/git_hub"
25
23
  require "gemsmith/generators/guard"
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "git_plus"
3
4
  require "thor"
4
5
  require "thor/actions"
5
6
  require "refinements/strings"
@@ -7,6 +8,7 @@ require "refinements/hashes"
7
8
  require "runcom"
8
9
  require "gemsmith/helpers/cli"
9
10
  require "gemsmith/helpers/template"
11
+ require "pathname"
10
12
 
11
13
  module Gemsmith
12
14
  # The Command Line Interface (CLI) for the gem.
@@ -23,27 +25,29 @@ module Gemsmith
23
25
 
24
26
  # Overwrites Thor's template source root.
25
27
  def self.source_root
26
- File.expand_path File.join(File.dirname(__FILE__), "templates")
28
+ Pathname(__dir__).join("templates").freeze
27
29
  end
28
30
 
29
31
  # rubocop:disable Metrics/MethodLength
30
32
  def self.configuration
33
+ repository = GitPlus::Repository.new
34
+
31
35
  Runcom::Config.new "#{Identity::NAME}/configuration.yml",
32
36
  defaults: {
33
37
  year: Time.now.year,
34
- github_user: Git.github_user,
38
+ github_user: repository.config_get("github.user"),
35
39
  gem: {
36
40
  label: "Undefined",
37
41
  name: "undefined",
38
42
  path: "undefined",
39
43
  class: "Undefined",
40
44
  platform: "Gem::Platform::RUBY",
41
- url: Git.github_url("undefined"),
45
+ url: "",
42
46
  license: "MIT"
43
47
  },
44
48
  author: {
45
- name: Git.config_value("user.name"),
46
- email: Git.config_value("user.email"),
49
+ name: repository.config_get("user.name"),
50
+ email: repository.config_get("user.email"),
47
51
  url: ""
48
52
  },
49
53
  organization: {
@@ -52,7 +56,7 @@ module Gemsmith
52
56
  },
53
57
  versions: {
54
58
  ruby: RUBY_VERSION,
55
- rails: "5.1"
59
+ rails: "6.1"
56
60
  },
57
61
  generate: {
58
62
  bundler_audit: true,
@@ -87,7 +91,6 @@ module Gemsmith
87
91
  Generators::Engine,
88
92
  Generators::Rspec,
89
93
  Generators::BundlerAudit,
90
- Generators::GitCop,
91
94
  Generators::GitLint,
92
95
  Generators::Reek,
93
96
  Generators::Guard,
@@ -127,10 +130,6 @@ module Gemsmith
127
130
  desc: "Add Rails Engine support.",
128
131
  type: :boolean,
129
132
  default: configuration.to_h.dig(:generate, :engine)
130
- method_option :git_cop,
131
- desc: "Add Git Cop support. DEPRECATED: Use Git Lint instead.",
132
- type: :boolean,
133
- default: false
134
133
  method_option :git_lint,
135
134
  desc: "Add Git Lint support.",
136
135
  type: :boolean,
@@ -232,6 +231,8 @@ module Gemsmith
232
231
  # :reek:FeatureEnvy
233
232
  # rubocop:disable Metrics/MethodLength
234
233
  def setup_configuration name:, options: {}
234
+ repository = GitPlus::Repository.new
235
+
235
236
  @configuration = configuration.to_h.merge(
236
237
  gem: {
237
238
  label: name.titleize,
@@ -239,7 +240,7 @@ module Gemsmith
239
240
  path: name.snakecase,
240
241
  class: name.camelcase,
241
242
  platform: "Gem::Platform::RUBY",
242
- url: Git.github_url(name),
243
+ url: %(https://github.com/#{repository.config_get "github.user"}/#{name}),
243
244
  license: "MIT"
244
245
  },
245
246
  generate: options.symbolize_keys
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "yaml"
4
- require "fileutils"
4
+ require "refinements/pathnames"
5
5
  require "gemsmith/authenticators/basic"
6
6
  require "gemsmith/authenticators/ruby_gems"
7
7
 
@@ -11,10 +11,12 @@ module Gemsmith
11
11
  DEFAULT_KEY = :rubygems_api_key
12
12
  DEFAULT_URL = "https://rubygems.org"
13
13
 
14
+ using Refinements::Pathnames
15
+
14
16
  attr_reader :key, :url
15
17
 
16
18
  def self.file_path
17
- File.join ENV.fetch("HOME"), ".gem", "credentials"
19
+ Pathname(ENV.fetch("HOME")).join ".gem", "credentials"
18
20
  end
19
21
 
20
22
  def self.authenticators
@@ -52,7 +54,7 @@ module Gemsmith
52
54
  attr_reader :credentials, :shell
53
55
 
54
56
  def exist?
55
- File.exist? self.class.file_path
57
+ self.class.file_path.exist?
56
58
  end
57
59
 
58
60
  def read
@@ -62,11 +64,11 @@ module Gemsmith
62
64
  end
63
65
 
64
66
  def write
65
- file_path = self.class.file_path
66
-
67
- FileUtils.mkdir_p File.dirname file_path
68
- File.open(file_path, "w") { |file| file << YAML.dump(update) }
69
- FileUtils.chmod 0o600, file_path
67
+ self.class
68
+ .file_path
69
+ .tap { |path| path.parent.make_path }
70
+ .write(YAML.dump(update))
71
+ .chmod 0o600
70
72
  end
71
73
 
72
74
  def update
@@ -13,13 +13,13 @@ module Gemsmith
13
13
  end
14
14
 
15
15
  def self.version_segments version
16
- String(version).split(Versionaire::DELIMITER).map(&:to_i)
16
+ String(version).split(Versionaire::Version.delimiter).map(&:to_i)
17
17
  end
18
18
 
19
19
  def self.for object
20
20
  case object
21
21
  when String
22
- operator, version = object.split " "
22
+ operator, version = object.split
23
23
  new operator: operator, raw_version: version
24
24
  else
25
25
  fail Errors::RequirementConversion,
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "pathname"
3
4
  require "versionaire"
4
5
 
5
6
  module Gemsmith
@@ -26,7 +27,7 @@ module Gemsmith
26
27
 
27
28
  def initialize file_path
28
29
  @file_path = file_path
29
- @spec = self.class.specification.load file_path
30
+ @spec = self.class.specification.load file_path.to_s
30
31
  validate
31
32
  @version = Versionaire::Version @spec.version.to_s
32
33
  end
@@ -56,7 +57,7 @@ module Gemsmith
56
57
  end
57
58
 
58
59
  def package_path
59
- File.join "pkg", package_file_name
60
+ Pathname("pkg").join package_file_name
60
61
  end
61
62
 
62
63
  private
@@ -1,11 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "pathname"
4
+
3
5
  module Gemsmith
4
6
  module Generators
5
7
  # Abstract class from which all generators inherit from.
6
8
  class Base
7
- LIB_ROOT = File.join("%gem_name%", "lib").freeze
8
- LIB_ROOT_GEM = File.join(LIB_ROOT, "%gem_path%").freeze
9
+ LIB_ROOT = Pathname("%gem_name%/lib").freeze
10
+ LIB_ROOT_GEM = LIB_ROOT.join("%gem_path%").freeze
9
11
 
10
12
  def self.run cli, configuration: {}
11
13
  new(cli, configuration: configuration).run
@@ -33,7 +35,7 @@ module Gemsmith
33
35
  end
34
36
 
35
37
  def gem_root
36
- File.join cli.destination_root, gem_name
38
+ Pathname(cli.destination_root).join gem_name
37
39
  end
38
40
 
39
41
  def template path
@@ -1,11 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "refinements/pathnames"
4
+
3
5
  module Gemsmith
4
6
  module Generators
5
7
  # Generates Bundler support.
6
8
  class Bundler < Base
9
+ using Refinements::Pathnames
10
+
7
11
  def run
8
- Dir.chdir gem_root do
12
+ gem_root.change_dir do
9
13
  cli.say_status :info, "Installing gem dependencies...", :green
10
14
  cli.run "bundle install"
11
15
  end
@@ -22,8 +22,7 @@ module Gemsmith
22
22
  end
23
23
 
24
24
  def update_readme
25
- File.join(gem_root, "README.md")
26
- .then { |readme| Tocer::Writer.new(readme).call }
25
+ gem_root.join("README.md").then { |path| Tocer::Writer.new(path).call }
27
26
  end
28
27
  end
29
28
  end
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "open3"
4
+ require "refinements/pathnames"
4
5
 
5
6
  module Gemsmith
6
7
  module Generators
7
8
  # Generates Git support.
8
9
  class Git < Base
10
+ using Refinements::Pathnames
11
+
9
12
  def initialize cli, configuration: {}, shell: Open3
10
13
  super cli, configuration: configuration
11
14
  @shell = shell
@@ -31,7 +34,7 @@ module Gemsmith
31
34
  end
32
35
 
33
36
  def create_commit subject, body
34
- Dir.chdir gem_root do
37
+ gem_root.change_dir do
35
38
  shell.capture3 "git init"
36
39
  shell.capture3 "git add ."
37
40
  shell.capture3 %(git commit --all --no-verify --message "#{subject}" --message "#{body}")
@@ -5,7 +5,7 @@ module Gemsmith
5
5
  module Identity
6
6
  NAME = "gemsmith"
7
7
  LABEL = "Gemsmith"
8
- VERSION = "14.9.0"
8
+ VERSION = "15.1.0"
9
9
  VERSION_LABEL = "#{LABEL} #{VERSION}"
10
10
  URL = "https://www.alchemists.io/projects/gemsmith"
11
11
  end
@@ -1,19 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "bundler/ui/shell"
4
- require "fileutils"
4
+ require "refinements/pathnames"
5
5
 
6
6
  module Gemsmith
7
7
  module Rake
8
8
  # Provides gem build functionality. Meant to be wrapped in Rake tasks.
9
9
  class Builder
10
- def initialize shell: Bundler::UI::Shell.new, kernel: Kernel
10
+ using Refinements::Pathnames
11
+
12
+ def initialize root: Pathname("pkg"), shell: Bundler::UI::Shell.new, kernel: Kernel
13
+ @root = root
11
14
  @shell = shell
12
15
  @kernel = kernel
13
16
  end
14
17
 
15
18
  def clean
16
- FileUtils.rm_rf "pkg"
19
+ root.remove_tree
17
20
  shell.confirm "Cleaned gem artifacts."
18
21
  end
19
22
 
@@ -28,8 +31,8 @@ module Gemsmith
28
31
  path = gem_spec.package_path
29
32
 
30
33
  if kernel.system "gem build #{gem_spec.name}.gemspec"
31
- FileUtils.mkdir_p "pkg"
32
- FileUtils.mv gem_spec.package_file_name, path
34
+ root.make_path
35
+ Pathname(gem_spec.package_file_name).copy path
33
36
  shell.confirm "Built: #{path}."
34
37
  else
35
38
  shell.error "Unable to build: #{path}."
@@ -48,7 +51,7 @@ module Gemsmith
48
51
 
49
52
  private
50
53
 
51
- attr_reader :shell, :kernel
54
+ attr_reader :root, :shell, :kernel
52
55
  end
53
56
  end
54
57
  end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "milestoner"
4
+ require "refinements/pathnames"
4
5
  require "gemsmith/identity"
5
6
  require "gemsmith/credentials"
6
- require "gemsmith/git"
7
7
  require "gemsmith/cli"
8
8
 
9
9
  module Gemsmith
@@ -11,13 +11,15 @@ module Gemsmith
11
11
  # Provides gem release functionality. Meant to be wrapped in Rake tasks.
12
12
  # :reek:TooManyInstanceVariables
13
13
  class Publisher
14
+ using Refinements::Pathnames
15
+
14
16
  def self.gem_spec_path
15
- String Dir["#{Dir.pwd}/*.gemspec"].first
17
+ Pathname.pwd.files("*.gemspec").first.to_s
16
18
  end
17
19
 
18
20
  # rubocop:disable Metrics/ParameterLists
19
21
  # :reek:LongParameterList
20
- def initialize gem_spec: Gemsmith::Gem::Specification.new(self.class.gem_spec_path),
22
+ def initialize gem_spec: Gemsmith::Gem::Specification.new(self.class.gem_spec_path.to_s),
21
23
  gem_config: Gemsmith::CLI.configuration.to_h,
22
24
  credentials: Gemsmith::Credentials,
23
25
  publisher: Milestoner::Publisher.new,
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "rake"
4
+ require "refinements/pathnames"
4
5
  require "tocer/rake/tasks"
5
6
  require "gemsmith/gem/specification"
6
7
  require "gemsmith/errors/base"
@@ -14,15 +15,17 @@ module Gemsmith
14
15
  class Tasks
15
16
  include ::Rake::DSL
16
17
 
18
+ using Refinements::Pathnames
19
+
17
20
  def self.default_gem_spec
18
- Dir.glob("#{Dir.pwd}/*.gemspec").first
21
+ Pathname.pwd.files("*.gemspec").first
19
22
  end
20
23
 
21
24
  def self.setup
22
25
  new.install
23
26
  end
24
27
 
25
- def initialize gem_spec: Gem::Specification.new(self.class.default_gem_spec),
28
+ def initialize gem_spec: Gem::Specification.new(self.class.default_gem_spec.to_s),
26
29
  builder: Rake::Builder.new,
27
30
  publisher: Rake::Publisher.new
28
31
  @gem_spec = gem_spec
@@ -11,9 +11,10 @@ Gem::Specification.new do |spec|
11
11
  spec.license = "MIT"
12
12
 
13
13
  spec.metadata = {
14
- "source_code_uri" => "<%= config.dig(:gem, :url) %>",
14
+ "bug_tracker_uri" => "<%= config.dig(:gem, :url) %>/issues",
15
15
  "changelog_uri" => "<%= config.dig(:gem, :url) %>/blob/master/CHANGES.md",
16
- "bug_tracker_uri" => "<%= config.dig(:gem, :url) %>/issues"
16
+ "documentation_uri" => "<%= config.dig(:gem, :url) %>",
17
+ "source_code_uri" => "<%= config.dig(:gem, :url) %>"
17
18
  }
18
19
 
19
20
  <%- if config.dig(:generate, :security) -%>
@@ -26,41 +27,9 @@ Gem::Specification.new do |spec|
26
27
  spec.add_dependency "rails", "~> <%= config.dig(:versions, :rails) %>"
27
28
  <%- end -%>
28
29
  <%- if config.dig(:generate, :cli) -%>
29
- spec.add_dependency "runcom", "~> 6.4"
30
+ spec.add_dependency "runcom", "~> 7.0"
30
31
  spec.add_dependency "thor", "~> 0.20"
31
32
  <%- end -%>
32
- <%- if config.dig(:generate, :bundler_audit) -%>
33
- spec.add_development_dependency "bundler-audit", "~> 0.7"
34
- <%- end -%>
35
- spec.add_development_dependency "gemsmith", "~> <%= Gemsmith::Identity::VERSION[/\d+\.\d+/] %>"
36
- <%- if config.dig(:generate, :git_lint) -%>
37
- spec.add_development_dependency "git-lint", "~> 1.3"
38
- <%- end -%>
39
- <%- if config.dig(:generate, :guard) -%>
40
- spec.add_development_dependency "guard-rspec", "~> 4.7"
41
- <%- end -%>
42
- <%- if config.dig(:generate, :pry) -%>
43
- spec.add_development_dependency "pry", "~> 0.13"
44
- spec.add_development_dependency "pry-byebug", "~> 3.9"
45
- <%- end -%>
46
- spec.add_development_dependency "rake", "~> 13.0"
47
- <%- if config.dig(:generate, :reek) -%>
48
- spec.add_development_dependency "reek", "~> 6.0"
49
- <%- end -%>
50
- <%- if config.dig(:generate, :rspec) -%>
51
- spec.add_development_dependency "<%= config.dig(:generate, :engine) ? "rspec-rails" : "rspec" %>", "~> 3.9"
52
- <%- end -%>
53
- <%- if config.dig(:generate, :rubocop) -%>
54
- spec.add_development_dependency "rubocop", "~> 1.3"
55
- spec.add_development_dependency "rubocop-performance", "~> 1.8"
56
- spec.add_development_dependency "rubocop-rake", "~> 0.5"
57
- <%- end -%>
58
- <%- if config.dig(:generate, :rubocop) && config.dig(:generate, :rspec) -%>
59
- spec.add_development_dependency "rubocop-rspec", "~> 2.0"
60
- <%- end -%>
61
- <%- if config.dig(:generate, :simple_cov) -%>
62
- spec.add_development_dependency "simplecov", "~> 0.19"
63
- <%- end -%>
64
33
 
65
34
  <%- if config.dig(:generate, :engine) -%>
66
35
  spec.files = Dir["app/**/*", "bin/**/*", "config/**/*", "lib/**/*", "vendor/**/*"]
@@ -1,2 +1,47 @@
1
1
  source "https://rubygems.org"
2
+
2
3
  gemspec
4
+
5
+ group :code_quality do
6
+ <%- if config.dig(:generate, :bundler_audit) -%>
7
+ gem "bundler-audit", "~> 0.7"
8
+ <%- end -%>
9
+ <%- if config.dig(:generate, :git_lint) -%>
10
+ gem "git-lint", "~> 2.0"
11
+ <%- end -%>
12
+ <%- if config.dig(:generate, :reek) -%>
13
+ gem "reek", "~> 6.0"
14
+ <%- end -%>
15
+ <%- if config.dig(:generate, :rubocop) -%>
16
+ gem "rubocop", "~> 1.5"
17
+ gem "rubocop-performance", "~> 1.8"
18
+ gem "rubocop-rake", "~> 0.5"
19
+ <%- end -%>
20
+ <%- if config.dig(:generate, :rubocop) && config.dig(:generate, :rspec) -%>
21
+ gem "rubocop-rspec", "~> 2.0"
22
+ <%- end -%>
23
+ <%- if config.dig(:generate, :simple_cov) -%>
24
+ gem "simplecov", "~> 0.20"
25
+ <%- end -%>
26
+ end
27
+
28
+ group :development do
29
+ gem "gemsmith", "~> <%= Gemsmith::Identity::VERSION[/\d+\.\d+/] %>"
30
+ gem "rake", "~> 13.0"
31
+ end
32
+
33
+ group :test do
34
+ <%- if config.dig(:generate, :guard) -%>
35
+ gem "guard-rspec", "~> 4.7", require: false
36
+ <%- end -%>
37
+ <%- if config.dig(:generate, :rspec) -%>
38
+ gem "<%= config.dig(:generate, :engine) ? "rspec-rails" : "rspec" %>", "~> 3.9"
39
+ <%- end -%>
40
+ end
41
+
42
+ group :tools do
43
+ <%- if config.dig(:generate, :pry) -%>
44
+ gem "pry", "~> 0.13"
45
+ gem "pry-byebug", "~> 3.9"
46
+ <%- end -%>
47
+ end
@@ -1,3 +1,4 @@
1
+ require "bundler/setup"
1
2
  require "bundler/audit/task"
2
3
  require "gemsmith/rake/setup"
3
4
  require "git/lint/rake/setup"
@@ -2,11 +2,9 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "bundler/setup"
5
+ Bundler.require :tools
6
+
5
7
  require "<%= config.dig :gem, :path %>"
6
- <%- if config.dig(:generate, :pry) -%>
7
- require "pry"
8
- require "pry-byebug"
9
- <%- end -%>
10
8
  require "irb"
11
9
 
12
10
  IRB.start __FILE__
@@ -25,9 +25,9 @@ jobs:
25
25
  - run:
26
26
  name: Ruby Install
27
27
  command: |
28
- curl https://cache.ruby-lang.org/pub/ruby/${CI_RUBY_VERSION::-2}/ruby-$CI_RUBY_VERSION.tar.bz2 > ../ruby-$CI_RUBY_VERSION.tar.gz
29
28
  cd ..
30
- tar --extract --bzip2 --verbose --file ruby-$CI_RUBY_VERSION.tar.gz
29
+ curl https://cache.ruby-lang.org/pub/ruby/${CI_RUBY_VERSION::-2}/ruby-$CI_RUBY_VERSION.tar.gz > ruby-$CI_RUBY_VERSION.tar.gz
30
+ tar --extract --gzip --verbose --file ruby-$CI_RUBY_VERSION.tar.gz
31
31
  cd ruby-$CI_RUBY_VERSION
32
32
  ./configure
33
33
  make
@@ -49,7 +49,8 @@ jobs:
49
49
  name: Bundler Install
50
50
  command: |
51
51
  gem update --system
52
- bundle install --path vendor/bundle
52
+ bundle config set path "vendor/bundle"
53
+ bundle install
53
54
 
54
55
  - type: cache-save
55
56
  name: Bundler Store
@@ -1,7 +1,9 @@
1
+ require "pathname"
2
+
1
3
  <% render_namespace do %>
2
4
  # Generator for installing new files.
3
5
  class InstallGenerator < Rails::Generators::Base
4
- source_root File.join(File.dirname(__FILE__), "..", "templates")
6
+ source_root Pathname(__dir__).join("../templates")
5
7
 
6
8
  desc "Installs additional <%= config.dig(:gem, :label) %> resources."
7
9
  def install
@@ -1,7 +1,7 @@
1
1
  <% render_namespace do %>
2
2
  # Generator for updating existing files.
3
3
  class UpgradeGenerator < Rails::Generators::Base
4
- source_root File.join(File.dirname(__FILE__), "..", "templates")
4
+ source_root Pathname(__dir__).join("../templates")
5
5
 
6
6
  desc "Upgrades previously installed <%= config.dig(:gem, :label) %> resources."
7
7
  def upgrade
@@ -3,11 +3,14 @@
3
3
  require "spec_helper"
4
4
 
5
5
  RSpec.describe <%= config.dig(:gem, :class) %>::CLI do
6
+ subject(:cli) { described_class.start command_line }
7
+
8
+ include_context "with temporary directory"
9
+
6
10
  let(:options) { [] }
7
11
  let(:command_line) { Array(command).concat options }
8
- let(:cli) { described_class.start command_line }
9
12
 
10
- shared_examples_for "a config command", :temp_dir do
13
+ shared_examples_for "a config command" do
11
14
  context "with no options" do
12
15
  it "prints help text" do
13
16
  result = -> { cli }
@@ -1,14 +1,11 @@
1
1
  require "bundler/setup"
2
+ Bundler.require :tools
2
3
 
3
4
  <%- if config.dig(:generate, :simple_cov) -%>
4
5
  require "simplecov"
5
6
  SimpleCov.start { enable_coverage :branch }
6
7
  <%- end -%>
7
8
 
8
- <%- if config.dig(:generate, :pry) -%>
9
- require "pry"
10
- require "pry-byebug"
11
- <%- end -%>
12
9
  <%- unless config.dig(:generate, :engine) -%>
13
10
  require "<%= config.dig(:gem, :path) %>"
14
11
  <%- end -%>
@@ -1,4 +1,4 @@
1
- RSpec.shared_context "with temporary directory", :temp_dir do
1
+ RSpec.shared_context "with temporary directory" do
2
2
  let(:temp_dir) { Bundler.root.join "tmp", "rspec" }
3
3
 
4
4
  around do |example|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemsmith
3
3
  version: !ruby/object:Gem::Version
4
- version: 14.9.0
4
+ version: 15.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -28,316 +28,134 @@ cert_chain:
28
28
  2XV8FRa7/JimI07sPLC13eLY3xd/aYTi85Z782KIA4j0G8XEEWAX0ouBhlXPocZv
29
29
  QWc=
30
30
  -----END CERTIFICATE-----
31
- date: 2020-11-21 00:00:00.000000000 Z
31
+ date: 2021-01-01 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
- name: milestoner
34
+ name: git_plus
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '10.4'
39
+ version: '0.1'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '10.4'
46
+ version: '0.1'
47
47
  - !ruby/object:Gem::Dependency
48
- name: pragmater
48
+ name: milestoner
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '8.1'
53
+ version: '11.0'
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '8.1'
60
+ version: '11.0'
61
61
  - !ruby/object:Gem::Dependency
62
- name: refinements
62
+ name: pragmater
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '7.15'
67
+ version: '9.0'
68
68
  type: :runtime
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '7.15'
74
+ version: '9.0'
75
75
  - !ruby/object:Gem::Dependency
76
- name: rubocop
76
+ name: refinements
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '1.3'
81
+ version: '8.0'
82
82
  type: :runtime
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: '1.3'
88
+ version: '8.0'
89
89
  - !ruby/object:Gem::Dependency
90
- name: runcom
90
+ name: rubocop
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: '6.4'
95
+ version: '1.5'
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: '6.4'
102
+ version: '1.5'
103
103
  - !ruby/object:Gem::Dependency
104
- name: thor
104
+ name: runcom
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: '0.20'
109
+ version: '7.0'
110
110
  type: :runtime
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: '0.20'
116
+ version: '7.0'
117
117
  - !ruby/object:Gem::Dependency
118
- name: tocer
118
+ name: thor
119
119
  requirement: !ruby/object:Gem::Requirement
120
120
  requirements:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: '10.4'
123
+ version: '0.20'
124
124
  type: :runtime
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
- version: '10.4'
130
+ version: '0.20'
131
131
  - !ruby/object:Gem::Dependency
132
- name: versionaire
132
+ name: tocer
133
133
  requirement: !ruby/object:Gem::Requirement
134
134
  requirements:
135
135
  - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: '8.4'
137
+ version: '11.0'
138
138
  type: :runtime
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: '8.4'
145
- - !ruby/object:Gem::Dependency
146
- name: bundler-audit
147
- requirement: !ruby/object:Gem::Requirement
148
- requirements:
149
- - - "~>"
150
- - !ruby/object:Gem::Version
151
- version: '0.7'
152
- type: :development
153
- prerelease: false
154
- version_requirements: !ruby/object:Gem::Requirement
155
- requirements:
156
- - - "~>"
157
- - !ruby/object:Gem::Version
158
- version: '0.7'
159
- - !ruby/object:Gem::Dependency
160
- name: bundler-leak
161
- requirement: !ruby/object:Gem::Requirement
162
- requirements:
163
- - - "~>"
164
- - !ruby/object:Gem::Version
165
- version: '0.2'
166
- type: :development
167
- prerelease: false
168
- version_requirements: !ruby/object:Gem::Requirement
169
- requirements:
170
- - - "~>"
171
- - !ruby/object:Gem::Version
172
- version: '0.2'
173
- - !ruby/object:Gem::Dependency
174
- name: climate_control
175
- requirement: !ruby/object:Gem::Requirement
176
- requirements:
177
- - - "~>"
178
- - !ruby/object:Gem::Version
179
- version: '0.2'
180
- type: :development
181
- prerelease: false
182
- version_requirements: !ruby/object:Gem::Requirement
183
- requirements:
184
- - - "~>"
185
- - !ruby/object:Gem::Version
186
- version: '0.2'
187
- - !ruby/object:Gem::Dependency
188
- name: git-lint
189
- requirement: !ruby/object:Gem::Requirement
190
- requirements:
191
- - - "~>"
192
- - !ruby/object:Gem::Version
193
- version: '1.3'
194
- type: :development
195
- prerelease: false
196
- version_requirements: !ruby/object:Gem::Requirement
197
- requirements:
198
- - - "~>"
199
- - !ruby/object:Gem::Version
200
- version: '1.3'
144
+ version: '11.0'
201
145
  - !ruby/object:Gem::Dependency
202
- name: guard-rspec
203
- requirement: !ruby/object:Gem::Requirement
204
- requirements:
205
- - - "~>"
206
- - !ruby/object:Gem::Version
207
- version: '4.7'
208
- type: :development
209
- prerelease: false
210
- version_requirements: !ruby/object:Gem::Requirement
211
- requirements:
212
- - - "~>"
213
- - !ruby/object:Gem::Version
214
- version: '4.7'
215
- - !ruby/object:Gem::Dependency
216
- name: pry
217
- requirement: !ruby/object:Gem::Requirement
218
- requirements:
219
- - - "~>"
220
- - !ruby/object:Gem::Version
221
- version: '0.13'
222
- type: :development
223
- prerelease: false
224
- version_requirements: !ruby/object:Gem::Requirement
225
- requirements:
226
- - - "~>"
227
- - !ruby/object:Gem::Version
228
- version: '0.13'
229
- - !ruby/object:Gem::Dependency
230
- name: pry-byebug
231
- requirement: !ruby/object:Gem::Requirement
232
- requirements:
233
- - - "~>"
234
- - !ruby/object:Gem::Version
235
- version: '3.9'
236
- type: :development
237
- prerelease: false
238
- version_requirements: !ruby/object:Gem::Requirement
239
- requirements:
240
- - - "~>"
241
- - !ruby/object:Gem::Version
242
- version: '3.9'
243
- - !ruby/object:Gem::Dependency
244
- name: rake
245
- requirement: !ruby/object:Gem::Requirement
246
- requirements:
247
- - - "~>"
248
- - !ruby/object:Gem::Version
249
- version: '13.0'
250
- type: :development
251
- prerelease: false
252
- version_requirements: !ruby/object:Gem::Requirement
253
- requirements:
254
- - - "~>"
255
- - !ruby/object:Gem::Version
256
- version: '13.0'
257
- - !ruby/object:Gem::Dependency
258
- name: reek
259
- requirement: !ruby/object:Gem::Requirement
260
- requirements:
261
- - - "~>"
262
- - !ruby/object:Gem::Version
263
- version: '6.0'
264
- type: :development
265
- prerelease: false
266
- version_requirements: !ruby/object:Gem::Requirement
267
- requirements:
268
- - - "~>"
269
- - !ruby/object:Gem::Version
270
- version: '6.0'
271
- - !ruby/object:Gem::Dependency
272
- name: rspec
273
- requirement: !ruby/object:Gem::Requirement
274
- requirements:
275
- - - "~>"
276
- - !ruby/object:Gem::Version
277
- version: '3.10'
278
- type: :development
279
- prerelease: false
280
- version_requirements: !ruby/object:Gem::Requirement
281
- requirements:
282
- - - "~>"
283
- - !ruby/object:Gem::Version
284
- version: '3.10'
285
- - !ruby/object:Gem::Dependency
286
- name: rubocop-performance
287
- requirement: !ruby/object:Gem::Requirement
288
- requirements:
289
- - - "~>"
290
- - !ruby/object:Gem::Version
291
- version: '1.8'
292
- type: :development
293
- prerelease: false
294
- version_requirements: !ruby/object:Gem::Requirement
295
- requirements:
296
- - - "~>"
297
- - !ruby/object:Gem::Version
298
- version: '1.8'
299
- - !ruby/object:Gem::Dependency
300
- name: rubocop-rake
301
- requirement: !ruby/object:Gem::Requirement
302
- requirements:
303
- - - "~>"
304
- - !ruby/object:Gem::Version
305
- version: '0.5'
306
- type: :development
307
- prerelease: false
308
- version_requirements: !ruby/object:Gem::Requirement
309
- requirements:
310
- - - "~>"
311
- - !ruby/object:Gem::Version
312
- version: '0.5'
313
- - !ruby/object:Gem::Dependency
314
- name: rubocop-rspec
315
- requirement: !ruby/object:Gem::Requirement
316
- requirements:
317
- - - "~>"
318
- - !ruby/object:Gem::Version
319
- version: '2.0'
320
- type: :development
321
- prerelease: false
322
- version_requirements: !ruby/object:Gem::Requirement
323
- requirements:
324
- - - "~>"
325
- - !ruby/object:Gem::Version
326
- version: '2.0'
327
- - !ruby/object:Gem::Dependency
328
- name: simplecov
146
+ name: versionaire
329
147
  requirement: !ruby/object:Gem::Requirement
330
148
  requirements:
331
149
  - - "~>"
332
150
  - !ruby/object:Gem::Version
333
- version: '0.19'
334
- type: :development
151
+ version: '9.0'
152
+ type: :runtime
335
153
  prerelease: false
336
154
  version_requirements: !ruby/object:Gem::Requirement
337
155
  requirements:
338
156
  - - "~>"
339
157
  - !ruby/object:Gem::Version
340
- version: '0.19'
158
+ version: '9.0'
341
159
  description:
342
160
  email:
343
161
  - brooke@alchemists.io
@@ -373,7 +191,6 @@ files:
373
191
  - lib/gemsmith/generators/engine.rb
374
192
  - lib/gemsmith/generators/gem.rb
375
193
  - lib/gemsmith/generators/git.rb
376
- - lib/gemsmith/generators/git_cop.rb
377
194
  - lib/gemsmith/generators/git_hub.rb
378
195
  - lib/gemsmith/generators/git_lint.rb
379
196
  - lib/gemsmith/generators/guard.rb
@@ -383,7 +200,6 @@ files:
383
200
  - lib/gemsmith/generators/rspec.rb
384
201
  - lib/gemsmith/generators/rubocop.rb
385
202
  - lib/gemsmith/generators/ruby.rb
386
- - lib/gemsmith/git.rb
387
203
  - lib/gemsmith/helpers/cli.rb
388
204
  - lib/gemsmith/helpers/template.rb
389
205
  - lib/gemsmith/identity.rb
@@ -438,14 +254,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
438
254
  requirements:
439
255
  - - "~>"
440
256
  - !ruby/object:Gem::Version
441
- version: '2.7'
257
+ version: '3.0'
442
258
  required_rubygems_version: !ruby/object:Gem::Requirement
443
259
  requirements:
444
260
  - - ">="
445
261
  - !ruby/object:Gem::Version
446
262
  version: '0'
447
263
  requirements: []
448
- rubygems_version: 3.1.4
264
+ rubygems_version: 3.2.3
449
265
  signing_key:
450
266
  specification_version: 4
451
267
  summary: A command line interface for smithing Ruby gems.
metadata.gz.sig CHANGED
Binary file
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Gemsmith
4
- module Generators
5
- # Generates Git Cop support.
6
- class GitCop < Base
7
- def run
8
- return unless configuration.dig :generate, :git_cop
9
-
10
- warn "[DEPRECATION]: Git Cop is deprecated, use Git Lint instead."
11
- end
12
- end
13
- end
14
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Gemsmith
4
- # A thin wrapper to Git.
5
- # rubocop:disable Style/StaticClass
6
- class Git
7
- def self.config_value key
8
- `git config #{key}`.chomp
9
- end
10
-
11
- def self.github_user
12
- config_value "github.user"
13
- end
14
-
15
- def self.github_url project
16
- return "" if github_user.empty?
17
-
18
- "https://github.com/#{github_user}/#{project}"
19
- end
20
- end
21
- # rubocop:enable Style/StaticClass
22
- end