rubysmith 0.9.1 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/bin/rubysmith +0 -1
  5. data/lib/rubysmith.rb +3 -2
  6. data/lib/rubysmith/builder.rb +13 -26
  7. data/lib/rubysmith/builders/bundler.rb +6 -8
  8. data/lib/rubysmith/builders/console.rb +6 -8
  9. data/lib/rubysmith/builders/core.rb +7 -8
  10. data/lib/rubysmith/builders/documentation.rb +16 -21
  11. data/lib/rubysmith/builders/git/commit.rb +7 -11
  12. data/lib/rubysmith/builders/git/setup.rb +6 -8
  13. data/lib/rubysmith/builders/guard.rb +9 -9
  14. data/lib/rubysmith/builders/pragma.rb +8 -13
  15. data/lib/rubysmith/builders/rake.rb +5 -7
  16. data/lib/rubysmith/builders/reek.rb +6 -8
  17. data/lib/rubysmith/builders/rspec/context.rb +10 -11
  18. data/lib/rubysmith/builders/rspec/helper.rb +6 -8
  19. data/lib/rubysmith/builders/rubocop/formatter.rb +5 -7
  20. data/lib/rubysmith/builders/rubocop/setup.rb +7 -9
  21. data/lib/rubysmith/builders/ruby_critic.rb +6 -8
  22. data/lib/rubysmith/builders/setup.rb +8 -8
  23. data/lib/rubysmith/cli/configuration/content.rb +69 -0
  24. data/lib/rubysmith/cli/{defaults.yml → configuration/defaults.yml} +0 -0
  25. data/lib/rubysmith/cli/configuration/loader.rb +35 -0
  26. data/lib/rubysmith/cli/parsers.rb +11 -0
  27. data/lib/rubysmith/cli/parsers/assembler.rb +10 -15
  28. data/lib/rubysmith/cli/parsers/build.rb +4 -6
  29. data/lib/rubysmith/cli/parsers/core.rb +5 -9
  30. data/lib/rubysmith/cli/processors/build.rb +9 -8
  31. data/lib/rubysmith/cli/processors/config.rb +3 -7
  32. data/lib/rubysmith/cli/shell.rb +7 -14
  33. data/lib/rubysmith/identity.rb +1 -1
  34. data/lib/rubysmith/pathway.rb +3 -9
  35. data/lib/rubysmith/renderers/erb.rb +7 -9
  36. data/lib/rubysmith/renderers/namespace.rb +1 -3
  37. data/lib/rubysmith/templates/%project_name%/.rubocop.yml.erb +1 -1
  38. data/lib/rubysmith/templates/%project_name%/CHANGES.adoc.erb +1 -1
  39. data/lib/rubysmith/templates/%project_name%/CHANGES.md.erb +1 -1
  40. data/lib/rubysmith/templates/%project_name%/CODE_OF_CONDUCT.adoc.erb +2 -2
  41. data/lib/rubysmith/templates/%project_name%/CODE_OF_CONDUCT.md.erb +1 -1
  42. data/lib/rubysmith/templates/%project_name%/Gemfile.erb +14 -14
  43. data/lib/rubysmith/templates/%project_name%/LICENSE-apache.adoc.erb +1 -1
  44. data/lib/rubysmith/templates/%project_name%/LICENSE-apache.md.erb +1 -1
  45. data/lib/rubysmith/templates/%project_name%/LICENSE-mit.adoc.erb +1 -1
  46. data/lib/rubysmith/templates/%project_name%/LICENSE-mit.md.erb +1 -1
  47. data/lib/rubysmith/templates/%project_name%/README.adoc.erb +5 -5
  48. data/lib/rubysmith/templates/%project_name%/README.md.erb +5 -5
  49. data/lib/rubysmith/templates/%project_name%/Rakefile.erb +15 -15
  50. data/lib/rubysmith/templates/%project_name%/bin/console.erb +1 -1
  51. data/lib/rubysmith/templates/%project_name%/lib/%project_name%.rb.erb +1 -1
  52. data/lib/rubysmith/templates/%project_name%/spec/spec_helper.rb.erb +6 -4
  53. data/lib/rubysmith/templates/%project_name%/spec/support/shared_contexts/temp_dir.rb.erb +3 -3
  54. metadata +7 -6
  55. metadata.gz.sig +0 -0
  56. data/lib/rubysmith/cli/configuration.rb +0 -30
  57. data/lib/rubysmith/realm.rb +0 -74
@@ -1,47 +1,47 @@
1
1
  require "bundler/setup"
2
2
 
3
- <% if realm.build_bundler_audit %>
3
+ <% if configuration.build_bundler_audit %>
4
4
  require "bundler/audit/task"
5
5
  <% end %>
6
- <% if realm.build_bundler_leak %>
6
+ <% if configuration.build_bundler_leak %>
7
7
  require "bundler/plumber/task"
8
8
  <% end %>
9
- <% if realm.build_git && realm.build_git_lint %>
9
+ <% if configuration.build_git && configuration.build_git_lint %>
10
10
  require "git/lint/rake/setup"
11
11
  <% end %>
12
- <% if realm.build_reek %>
12
+ <% if configuration.build_reek %>
13
13
  require "reek/rake/task"
14
14
  <% end %>
15
- <% if realm.build_rspec %>
15
+ <% if configuration.build_rspec %>
16
16
  require "rspec/core/rake_task"
17
17
  <% end %>
18
- <% if realm.build_rubocop %>
18
+ <% if configuration.build_rubocop %>
19
19
  require "rubocop/rake_task"
20
20
  <% end %>
21
- <% if realm.build_ruby_critic %>
21
+ <% if configuration.build_ruby_critic %>
22
22
  require "rubycritic/rake_task"
23
23
  <% end %>
24
24
 
25
- <% if realm.build_bundler_audit %>
25
+ <% if configuration.build_bundler_audit %>
26
26
  Bundler::Audit::Task.new
27
27
  <% end %>
28
- <% if realm.build_bundler_leak %>
28
+ <% if configuration.build_bundler_leak %>
29
29
  Bundler::Plumber::Task.new
30
30
  <% end %>
31
- <% if realm.build_reek %>
31
+ <% if configuration.build_reek %>
32
32
  Reek::Rake::Task.new
33
33
  <% end %>
34
- <% if realm.build_rspec %>
34
+ <% if configuration.build_rspec %>
35
35
  RSpec::Core::RakeTask.new :spec
36
36
  <% end %>
37
- <% if realm.build_rubocop %>
37
+ <% if configuration.build_rubocop %>
38
38
  RuboCop::RakeTask.new
39
39
  <% end %>
40
- <% if realm.build_ruby_critic %>
40
+ <% if configuration.build_ruby_critic %>
41
41
  RubyCritic::RakeTask.new
42
42
  <% end %>
43
43
 
44
44
  desc "Run code quality checks"
45
- task code_quality: %i[<% if realm.build_bundler_audit %>bundle:audit<% end %> <% if realm.build_bundler_leak %>bundle:leak<% end %> <% if realm.build_git && realm.build_git_lint %>git_lint<% end %> <% if realm.build_reek %>reek<% end %> <% if realm.build_rubocop %>rubocop<% end %> <% if realm.build_ruby_critic %>rubycritic<% end %>]
45
+ task code_quality: %i[<% if configuration.build_bundler_audit %>bundle:audit<% end %> <% if configuration.build_bundler_leak %>bundle:leak<% end %> <% if configuration.build_git && configuration.build_git_lint %>git_lint<% end %> <% if configuration.build_reek %>reek<% end %> <% if configuration.build_rubocop %>rubocop<% end %> <% if configuration.build_ruby_critic %>rubycritic<% end %>]
46
46
 
47
- task default: %i[code_quality <% if realm.build_rspec %>spec<% end %>]
47
+ task default: %i[code_quality <% if configuration.build_rspec %>spec<% end %>]
@@ -3,7 +3,7 @@
3
3
  require "bundler/setup"
4
4
  Bundler.require :tools
5
5
 
6
- require_relative "../lib/<%= realm.project_name %>"
6
+ require_relative "../lib/<%= configuration.project_name %>"
7
7
  require "irb"
8
8
 
9
9
  IRB.start __FILE__
@@ -1,3 +1,3 @@
1
1
  # The project namespace.
2
- module <%= realm.project_class %>
2
+ module <%= configuration.project_class %>
3
3
  end
@@ -1,18 +1,20 @@
1
1
  require "bundler/setup"
2
2
  Bundler.require :tools
3
3
 
4
- <% if realm.build_simple_cov %>
4
+ <% if configuration.build_simple_cov %>
5
5
  require "simplecov"
6
6
  SimpleCov.start { enable_coverage :branch }
7
7
  <% end %>
8
8
 
9
- require "<%= realm.project_name %>"
10
- <% if realm.build_refinements %>require "refinements"<% end %>
9
+ require "<%= configuration.project_name %>"
10
+ <% if configuration.build_refinements %>
11
+ require "refinements"
12
+ <% end %>
11
13
 
12
14
  GC.auto_compact = true
13
15
  GC.verify_compaction_references double_heap: true, toward: :empty
14
16
 
15
- <% if realm.build_refinements %>
17
+ <% if configuration.build_refinements %>
16
18
  using Refinements::Pathnames
17
19
 
18
20
  Pathname.require_tree __dir__, "support/shared_contexts/**/*.rb"
@@ -1,11 +1,11 @@
1
1
  RSpec.shared_context "with temporary directory" do
2
- <% if realm.build_refinements %>using Refinements::Pathnames<% end %>
2
+ <% if configuration.build_refinements %>using Refinements::Pathnames<% end %>
3
3
 
4
4
  let(:temp_dir) { Bundler.root.join "tmp/rspec" }
5
5
 
6
6
  around do |example|
7
- <%= realm.build_refinements ? "temp_dir.make_path" : "FileUtils.mkdir_p temp_dir" %>
7
+ <%= configuration.build_refinements ? "temp_dir.make_path" : "FileUtils.mkdir_p temp_dir" %>
8
8
  example.run
9
- <%= realm.build_refinements ? "temp_dir.remove_tree" : "FileUtils.rm_rf temp_dir" %>
9
+ <%= configuration.build_refinements ? "temp_dir.remove_tree" : "FileUtils.rm_rf temp_dir" %>
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubysmith
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -28,7 +28,7 @@ cert_chain:
28
28
  lkHilIrX69jq8wMPpBhlaw2mRmeSL50Wv5u6xVBvOHhXFSP1crXM95vfLhLyRYod
29
29
  W2A=
30
30
  -----END CERTIFICATE-----
31
- date: 2021-04-04 00:00:00.000000000 Z
31
+ date: 2021-04-18 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: pragmater
@@ -117,8 +117,10 @@ files:
117
117
  - lib/rubysmith/builders/rubocop/setup.rb
118
118
  - lib/rubysmith/builders/ruby_critic.rb
119
119
  - lib/rubysmith/builders/setup.rb
120
- - lib/rubysmith/cli/configuration.rb
121
- - lib/rubysmith/cli/defaults.yml
120
+ - lib/rubysmith/cli/configuration/content.rb
121
+ - lib/rubysmith/cli/configuration/defaults.yml
122
+ - lib/rubysmith/cli/configuration/loader.rb
123
+ - lib/rubysmith/cli/parsers.rb
122
124
  - lib/rubysmith/cli/parsers/assembler.rb
123
125
  - lib/rubysmith/cli/parsers/build.rb
124
126
  - lib/rubysmith/cli/parsers/core.rb
@@ -127,7 +129,6 @@ files:
127
129
  - lib/rubysmith/cli/shell.rb
128
130
  - lib/rubysmith/identity.rb
129
131
  - lib/rubysmith/pathway.rb
130
- - lib/rubysmith/realm.rb
131
132
  - lib/rubysmith/renderers/erb.rb
132
133
  - lib/rubysmith/renderers/namespace.rb
133
134
  - lib/rubysmith/templates/%project_name%/.reek.yml.erb
@@ -180,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
181
  - !ruby/object:Gem::Version
181
182
  version: '0'
182
183
  requirements: []
183
- rubygems_version: 3.2.15
184
+ rubygems_version: 3.2.16
184
185
  signing_key:
185
186
  specification_version: 4
186
187
  summary: A command line interface for smithing Ruby projects.
metadata.gz.sig CHANGED
Binary file
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "pathname"
4
- require "refinements/hashes"
5
- require "runcom"
6
- require "yaml"
7
-
8
- module Rubysmith
9
- module CLI
10
- # Represents the fully assembled Command Line Interface (CLI) configuration.
11
- class Configuration
12
- using Refinements::Hashes
13
-
14
- DEFAULTS = YAML.load_file(Pathname(__dir__).join("defaults.yml")).freeze
15
- CLIENT = Runcom::Config.new "#{Identity::NAME}/configuration.yml", defaults: DEFAULTS
16
-
17
- def initialize client: CLIENT
18
- @client = client
19
- end
20
-
21
- def to_h
22
- client.to_h.flatten_keys
23
- end
24
-
25
- private
26
-
27
- attr_reader :client
28
- end
29
- end
30
- end
@@ -1,74 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "pathname"
4
- require "refinements/strings"
5
-
6
- module Rubysmith
7
- REALM_KEYS = %i[
8
- config
9
- template_root
10
- template_path
11
- build_root
12
- project_name
13
- author_name
14
- author_email
15
- author_url
16
- now
17
- documentation_format
18
- documentation_license
19
- build_minimum
20
- build_amazing_print
21
- build_bundler_audit
22
- build_bundler_leak
23
- build_console
24
- build_documentation
25
- build_git
26
- build_git_lint
27
- build_guard
28
- build_pry
29
- build_reek
30
- build_refinements
31
- build_rspec
32
- build_rubocop
33
- build_ruby_critic
34
- build_setup
35
- build_simple_cov
36
- builders_pragmater_comments
37
- builders_pragmater_includes
38
- version
39
- help
40
- ].freeze
41
-
42
- # Represents the common context in which all builders and templates operate in.
43
- Realm = Struct.new(*REALM_KEYS, keyword_init: true) do
44
- using Refinements::Strings
45
-
46
- def initialize *arguments
47
- super
48
-
49
- self[:template_root] ||= Pathname(__dir__).join("templates").expand_path
50
- self[:build_root] ||= Pathname.pwd
51
- freeze
52
- end
53
-
54
- def with attributes
55
- self.class.new to_h.merge(attributes)
56
- end
57
-
58
- def project_label
59
- project_name.titleize
60
- end
61
-
62
- def project_class
63
- project_name.camelcase
64
- end
65
-
66
- def project_root
67
- build_root.join project_name
68
- end
69
-
70
- def to_pathway
71
- Pathway[start_root: template_root, start_path: template_path, end_root: build_root]
72
- end
73
- end
74
- end