gemsmith 15.5.0 → 16.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/LICENSE.adoc +207 -155
- data/README.adoc +177 -189
- data/exe/gemsmith +6 -0
- data/gemsmith.gemspec +41 -0
- data/lib/gemsmith/builders/bundler.rb +34 -0
- data/lib/gemsmith/builders/cli.rb +86 -0
- data/lib/gemsmith/builders/git/commit.rb +46 -0
- data/lib/gemsmith/builders/git/ignore.rb +37 -0
- data/lib/gemsmith/builders/rspec/helper.rb +47 -0
- data/lib/gemsmith/builders/specification.rb +35 -0
- data/lib/gemsmith/cli/actions/build.rb +53 -0
- data/lib/gemsmith/cli/actions/config.rb +35 -0
- data/lib/gemsmith/cli/actions/edit.rb +38 -0
- data/lib/gemsmith/cli/actions/install.rb +36 -0
- data/lib/gemsmith/cli/actions/publish.rb +36 -0
- data/lib/gemsmith/cli/actions/view.rb +38 -0
- data/lib/gemsmith/cli/parser.rb +33 -0
- data/lib/gemsmith/cli/parsers/build.rb +54 -0
- data/lib/gemsmith/cli/parsers/core.rb +94 -0
- data/lib/gemsmith/cli/shell.rb +66 -0
- data/lib/gemsmith/configuration/enhancers/template_root.rb +20 -0
- data/lib/gemsmith/configuration/loader.rb +50 -0
- data/lib/gemsmith/container.rb +21 -0
- data/lib/gemsmith/gems/finder.rb +21 -0
- data/lib/gemsmith/gems/loader.rb +21 -0
- data/lib/gemsmith/gems/picker.rb +43 -0
- data/lib/gemsmith/gems/presenter.rb +50 -0
- data/lib/gemsmith/templates/%project_name%/%project_name%.gemspec.erb +49 -0
- data/lib/gemsmith/templates/%project_name%/exe/%project_name%.erb +5 -0
- data/lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/actions/config.rb.erb +35 -0
- data/lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/parser.rb.erb +31 -0
- data/lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/parsers/core.rb.erb +54 -0
- data/lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb +38 -0
- data/lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/content.rb.erb +18 -0
- data/lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/defaults.yml.erb +0 -0
- data/lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/loader.rb.erb +33 -0
- data/lib/gemsmith/templates/%project_name%/lib/%project_path%/container.rb.erb +35 -0
- data/lib/gemsmith/templates/{%gem_name%/lib/%gem_path%/identity.rb.tt → %project_name%/lib/%project_path%/identity.rb.erb} +1 -1
- data/lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/cli/actions/config_spec.rb.erb +24 -0
- data/lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/cli/parser_spec.rb.erb +25 -0
- data/lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/cli/parsers/core_spec.rb.erb +53 -0
- data/lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/cli/shell_spec.rb.erb +43 -0
- data/lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/configuration/content_spec.rb.erb +15 -0
- data/lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/configuration/loader_spec.rb.erb +29 -0
- data/lib/gemsmith/templates/%project_name%/spec/support/shared_contexts/application_container.rb.erb +22 -0
- data/lib/gemsmith/templates/%project_name%/spec/support/shared_examples/a_parser.rb.erb +7 -0
- data/lib/gemsmith/tools/cleaner.rb +29 -0
- data/lib/gemsmith/tools/editor.rb +30 -0
- data/lib/gemsmith/tools/installer.rb +39 -0
- data/lib/gemsmith/tools/packager.rb +33 -0
- data/lib/gemsmith/tools/publisher.rb +34 -0
- data/lib/gemsmith/tools/pusher.rb +36 -0
- data/lib/gemsmith/tools/validator.rb +28 -0
- data/lib/gemsmith/tools/versioner.rb +43 -0
- data/lib/gemsmith/tools/viewer.rb +28 -0
- data/lib/gemsmith.rb +5 -3
- data.tar.gz.sig +0 -0
- metadata +87 -115
- metadata.gz.sig +0 -0
- data/bin/gemsmith +0 -9
- data/lib/gemsmith/authenticators/basic.rb +0 -28
- data/lib/gemsmith/authenticators/ruby_gems.rb +0 -41
- data/lib/gemsmith/cli.rb +0 -259
- data/lib/gemsmith/credentials.rb +0 -82
- data/lib/gemsmith/errors/base.rb +0 -9
- data/lib/gemsmith/errors/requirement_conversion.rb +0 -9
- data/lib/gemsmith/errors/requirement_operator.rb +0 -9
- data/lib/gemsmith/errors/specification.rb +0 -9
- data/lib/gemsmith/gem/inspector.rb +0 -30
- data/lib/gemsmith/gem/module_formatter.rb +0 -50
- data/lib/gemsmith/gem/requirement.rb +0 -55
- data/lib/gemsmith/gem/specification.rb +0 -74
- data/lib/gemsmith/generators/base.rb +0 -46
- data/lib/gemsmith/generators/bundler.rb +0 -19
- data/lib/gemsmith/generators/bundler_audit.rb +0 -15
- data/lib/gemsmith/generators/circle_ci.rb +0 -14
- data/lib/gemsmith/generators/cli.rb +0 -17
- data/lib/gemsmith/generators/documentation.rb +0 -36
- data/lib/gemsmith/generators/engine.rb +0 -77
- data/lib/gemsmith/generators/gem.rb +0 -29
- data/lib/gemsmith/generators/git.rb +0 -45
- data/lib/gemsmith/generators/git_hub.rb +0 -15
- data/lib/gemsmith/generators/git_lint.rb +0 -14
- data/lib/gemsmith/generators/guard.rb +0 -14
- data/lib/gemsmith/generators/pragma.rb +0 -49
- data/lib/gemsmith/generators/rake.rb +0 -76
- data/lib/gemsmith/generators/reek.rb +0 -17
- data/lib/gemsmith/generators/rspec.rb +0 -39
- data/lib/gemsmith/generators/rubocop.rb +0 -18
- data/lib/gemsmith/generators/ruby.rb +0 -12
- data/lib/gemsmith/helpers/cli.rb +0 -59
- data/lib/gemsmith/helpers/template.rb +0 -30
- data/lib/gemsmith/identity.rb +0 -12
- data/lib/gemsmith/rake/builder.rb +0 -57
- data/lib/gemsmith/rake/publisher.rb +0 -100
- data/lib/gemsmith/rake/setup.rb +0 -4
- data/lib/gemsmith/rake/tasks.rb +0 -83
- data/lib/gemsmith/templates/%gem_name%/%gem_name%.gemspec.tt +0 -44
- data/lib/gemsmith/templates/%gem_name%/.circleci/config.yml.tt +0 -31
- data/lib/gemsmith/templates/%gem_name%/.github/ISSUE_TEMPLATE.md.tt +0 -14
- data/lib/gemsmith/templates/%gem_name%/.github/PULL_REQUEST_TEMPLATE.md.tt +0 -11
- data/lib/gemsmith/templates/%gem_name%/.gitignore.tt +0 -6
- data/lib/gemsmith/templates/%gem_name%/.reek.yml.tt +0 -6
- data/lib/gemsmith/templates/%gem_name%/.rubocop.yml.tt +0 -15
- data/lib/gemsmith/templates/%gem_name%/.ruby-version.tt +0 -1
- data/lib/gemsmith/templates/%gem_name%/CHANGES.md.tt +0 -3
- data/lib/gemsmith/templates/%gem_name%/CODE_OF_CONDUCT.md.tt +0 -66
- data/lib/gemsmith/templates/%gem_name%/CONTRIBUTING.md.tt +0 -22
- data/lib/gemsmith/templates/%gem_name%/Gemfile.tt +0 -47
- data/lib/gemsmith/templates/%gem_name%/Guardfile.tt +0 -21
- data/lib/gemsmith/templates/%gem_name%/LICENSE.md.tt +0 -20
- data/lib/gemsmith/templates/%gem_name%/README.md.tt +0 -93
- data/lib/gemsmith/templates/%gem_name%/Rakefile.tt +0 -12
- data/lib/gemsmith/templates/%gem_name%/bin/%gem_name%.tt +0 -8
- data/lib/gemsmith/templates/%gem_name%/bin/console.tt +0 -10
- data/lib/gemsmith/templates/%gem_name%/bin/setup.tt +0 -8
- data/lib/gemsmith/templates/%gem_name%/lib/%gem_path%/cli.rb.tt +0 -61
- data/lib/gemsmith/templates/%gem_name%/lib/%gem_path%/engine.rb.tt +0 -6
- data/lib/gemsmith/templates/%gem_name%/lib/%gem_path%.rb.tt +0 -7
- data/lib/gemsmith/templates/%gem_name%/lib/generators/%gem_path%/install/USAGE.tt +0 -8
- data/lib/gemsmith/templates/%gem_name%/lib/generators/%gem_path%/install/install_generator.rb.tt +0 -12
- data/lib/gemsmith/templates/%gem_name%/lib/generators/%gem_path%/upgrade/USAGE.tt +0 -8
- data/lib/gemsmith/templates/%gem_name%/lib/generators/%gem_path%/upgrade/upgrade_generator.rb.tt +0 -10
- data/lib/gemsmith/templates/%gem_name%/spec/lib/%gem_path%/cli_spec.rb.tt +0 -81
- data/lib/gemsmith/templates/%gem_name%/spec/rails_helper.rb.tt +0 -14
- data/lib/gemsmith/templates/%gem_name%/spec/spec_helper.rb.tt +0 -37
- data/lib/gemsmith/templates/%gem_name%/spec/support/shared_contexts/temp_dir.rb.tt +0 -9
@@ -1,61 +0,0 @@
|
|
1
|
-
require "thor"
|
2
|
-
require "thor/actions"
|
3
|
-
require "runcom"
|
4
|
-
|
5
|
-
<% render_namespace do %>
|
6
|
-
# The Command Line Interface (CLI) for the gem.
|
7
|
-
class CLI < Thor
|
8
|
-
include Thor::Actions
|
9
|
-
|
10
|
-
package_name Identity::VERSION_LABEL
|
11
|
-
|
12
|
-
def self.configuration
|
13
|
-
Runcom::Config.new "#{Identity::NAME}/configuration.yml"
|
14
|
-
end
|
15
|
-
|
16
|
-
def initialize args = [], options = {}, config = {}
|
17
|
-
super args, options, config
|
18
|
-
@configuration = self.class.configuration
|
19
|
-
rescue Runcom::Errors::Base => error
|
20
|
-
abort error.message
|
21
|
-
end
|
22
|
-
|
23
|
-
desc "-c, [--config]", "Manage gem configuration."
|
24
|
-
map %w[-c --config] => :config
|
25
|
-
method_option :edit,
|
26
|
-
aliases: "-e",
|
27
|
-
desc: "Edit gem configuration.",
|
28
|
-
type: :boolean,
|
29
|
-
default: false
|
30
|
-
method_option :info,
|
31
|
-
aliases: "-i",
|
32
|
-
desc: "Print gem configuration.",
|
33
|
-
type: :boolean,
|
34
|
-
default: false
|
35
|
-
def config
|
36
|
-
path = configuration.current
|
37
|
-
|
38
|
-
if options.edit? then `#{ENV["EDITOR"]} #{path}`
|
39
|
-
elsif options.info?
|
40
|
-
path ? say(path) : say("Configuration doesn't exist.")
|
41
|
-
else help :config
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
desc "-v, [--version]", "Show gem version."
|
46
|
-
map %w[-v --version] => :version
|
47
|
-
def version
|
48
|
-
say Identity::VERSION_LABEL
|
49
|
-
end
|
50
|
-
|
51
|
-
desc "-h, [--help=COMMAND]", "Show this message or get help for a command."
|
52
|
-
map %w[-h --help] => :help
|
53
|
-
def help task = nil
|
54
|
-
say and super
|
55
|
-
end
|
56
|
-
|
57
|
-
private
|
58
|
-
|
59
|
-
attr_reader :configuration
|
60
|
-
end
|
61
|
-
<% end %>
|
data/lib/gemsmith/templates/%gem_name%/lib/generators/%gem_path%/install/install_generator.rb.tt
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
require "pathname"
|
2
|
-
|
3
|
-
<% render_namespace do %>
|
4
|
-
# Generator for installing new files.
|
5
|
-
class InstallGenerator < Rails::Generators::Base
|
6
|
-
source_root Pathname(__dir__).join("../templates")
|
7
|
-
|
8
|
-
desc "Installs additional <%= config.dig(:gem, :label) %> resources."
|
9
|
-
def install
|
10
|
-
end
|
11
|
-
end
|
12
|
-
<% end %>
|
data/lib/gemsmith/templates/%gem_name%/lib/generators/%gem_path%/upgrade/upgrade_generator.rb.tt
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
<% render_namespace do %>
|
2
|
-
# Generator for updating existing files.
|
3
|
-
class UpgradeGenerator < Rails::Generators::Base
|
4
|
-
source_root Pathname(__dir__).join("../templates")
|
5
|
-
|
6
|
-
desc "Upgrades previously installed <%= config.dig(:gem, :label) %> resources."
|
7
|
-
def upgrade
|
8
|
-
end
|
9
|
-
end
|
10
|
-
<% end %>
|
@@ -1,81 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
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
|
-
|
10
|
-
let(:options) { [] }
|
11
|
-
let(:command_line) { Array(command).concat options }
|
12
|
-
|
13
|
-
shared_examples_for "a config command" do
|
14
|
-
context "with no options" do
|
15
|
-
it "prints help text" do
|
16
|
-
result = -> { cli }
|
17
|
-
expect(&result).to output(/Manage gem configuration./).to_stdout
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
shared_examples_for "a version command" do
|
23
|
-
it "prints version" do
|
24
|
-
result = -> { cli }
|
25
|
-
pattern = /#{Regexp.escape <%= config.dig(:gem, :class) %>::Identity::VERSION_LABEL}\n/o
|
26
|
-
|
27
|
-
expect(result).to output(pattern).to_stdout
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
shared_examples_for "a help command" do
|
32
|
-
it "prints usage" do
|
33
|
-
result = -> { cli }
|
34
|
-
pattern = /#{Regexp.escape <%= config.dig(:gem, :class) %>::Identity::VERSION_LABEL}\scommands:\n/o
|
35
|
-
|
36
|
-
expect(result).to output(pattern).to_stdout
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
describe "--config" do
|
41
|
-
let(:command) { "--config" }
|
42
|
-
|
43
|
-
it_behaves_like "a config command"
|
44
|
-
end
|
45
|
-
|
46
|
-
describe "-c" do
|
47
|
-
let(:command) { "-c" }
|
48
|
-
|
49
|
-
it_behaves_like "a config command"
|
50
|
-
end
|
51
|
-
|
52
|
-
describe "--version" do
|
53
|
-
let(:command) { "--version" }
|
54
|
-
|
55
|
-
it_behaves_like "a version command"
|
56
|
-
end
|
57
|
-
|
58
|
-
describe "-v" do
|
59
|
-
let(:command) { "-v" }
|
60
|
-
|
61
|
-
it_behaves_like "a version command"
|
62
|
-
end
|
63
|
-
|
64
|
-
describe "--help" do
|
65
|
-
let(:command) { "--help" }
|
66
|
-
|
67
|
-
it_behaves_like "a help command"
|
68
|
-
end
|
69
|
-
|
70
|
-
describe "-h" do
|
71
|
-
let(:command) { "-h" }
|
72
|
-
|
73
|
-
it_behaves_like "a help command"
|
74
|
-
end
|
75
|
-
|
76
|
-
context "with no command" do
|
77
|
-
let(:command) { nil }
|
78
|
-
|
79
|
-
it_behaves_like "a help command"
|
80
|
-
end
|
81
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
ENV["RAILS_ENV"] ||= "test"
|
2
|
-
require File.expand_path "dummy/config/environment", __dir__
|
3
|
-
ENV["RAILS_ROOT"] ||= File.dirname(__FILE__) + "/dummy"
|
4
|
-
|
5
|
-
require "spec_helper"
|
6
|
-
require "rspec/rails"
|
7
|
-
require "<%= config.dig(:gem, :path) %>"
|
8
|
-
|
9
|
-
RSpec.configure do |config|
|
10
|
-
config.include AbstractController::Translation
|
11
|
-
config.include ActiveSupport::Testing::TimeHelpers
|
12
|
-
config.include ActiveJob::TestHelper, type: :job
|
13
|
-
config.infer_spec_type_from_file_location!
|
14
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require "bundler/setup"
|
2
|
-
Bundler.require :tools
|
3
|
-
|
4
|
-
<%- if config.dig(:generate, :simple_cov) -%>
|
5
|
-
require "simplecov"
|
6
|
-
SimpleCov.start { enable_coverage :branch }
|
7
|
-
<%- end -%>
|
8
|
-
|
9
|
-
<%- unless config.dig(:generate, :engine) -%>
|
10
|
-
require "<%= config.dig(:gem, :path) %>"
|
11
|
-
<%- end -%>
|
12
|
-
|
13
|
-
GC.auto_compact = true
|
14
|
-
GC.verify_compaction_references double_heap: true, toward: :empty
|
15
|
-
|
16
|
-
Dir[File.join(__dir__, "support", "shared_contexts", "**/*.rb")].sort.each { |path| require path }
|
17
|
-
|
18
|
-
RSpec.configure do |config|
|
19
|
-
config.color = true
|
20
|
-
config.disable_monkey_patching!
|
21
|
-
config.example_status_persistence_file_path = "./tmp/rspec-examples.txt"
|
22
|
-
config.filter_run_when_matching :focus
|
23
|
-
config.formatter = ENV["CI"] == "true" ? :progress : :documentation
|
24
|
-
config.order = :random
|
25
|
-
config.shared_context_metadata_behavior = :apply_to_host_groups
|
26
|
-
config.warnings = true
|
27
|
-
|
28
|
-
config.expect_with :rspec do |expectations|
|
29
|
-
expectations.syntax = :expect
|
30
|
-
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
31
|
-
end
|
32
|
-
|
33
|
-
config.mock_with :rspec do |mocks|
|
34
|
-
mocks.verify_doubled_constant_names = true
|
35
|
-
mocks.verify_partial_doubles = true
|
36
|
-
end
|
37
|
-
end
|