gemsmith 12.3.0 → 12.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e71855a6f08321f65becd469a300372e139eb48b42a91d93848671ad7fafacf8
4
- data.tar.gz: 526912b2c040acd0bbabd0c40b5c9f5433174d1d190d385949af09f41a976aa3
3
+ metadata.gz: 6b44005b2a835fdd8da0dd85dfefba1bfe65fd26d4a511c1c755428a26c74a03
4
+ data.tar.gz: 98101b4e988c1628f0cf875a80d06cd7af672576c49a4ac61b3980f9fedb4028
5
5
  SHA512:
6
- metadata.gz: 1724540b1ecffb8e97a9d347bed31b509b942416d07e8bee9394052b4128d693fcd3510a6fcaf1ed4f95b061529ce2f41d8936049f00e0c6c9c2bdb43a5b3287
7
- data.tar.gz: b2ce13d02d7d27cd8605153c0fc169e40a4fd1bbff4165dbe689ae0c0db1e9db43efe7e36e010c1aac9c036b8e250a55e1eb05ceb680fbfcc47fa088398a8ff9
6
+ metadata.gz: 15aadf5fd3156836a11f0919d7b42c81838e6fc73781e74e05e186ebd361ef9a3fbf0912a51ce065e3d60d676b9e33dba5e1a8da946cc19ba5c6ca031209b541
7
+ data.tar.gz: 6bd18fb2cd91f3991b499af532b315372d669f5efb25fc2c53484d6d678f3a3ee05cf077676c3a8f6c05a7e631368812b682475ce0efc64e58da228389875e0c
Binary file
data.tar.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -57,7 +57,8 @@ A command line interface for smithing new Ruby gems.
57
57
  - Supports [Pry](http://pryrepl.org).
58
58
  - Supports [Reek](https://github.com/troessner/reek).
59
59
  - Supports [RSpec](http://rspec.info).
60
- - Supports [Rubocop](https://github.com/bbatsov/rubocop).
60
+ - Supports [Rubocop](https://github.com/rubocop-hq/rubocop).
61
+ - Supports [Rubocop RSpec](https://github.com/rubocop-hq/rubocop-rspec).
61
62
  - Supports [Ruby on Rails](http://rubyonrails.org).
62
63
  - Supports [RubyGems Security](http://guides.rubygems.org/security).
63
64
  - Supports [Thor](https://github.com/erikhuda/thor).
@@ -340,6 +341,7 @@ Once your gem is released, you might want to let the world know about your accom
340
341
  - [How to Spread the Word About Your Code](https://hacks.mozilla.org/2013/05/how-to-spread-the-word-about-your-code)
341
342
  - [Ruby Community](https://www.ruby-lang.org/en/community)
342
343
  - [RubyFlow](http://www.rubyflow.com)
344
+ - [RubyDaily](http://rubydaily.org)
343
345
  - [Ruby Devs Slack](https://rubydevs.herokuapp.com)
344
346
 
345
347
  ## Troubleshooting
@@ -8,15 +8,10 @@ require "gemsmith/authenticators/ruby_gems"
8
8
  module Gemsmith
9
9
  # Generates gem credentials for RubyGems and/or alternative servers.
10
10
  class Credentials
11
- attr_reader :key, :url
12
-
13
- def self.default_key
14
- :rubygems_api_key
15
- end
11
+ DEFAULT_KEY = :rubygems_api_key
12
+ DEFAULT_URL = "https://rubygems.org"
16
13
 
17
- def self.default_url
18
- "https://rubygems.org"
19
- end
14
+ attr_reader :key, :url
20
15
 
21
16
  def self.file_path
22
17
  File.join ENV.fetch("HOME"), ".gem", "credentials"
@@ -26,14 +21,11 @@ module Gemsmith
26
21
  [Authenticators::RubyGems, Authenticators::Basic]
27
22
  end
28
23
 
29
- # :reek:DuplicateMethodCall
30
- def initialize key: self.class.default_key,
31
- url: self.class.default_url,
32
- shell: Thor::Shell::Basic.new
24
+ def initialize key: DEFAULT_KEY, url: DEFAULT_URL, shell: Thor::Shell::Basic.new
33
25
  @key = key
34
26
  @url = url
35
27
  @shell = shell
36
- @credentials = load_credentials
28
+ @credentials = read
37
29
  end
38
30
 
39
31
  def authenticator
@@ -46,39 +38,41 @@ module Gemsmith
46
38
  end
47
39
 
48
40
  def valid?
49
- credentials? && !String(credentials[key]).empty?
41
+ exist? && !String(credentials[key]).empty?
50
42
  end
51
43
 
52
- # rubocop:disable Metrics/AbcSize
53
- # :reek:TooManyStatements
54
44
  def create
55
- return if valid?
56
-
57
- login = shell.ask %(What is your "#{url}" login?)
58
- password = shell.ask %(What is your "#{url}" password?), echo: false
59
- shell.say
60
-
61
- new_credentials = credentials.merge key => authenticator.new(login, password).authorization
62
-
63
- file_path = self.class.file_path
64
- FileUtils.mkdir_p File.dirname file_path
65
- File.open(file_path, "w") { |file| file << YAML.dump(new_credentials) }
66
- FileUtils.chmod(0o600, file_path)
45
+ write unless valid?
67
46
  end
68
- # rubocop:enable Metrics/AbcSize
69
47
 
70
48
  private
71
49
 
72
50
  attr_reader :credentials, :shell
73
51
 
74
- def credentials?
52
+ def exist?
75
53
  File.exist? self.class.file_path
76
54
  end
77
55
 
78
- def load_credentials
56
+ def read
79
57
  Hash YAML.load_file(self.class.file_path)
80
58
  rescue StandardError
81
59
  {}
82
60
  end
61
+
62
+ def write
63
+ file_path = self.class.file_path
64
+
65
+ FileUtils.mkdir_p File.dirname file_path
66
+ File.open(file_path, "w") { |file| file << YAML.dump(update) }
67
+ FileUtils.chmod 0o600, file_path
68
+ end
69
+
70
+ def update
71
+ login = shell.ask %(What is your "#{url}" login?)
72
+ password = shell.ask %(What is your "#{url}" password?), echo: false
73
+ shell.say
74
+
75
+ credentials.merge key => authenticator.new(login, password).authorization
76
+ end
83
77
  end
84
78
  end
@@ -35,6 +35,7 @@ module Gemsmith
35
35
  def body content
36
36
  content.lstrip.split("\n").reduce "" do |body, line|
37
37
  next "#{body}\n" if line.blank?
38
+
38
39
  body + "#{self.class.indent depth + 1}#{line.gsub(/^\s{2}/, "")}\n"
39
40
  end
40
41
  end
@@ -65,6 +65,7 @@ module Gemsmith
65
65
 
66
66
  def validate
67
67
  return if spec.is_a?(self.class.specification)
68
+
68
69
  fail(Errors::Specification, %(Unknown gem specification: "#{file_path}".))
69
70
  end
70
71
  end
@@ -7,7 +7,7 @@ module Gemsmith
7
7
  def run
8
8
  Dir.chdir(gem_root) do
9
9
  cli.say_status :info, "Installing gem dependencies...", :green
10
- `bundle install`
10
+ cli.run "bundle install"
11
11
  end
12
12
  end
13
13
  end
@@ -6,6 +6,7 @@ module Gemsmith
6
6
  class CircleCI < Base
7
7
  def run
8
8
  return unless configuration.dig(:generate, :circle_ci)
9
+
9
10
  template "%gem_name%/circle.yml.tt"
10
11
  end
11
12
  end
@@ -6,6 +6,7 @@ module Gemsmith
6
6
  class CodeClimate < Base
7
7
  def run
8
8
  return unless configuration.dig(:generate, :code_climate)
9
+
9
10
  template "%gem_name%/.codeclimate.yml.tt"
10
11
  end
11
12
  end
@@ -11,6 +11,7 @@ module Gemsmith
11
11
  def install_rails
12
12
  return if rails?
13
13
  return unless cli.yes?("Ruby on Rails is not installed. Would you like it installed (y/n)?")
14
+
14
15
  cli.run "gem install rails"
15
16
  end
16
17
 
@@ -6,6 +6,7 @@ module Gemsmith
6
6
  class GitCop < Base
7
7
  def run
8
8
  return unless configuration.dig(:generate, :git_cop)
9
+
9
10
  cli.uncomment_lines "#{gem_name}/Rakefile", %r(require.+git\/cop.+)
10
11
  end
11
12
  end
@@ -6,6 +6,7 @@ module Gemsmith
6
6
  class GitHub < Base
7
7
  def run
8
8
  return unless configuration.dig(:generate, :git_hub)
9
+
9
10
  template "%gem_name%/.github/ISSUE_TEMPLATE.md.tt"
10
11
  template "%gem_name%/.github/PULL_REQUEST_TEMPLATE.md.tt"
11
12
  end
@@ -6,6 +6,7 @@ module Gemsmith
6
6
  class Guard < Base
7
7
  def run
8
8
  return unless configuration.dig(:generate, :guard)
9
+
9
10
  template "%gem_name%/Guardfile.tt"
10
11
  end
11
12
  end
@@ -10,11 +10,13 @@ module Gemsmith
10
10
 
11
11
  def generate_code_quality_task
12
12
  return "" if code_quality_tasks.empty?
13
+
13
14
  %(\ndesc "Run code quality checks"\ntask code_quality: %i[#{code_quality_tasks}]\n)
14
15
  end
15
16
 
16
17
  def generate_default_task
17
18
  return "" if default_task.empty?
19
+
18
20
  %(\ntask default: %i[#{default_task}]\n)
19
21
  end
20
22
 
@@ -65,11 +67,13 @@ module Gemsmith
65
67
 
66
68
  def append_code_quality_task
67
69
  return if code_quality_task.empty?
70
+
68
71
  cli.append_to_file "%gem_name%/Rakefile", generate_code_quality_task
69
72
  end
70
73
 
71
74
  def append_default_task
72
75
  return if default_task.empty?
76
+
73
77
  cli.append_to_file "%gem_name%/Rakefile", generate_default_task
74
78
  end
75
79
  end
@@ -30,6 +30,7 @@ module Gemsmith
30
30
 
31
31
  def install_rails_helper
32
32
  return unless configuration.dig(:generate, :engine)
33
+
33
34
  template "#{rspec_root}/rails_helper.rb.tt"
34
35
  end
35
36
  end
@@ -13,6 +13,7 @@ module Gemsmith
13
13
 
14
14
  def self.github_url project
15
15
  return "" if github_user.empty?
16
+
16
17
  "https://github.com/#{github_user}/#{project}"
17
18
  end
18
19
  end
@@ -34,6 +34,7 @@ module Gemsmith
34
34
 
35
35
  def inspect_gem specification, method
36
36
  return unless specification
37
+
37
38
  Gem::Inspector.new.public_send method, Gem::Specification.new(specification.spec_file)
38
39
  rescue Versionaire::Errors::Conversion => error
39
40
  say_status :error, error.message, :red
@@ -12,7 +12,7 @@ module Gemsmith
12
12
  end
13
13
 
14
14
  def self.version
15
- "12.3.0"
15
+ "12.4.0"
16
16
  end
17
17
 
18
18
  def self.version_label
@@ -27,6 +27,7 @@ module Gemsmith
27
27
 
28
28
  def validate
29
29
  return if `git status --porcelain`.empty?
30
+
30
31
  shell.error "Build failed: Gem has uncommitted changes."
31
32
  kernel.exit 1
32
33
  end
@@ -64,7 +64,7 @@ module Gemsmith
64
64
  end
65
65
 
66
66
  def translate_key key
67
- key == credentials.default_key ? :rubygems : key
67
+ key == credentials::DEFAULT_KEY ? :rubygems : key
68
68
  end
69
69
 
70
70
  def process_push status
@@ -55,7 +55,10 @@ Gem::Specification.new do |spec|
55
55
  spec.add_development_dependency "<%= config.dig(:generate, :engine) ? "rspec-rails" : "rspec" %>", "~> 3.8"
56
56
  <%- end -%>
57
57
  <%- if config.dig(:generate, :rubocop) -%>
58
- spec.add_development_dependency "rubocop", "~> 0.58"
58
+ spec.add_development_dependency "rubocop", "~> 0.60"
59
+ <%- end -%>
60
+ <%- if config.dig(:generate, :rubocop) && config.dig(:generate, :rspec) -%>
61
+ spec.add_development_dependency "rubocop-rspec", "~> 1.30"
59
62
  <%- end -%>
60
63
 
61
64
  <%- if config.dig(:generate, :engine) -%>
@@ -1,5 +1,13 @@
1
1
  inherit_from:
2
- - https://raw.githubusercontent.com/bkuhlmann/code_quality/v2.1.0/configurations/rubocop/ruby.yml
2
+ - https://raw.githubusercontent.com/bkuhlmann/code_quality/2.5.0/configurations/rubocop/ruby.yml
3
+ <%- if config.dig(:generate, :rspec) -%>
4
+ - https://raw.githubusercontent.com/bkuhlmann/code_quality/2.5.0/configurations/rubocop/rspec.yml
5
+ <%- end -%>
3
6
  <%- if config.dig(:generate, :engine) -%>
4
- - https://raw.githubusercontent.com/bkuhlmann/code_quality/v2.1.0/configurations/rubocop/rails.yml
7
+ - https://raw.githubusercontent.com/bkuhlmann/code_quality/2.5.0/configurations/rubocop/rails.yml
8
+ <%- end -%>
9
+
10
+ <%- if config.dig(:generate, :cli) -%>
11
+ Lint/Void:
12
+ CheckForMethodsWithNoSideEffects: false
5
13
  <%- end -%>
@@ -2,10 +2,11 @@
2
2
 
3
3
  ## Our Pledge
4
4
 
5
- In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making
6
- participation in our project and our community a harassment-free experience for everyone, regardless of age, body size,
7
- disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race,
8
- religion, or sexual identity and orientation.
5
+ In the interest of fostering an open and welcoming environment, we as contributors and maintainers
6
+ pledge to making participation in our project and our community a harassment-free experience for
7
+ everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity
8
+ and expression, level of experience, education, socio-economic status, nationality, personal
9
+ appearance, race, religion, or sexual identity and orientation.
9
10
 
10
11
  ## Our Standards
11
12
 
@@ -22,40 +23,44 @@ Examples of unacceptable behavior by participants include:
22
23
  * The use of sexualized language or imagery and unwelcome sexual attention or advances
23
24
  * Trolling, insulting/derogatory comments, and personal or political attacks
24
25
  * Public or private harassment
25
- * Publishing others' private information, such as a physical or electronic address, without explicit permission
26
+ * Publishing others' private information, such as a physical or electronic address, without explicit
27
+ permission
26
28
  * Other conduct which could reasonably be considered inappropriate in a professional setting
27
29
 
28
30
  ## Our Responsibilities
29
31
 
30
- Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take
31
- appropriate and fair corrective action in response to any instances of unacceptable behavior.
32
+ Project maintainers are responsible for clarifying the standards of acceptable behavior and are
33
+ expected to take appropriate and fair corrective action in response to any instances of unacceptable
34
+ behavior.
32
35
 
33
- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits,
34
- issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any
35
- contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
36
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits,
37
+ code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or
38
+ to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate,
39
+ threatening, offensive, or harmful.
36
40
 
37
41
  ## Scope
38
42
 
39
- This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the
40
- project or its community. Examples of representing a project or community include using an official project e-mail
41
- address, posting via an official social media account, or acting as an appointed representative at an online or offline
42
- event. Representation of a project may be further defined and clarified by project maintainers.
43
+ This Code of Conduct applies both within project spaces and in public spaces when an individual is
44
+ representing the project or its community. Examples of representing a project or community include
45
+ using an official project e-mail address, posting via an official social media account, or acting as
46
+ an appointed representative at an online or offline event. Representation of a project may be
47
+ further defined and clarified by project maintainers.
43
48
 
44
49
  ## Enforcement
45
50
 
46
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at
47
- [<%= config.dig :author, :email %>](mailto:<%= config.dig :author, :email %>). All complaints will be reviewed and
48
- investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project
49
- team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific
50
- enforcement policies may be posted separately.
51
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting
52
+ the project team at [<%= config.dig :author, :name %>](mailto:<%= config.dig :author, :email %>).
53
+ All complaints will be reviewed and investigated and will result in a response that is deemed
54
+ necessary and appropriate to the circumstances. The project team is obligated to maintain
55
+ confidentiality with regard to the reporter of an incident. Further details of specific enforcement
56
+ policies may be posted separately.
51
57
 
52
- Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent
53
- repercussions as determined by other members of the project's leadership.
58
+ Project maintainers who do not follow or enforce the Code of Conduct in good faith may face
59
+ temporary or permanent repercussions as determined by other members of the project's leadership.
54
60
 
55
61
  ## Attribution
56
62
 
57
63
  This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
58
- available at [http://contributor-covenant.org/version/1/4][version]
64
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
59
65
 
60
- [homepage]: http://contributor-covenant.org
61
- [version]: http://contributor-covenant.org/version/1/4/
66
+ [homepage]: https://www.contributor-covenant.org
@@ -32,36 +32,43 @@ RSpec.describe <%= config.dig(:gem, :class) %>::CLI do
32
32
 
33
33
  describe "--config" do
34
34
  let(:command) { "--config" }
35
+
35
36
  it_behaves_like "a config command"
36
37
  end
37
38
 
38
39
  describe "-c" do
39
40
  let(:command) { "-c" }
41
+
40
42
  it_behaves_like "a config command"
41
43
  end
42
44
 
43
45
  describe "--version" do
44
46
  let(:command) { "--version" }
47
+
45
48
  it_behaves_like "a version command"
46
49
  end
47
50
 
48
51
  describe "-v" do
49
52
  let(:command) { "-v" }
53
+
50
54
  it_behaves_like "a version command"
51
55
  end
52
56
 
53
57
  describe "--help" do
54
58
  let(:command) { "--help" }
59
+
55
60
  it_behaves_like "a help command"
56
61
  end
57
62
 
58
63
  describe "-h" do
59
64
  let(:command) { "-h" }
65
+
60
66
  it_behaves_like "a help command"
61
67
  end
62
68
 
63
69
  context "with no command" do
64
70
  let(:command) { nil }
71
+
65
72
  it_behaves_like "a help command"
66
73
  end
67
74
  end
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: 12.3.0
4
+ version: 12.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -29,7 +29,7 @@ cert_chain:
29
29
  4Zrsxi713z6sndd9JBAm4G7mJiV93MsuCM5N4ZDY7XaxIhvctNSNhX/Yn8LLdtGI
30
30
  b4jw5t40FKyNUvLPPXYAvQALBtk=
31
31
  -----END CERTIFICATE-----
32
- date: 2018-08-07 00:00:00.000000000 Z
32
+ date: 2018-11-18 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: bundler
@@ -93,14 +93,14 @@ dependencies:
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0.58'
96
+ version: '0.60'
97
97
  type: :runtime
98
98
  prerelease: false
99
99
  version_requirements: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0.58'
103
+ version: '0.60'
104
104
  - !ruby/object:Gem::Dependency
105
105
  name: runcom
106
106
  requirement: !ruby/object:Gem::Requirement
@@ -339,6 +339,20 @@ dependencies:
339
339
  - - "~>"
340
340
  - !ruby/object:Gem::Version
341
341
  version: '3.8'
342
+ - !ruby/object:Gem::Dependency
343
+ name: rubocop-rspec
344
+ requirement: !ruby/object:Gem::Requirement
345
+ requirements:
346
+ - - "~>"
347
+ - !ruby/object:Gem::Version
348
+ version: '1.30'
349
+ type: :development
350
+ prerelease: false
351
+ version_requirements: !ruby/object:Gem::Requirement
352
+ requirements:
353
+ - - "~>"
354
+ - !ruby/object:Gem::Version
355
+ version: '1.30'
342
356
  - !ruby/object:Gem::Dependency
343
357
  name: wirb
344
358
  requirement: !ruby/object:Gem::Requirement
@@ -460,7 +474,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
460
474
  version: '0'
461
475
  requirements: []
462
476
  rubyforge_project:
463
- rubygems_version: 2.7.7
477
+ rubygems_version: 2.7.8
464
478
  signing_key:
465
479
  specification_version: 4
466
480
  summary: A command line interface for smithing new Ruby gems.
metadata.gz.sig CHANGED
Binary file