nugem 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -9
  3. data/README.md +6 -0
  4. data/exe/nugem +9 -0
  5. data/lib/nugem/cli/cli_gem.rb +2 -2
  6. data/lib/nugem/version.rb +1 -1
  7. data/nugem.gemspec +2 -2
  8. data/templates/common/LICENCE.txt.tt +21 -0
  9. data/templates/common/executable_scaffold/exe/%gem_name%.tt +5 -0
  10. data/templates/common/executable_scaffold/lib/%gem_name%/cli.rb.tt +13 -0
  11. data/templates/common/gem_scaffold/%gem_name%.gemspec.tt +58 -0
  12. data/templates/common/gem_scaffold/CHANGELOG.md.tt +2 -0
  13. data/templates/common/gem_scaffold/Gemfile.tt +56 -0
  14. data/templates/common/gem_scaffold/README.md.tt +62 -0
  15. data/templates/common/gem_scaffold/Rakefile.tt +51 -0
  16. data/templates/common/gem_scaffold/bin/attach +34 -0
  17. data/templates/common/gem_scaffold/bin/console.tt +10 -0
  18. data/templates/common/gem_scaffold/bin/rake +13 -0
  19. data/templates/common/gem_scaffold/bin/setup.tt +24 -0
  20. data/templates/common/gem_scaffold/lib/%gem_name%/version.rb.tt +3 -0
  21. data/templates/common/gem_scaffold/lib/%gem_name%.rb.tt +12 -0
  22. data/templates/common/gem_scaffold/test/%gem_name%_test.rb.tt +11 -0
  23. data/templates/common/gem_scaffold/test/test_helper.rb.tt +96 -0
  24. data/templates/jekyll/block_no_arg_scaffold/lib/%block_name%.rb.tt +23 -0
  25. data/templates/jekyll/block_scaffold/lib/%block_name%.rb.tt +50 -0
  26. data/templates/jekyll/common_scaffold/spec/%gem_name%_spec.rb.tt +13 -0
  27. data/templates/jekyll/common_scaffold/spec/spec_helper.rb +79 -0
  28. data/templates/jekyll/demo/demo/Gemfile.tt +21 -0
  29. data/templates/jekyll/demo/demo/_bin/debug +71 -0
  30. data/templates/jekyll/demo/demo/_config.yml.tt +48 -0
  31. data/templates/jekyll/demo/demo/_drafts/2022/2022-05-01-test2.html +15 -0
  32. data/templates/jekyll/demo/demo/_includes/block_tag_template_wrapper +9 -0
  33. data/templates/jekyll/demo/demo/_layouts/default.html.tt +67 -0
  34. data/templates/jekyll/demo/demo/_posts/2022/2022-01-02-redact-test.html +12 -0
  35. data/templates/jekyll/demo/demo/assets/css/style.css +218 -0
  36. data/templates/jekyll/demo/demo/assets/images/404-error.png +0 -0
  37. data/templates/jekyll/demo/demo/assets/images/404-error.webp +0 -0
  38. data/templates/jekyll/demo/demo/assets/images/favicon.png +0 -0
  39. data/templates/jekyll/demo/demo/assets/images/jekyll.png +0 -0
  40. data/templates/jekyll/demo/demo/assets/images/jekyll.webp +0 -0
  41. data/templates/jekyll/demo/demo/assets/js/clipboard.min.js +7 -0
  42. data/templates/jekyll/demo/demo/assets/js/jquery-3.4.1.min.js +2 -0
  43. data/templates/jekyll/demo/demo/blog/blogsByDate.html +22 -0
  44. data/templates/jekyll/demo/demo/blog/index.html +36 -0
  45. data/templates/jekyll/demo/demo/index.html.tt +5 -0
  46. data/templates/jekyll/filter_scaffold/lib/%filter_name%.rb.tt +30 -0
  47. data/templates/jekyll/generator_scaffold/lib/%generator_name%.rb.tt +34 -0
  48. data/templates/jekyll/hooks_scaffold/lib/dumpers.rb +172 -0
  49. data/templates/jekyll/hooks_scaffold/lib/hooks.rb.tt +238 -0
  50. data/templates/jekyll/tag_no_arg_scaffold/lib/%tag_name%.rb.tt +18 -0
  51. data/templates/jekyll/tag_scaffold/lib/%tag_name%.rb.tt +43 -0
  52. data/templates/rails/engine_scaffold/bin/rails.tt +15 -0
  53. data/templates/rails/engine_scaffold/config/routes.rb.tt +6 -0
  54. data/templates/rails/engine_scaffold/lib/%gem_name%/engine.rb.tt +7 -0
  55. data/templates/rails/engine_scaffold/test/integration/navigation_test.rb +7 -0
  56. data/templates/rails/mountable_scaffold/app/assets/javascripts/%gem_name%/application.js +13 -0
  57. data/templates/rails/mountable_scaffold/app/assets/stylesheets/%gem_name%/application.css +15 -0
  58. data/templates/rails/mountable_scaffold/app/controllers/%gem_name%/application_controller.rb.tt +5 -0
  59. data/templates/rails/mountable_scaffold/app/helpers/%gem_name%/application_helper.rb.tt +4 -0
  60. data/templates/rails/mountable_scaffold/app/views/layouts/%gem_name%/application.html.erb.tt +14 -0
  61. data/templates/rails/plugin_scaffold/test/dummy/README.rdoc +28 -0
  62. data/templates/rails/plugin_scaffold/test/dummy/Rakefile +6 -0
  63. data/templates/rails/plugin_scaffold/test/dummy/app/assets/javascripts/application.js +13 -0
  64. data/templates/rails/plugin_scaffold/test/dummy/app/controllers/application_controller.rb +7 -0
  65. data/templates/rails/plugin_scaffold/test/dummy/app/helpers/application_helper.rb +2 -0
  66. data/templates/rails/plugin_scaffold/test/dummy/app/mailers/application_mailer.rb +4 -0
  67. data/templates/rails/plugin_scaffold/test/dummy/app/views/layouts/application.html.erb +14 -0
  68. data/templates/rails/plugin_scaffold/test/dummy/app/views/layouts/mailer.html.erb +9 -0
  69. data/templates/rails/plugin_scaffold/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  70. data/templates/rails/plugin_scaffold/test/dummy/bin/bundle +4 -0
  71. data/templates/rails/plugin_scaffold/test/dummy/bin/rails +5 -0
  72. data/templates/rails/plugin_scaffold/test/dummy/bin/rake +6 -0
  73. data/templates/rails/plugin_scaffold/test/dummy/bin/setup +30 -0
  74. data/templates/rails/plugin_scaffold/test/dummy/config/application.rb.tt +26 -0
  75. data/templates/rails/plugin_scaffold/test/dummy/config/boot.rb +5 -0
  76. data/templates/rails/plugin_scaffold/test/dummy/config/database.yml +25 -0
  77. data/templates/rails/plugin_scaffold/test/dummy/config/environment.rb +5 -0
  78. data/templates/rails/plugin_scaffold/test/dummy/config/environments/development.rb +41 -0
  79. data/templates/rails/plugin_scaffold/test/dummy/config/environments/production.rb +79 -0
  80. data/templates/rails/plugin_scaffold/test/dummy/config/environments/test.rb +42 -0
  81. data/templates/rails/plugin_scaffold/test/dummy/config/initializers/assets.rb +11 -0
  82. data/templates/rails/plugin_scaffold/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  83. data/templates/rails/plugin_scaffold/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  84. data/templates/rails/plugin_scaffold/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  85. data/templates/rails/plugin_scaffold/test/dummy/config/initializers/inflections.rb +16 -0
  86. data/templates/rails/plugin_scaffold/test/dummy/config/initializers/mime_types.rb +4 -0
  87. data/templates/rails/plugin_scaffold/test/dummy/config/initializers/session_store.rb +3 -0
  88. data/templates/rails/plugin_scaffold/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  89. data/templates/rails/plugin_scaffold/test/dummy/config/locales/en.yml +23 -0
  90. data/templates/rails/plugin_scaffold/test/dummy/config/routes.rb.tt +5 -0
  91. data/templates/rails/plugin_scaffold/test/dummy/config/secrets.yml +22 -0
  92. data/templates/rails/plugin_scaffold/test/dummy/config.ru +4 -0
  93. data/templates/rails/plugin_scaffold/test/dummy/db/seeds.rb +7 -0
  94. data/templates/rails/plugin_scaffold/test/dummy/public/404.html +67 -0
  95. data/templates/rails/plugin_scaffold/test/dummy/public/422.html +67 -0
  96. data/templates/rails/plugin_scaffold/test/dummy/public/500.html +66 -0
  97. data/templates/rails/plugin_scaffold/test/dummy/public/favicon.ico +0 -0
  98. data/templates/rails/rails_scaffold/lib/tasks/%gem_name%_tasks.rake.tt +4 -0
  99. data/templates/rails/rails_scaffold/test/dummy/README.rdoc +28 -0
  100. data/templates/rails/rails_scaffold/test/dummy/Rakefile +6 -0
  101. data/templates/rails/rails_scaffold/test/dummy/app/assets/javascripts/application.js +13 -0
  102. data/templates/rails/rails_scaffold/test/dummy/app/assets/stylesheets/application.sass +0 -0
  103. data/templates/rails/rails_scaffold/test/dummy/app/controllers/application_controller.rb +7 -0
  104. data/templates/rails/rails_scaffold/test/dummy/app/helpers/application_helper.rb +2 -0
  105. data/templates/rails/rails_scaffold/test/dummy/app/mailers/application_mailer.rb +4 -0
  106. data/templates/rails/rails_scaffold/test/dummy/app/views/layouts/application.html.erb +14 -0
  107. data/templates/rails/rails_scaffold/test/dummy/app/views/layouts/mailer.html.erb +9 -0
  108. data/templates/rails/rails_scaffold/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  109. data/templates/rails/rails_scaffold/test/dummy/bin/bundle +4 -0
  110. data/templates/rails/rails_scaffold/test/dummy/bin/rails +5 -0
  111. data/templates/rails/rails_scaffold/test/dummy/bin/rake +6 -0
  112. data/templates/rails/rails_scaffold/test/dummy/bin/setup +30 -0
  113. data/templates/rails/rails_scaffold/test/dummy/config/application.rb.tt +26 -0
  114. data/templates/rails/rails_scaffold/test/dummy/config/boot.rb +5 -0
  115. data/templates/rails/rails_scaffold/test/dummy/config/database.yml +25 -0
  116. data/templates/rails/rails_scaffold/test/dummy/config/environment.rb +5 -0
  117. data/templates/rails/rails_scaffold/test/dummy/config/environments/development.rb +41 -0
  118. data/templates/rails/rails_scaffold/test/dummy/config/environments/production.rb +79 -0
  119. data/templates/rails/rails_scaffold/test/dummy/config/environments/test.rb +42 -0
  120. data/templates/rails/rails_scaffold/test/dummy/config/initializers/assets.rb +11 -0
  121. data/templates/rails/rails_scaffold/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  122. data/templates/rails/rails_scaffold/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  123. data/templates/rails/rails_scaffold/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  124. data/templates/rails/rails_scaffold/test/dummy/config/initializers/inflections.rb +16 -0
  125. data/templates/rails/rails_scaffold/test/dummy/config/initializers/mime_types.rb +4 -0
  126. data/templates/rails/rails_scaffold/test/dummy/config/initializers/session_store.rb +3 -0
  127. data/templates/rails/rails_scaffold/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  128. data/templates/rails/rails_scaffold/test/dummy/config/locales/en.yml +23 -0
  129. data/templates/rails/rails_scaffold/test/dummy/config/routes.rb.tt +5 -0
  130. data/templates/rails/rails_scaffold/test/dummy/config/secrets.yml +22 -0
  131. data/templates/rails/rails_scaffold/test/dummy/config.ru +4 -0
  132. data/templates/rails/rails_scaffold/test/dummy/db/seeds.rb +7 -0
  133. data/templates/rails/rails_scaffold/test/dummy/public/404.html +67 -0
  134. data/templates/rails/rails_scaffold/test/dummy/public/422.html +67 -0
  135. data/templates/rails/rails_scaffold/test/dummy/public/500.html +66 -0
  136. data/templates/rails/rails_scaffold/test/dummy/public/favicon.ico +0 -0
  137. metadata +135 -4
  138. /data/{spec/status_persistence.txt → templates/rails/plugin_scaffold/test/dummy/app/assets/stylesheets/application.sass} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8bd31585552b513ce66b36f8902a1a06bcc9e508ad45d98cd6ad327b593bc3c5
4
- data.tar.gz: bf467fb473d869fbd29d648688822226f6c02cc8b63bb9de9123f2c7e2d83ded
3
+ metadata.gz: aec69f699e43e3648a4e01a6b82142c29df26cc655d0391e45aa64d1cfca53eb
4
+ data.tar.gz: ed6d1d27b7ca1b63409c1123bae4b0128abfa63fa9cb4562e9b4e854d697e41e
5
5
  SHA512:
6
- metadata.gz: 5fbe5a7757e4986a7b4992dbe67797a9d1a488e300e0d4611ad39daaddba91b04cc590317555f73747532aece87288e320d98312f272d80e8509c0c03a4176fe
7
- data.tar.gz: b8373ad340266e1837890c29d8730f277fdfcc3e3610183a572d5e4593dff7314ecaff214c98be7a9ab7ed4ebc99e382746c9cceae6d67030aac6d6a150d44d5
6
+ metadata.gz: 145bb85a469d0fb62fa1b841f81e143f6d3d208ed0c6bdf843295eaa632950fd5dd7adab1dfde67f26d9122c53efadd1334cbc916d1244c585e839893ce0ec74
7
+ data.tar.gz: 1ee0b25be2d1e54f06ca5186f98f89ac90c8456cbb2763e16268cde0a52e56272432b43ab44e3c3829aa68fa3e9f978b92e48d3f3d46f8a30f4569ab983414be
data/CHANGELOG.md CHANGED
@@ -1,12 +1,21 @@
1
+ # Change Log
2
+
3
+ ## 0.8.1
4
+
5
+ * Corrected broken gemspec.
6
+
7
+
1
8
  ## 0.8.0
2
- * Updated dependencies and `README`.
3
- * Renamed the `gem` subcommand to `plain`.
4
- * Renamed the `plugin` subcommand to `rails`.
5
- * Added `CHANGELOG`, `.rspec`, `.rubocop` and `.vscode/`.
6
- * Added `binstubs/`.
7
- * Using `require_relative` where appropriate.
8
- * Changed the default for including an executable to `false`.
9
- * Added the `--quiet` and `--todos` options, common to the `plain`, `jekyll` and `rails` subcommands.
9
+
10
+ * Updated dependencies and `README`.
11
+ * Renamed the `gem` subcommand to `plain`.
12
+ * Renamed the `plugin` subcommand to `rails`.
13
+ * Added `CHANGELOG`, `.rspec`, `.rubocop` and `.vscode/`.
14
+ * Added `binstubs/`.
15
+ * Using `require_relative` where appropriate.
16
+ * Changed the default for including an executable to `false`.
17
+ * Added the `--quiet` and `--todos` options, common to the `plain`, `jekyll` and `rails` subcommands.
10
18
 
11
19
  ## 0.7.4
12
- * Last release was 7 years prior without a change history.
20
+
21
+ * Last release was 7 years prior without a change history.
data/README.md CHANGED
@@ -26,6 +26,12 @@ with the following features:
26
26
  $ gem install nugem
27
27
  ```
28
28
 
29
+ If you are using [rbenv](https://github.com/rbenv/rbenv) to manage Ruby instances, type:
30
+
31
+ ```shell
32
+ $ rbenv rehash
33
+ ```
34
+
29
35
  To update the program:
30
36
 
31
37
  ```shell
data/exe/nugem ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ if File.exist? 'lib/nugem/cli.rb'
4
+ require_relative '../lib/nugem/cli'
5
+ else
6
+ require 'nugem/cli'
7
+ end
8
+
9
+ Nugem::Cli.start
@@ -19,7 +19,7 @@ module Nugem
19
19
  enum: %w[bitbucket github], desc: 'Repository host.'
20
20
 
21
21
  method_option :private, type: :boolean, default: false,
22
- desc: 'Publish the gem in a private repository.'
22
+ desc: 'Publish the gem in a private repository.'
23
23
 
24
24
  def plain(gem_name)
25
25
  @dir = Nugem.dest_root gem_name
@@ -53,7 +53,7 @@ module Nugem
53
53
  when 'minitest' then /spec.*/
54
54
  when 'rspec' then /test.*/
55
55
  end
56
- directory 'common/gem_scaffold', @dir, force: true, mode: :preserve, exclude_pattern: exclude_pattern
56
+ directory('common/gem_scaffold', @dir, force: true, mode: :preserve, exclude_pattern:)
57
57
  directory 'common/executable_scaffold', @dir, force: true, mode: :preserve if @executable
58
58
  template 'common/LICENCE.txt', "#{@dir}/LICENCE.txt", force: true if @repository.public?
59
59
  end
data/lib/nugem/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Nugem
2
- VERSION = '0.8.0'.freeze
2
+ VERSION = '0.8.1'.freeze
3
3
  end
data/nugem.gemspec CHANGED
@@ -4,8 +4,8 @@ Gem::Specification.new do |spec|
4
4
  spec.authors = ['Igor Jancev', 'Mike Slinn']
5
5
  spec.bindir = 'exe'
6
6
  spec.email = ['igor@masterybits.com', 'mslinn@mslinn.com']
7
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
8
- spec.files = Dir['.rubocop.yml', 'LICENSE.*', 'Rakefile', '{lib,spec}/**/*', '*.gemspec', '*.md']
7
+ spec.executables = %w[nugem]
8
+ spec.files = Dir['.rubocop.yml', 'LICENSE.*', 'Rakefile', '{lib,spec,templates}/**/*', '*.gemspec', '*.md']
9
9
  spec.description = <<~END_DESC
10
10
  Nugem creates a scaffold project for new gems. You can choose between Github and Bitbucket,
11
11
  Rubygems or Geminabox, with or without an executable, etc.
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) <%= Time.new.year %> <%= @repository.user_name %>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require '<%= @gem_name %>/cli'
4
+
5
+ <%= @class_name %>::Cli.start
@@ -0,0 +1,13 @@
1
+ require 'thor'
2
+ require '<%= @gem_name %>'
3
+
4
+ module <%= @class_name %>
5
+ class Cli < Thor
6
+ include Thor::Actions
7
+
8
+ desc "do_something NAME", "<%= @todo %>task description"
9
+ def do_something(name)
10
+ puts "<%= @todo %>do something with: #{name}"
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,58 @@
1
+ require_relative 'lib/<%= @gem_name %>/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ <%- if @repository.github? -%>
5
+ host = 'https://github.com/<%= @repository.user %>/<%= @gem_name %>'
6
+ <%- else -%>
7
+ host = 'https://bitbucket.com/<%= @repository.user %>/<%= @gem_name %>'
8
+ <%- end -%>
9
+
10
+ spec.authors = ['<%= @repository.user_name %>']
11
+ <%- if @executable -%>
12
+ spec.bindir = 'exe'
13
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
14
+ <%- end -%>
15
+ spec.description = <<~END_DESC
16
+ <%= @todo %>Write a longer description of the gem.
17
+ Use as many lines as you like.
18
+ END_DESC
19
+ spec.email = ['<%= @repository.user_email %>']
20
+ spec.files = Dir['.rubocop.yml', 'LICENSE.*', 'Rakefile', '{lib,spec}/**/*', '*.gemspec', '*.md']
21
+ spec.homepage = '<%= @repository.url %>'
22
+ <%- if @repository.public? -%>
23
+ spec.license = 'MIT'
24
+ <%- end -%>
25
+ spec.metadata = {
26
+ 'allowed_push_host' => '<%= @repository.gem_server_url %>',
27
+ <%- unless @repository.private? -%>
28
+ 'bug_tracker_uri' => "#{host}/issues",
29
+ 'changelog_uri' => "#{host}/CHANGELOG.md",
30
+ 'homepage_uri' => spec.homepage,
31
+ 'source_code_uri' => host,
32
+ <%- end -%>
33
+ }
34
+ spec.name = '<%= @gem_name %>'
35
+ spec.post_install_message = <<~END_MESSAGE
36
+
37
+ Thanks for installing #{spec.name}!
38
+
39
+ END_MESSAGE
40
+ spec.require_paths = ['lib']
41
+ spec.required_ruby_version = '>= 3.1.0'
42
+ spec.summary = '<%= @todo %>Write summary of what the gem is for'
43
+ spec.version = <%= @class_name %>::VERSION
44
+
45
+ <%- if @geminabox -%>
46
+ spec.add_dependency 'geminabox', '>= 2.2.1'
47
+ <%- end -%>
48
+ <%- if @jekyll -%>
49
+ spec.add_dependency 'jekyll', '>= 3.5.0'
50
+ spec.add_dependency 'jekyll_plugin_support', '>= 0.7.0'
51
+ <%- end -%>
52
+ <%- if @plugin -%>
53
+ spec.add_dependency 'rails', '~> 7.0.5'
54
+ <%- end -%>
55
+ <%- if @executable -%>
56
+ spec.add_dependency 'thor', '~> 1.2.2'
57
+ <%- end -%>
58
+ end
@@ -0,0 +1,2 @@
1
+ ## 0.1.0
2
+ * Initial release.
@@ -0,0 +1,56 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # The <%= @gem_name %> gem dependencies are defined in <%= @gem_name %>.gemspec
4
+ gemspec
5
+
6
+ <%- if @jekyll -%>
7
+ group :test, :development do
8
+ gem 'bundler', '>= 2.4.6', require: false
9
+ <%- if @repository.public? -%>
10
+ gem 'coveralls', require: false
11
+ <%- end -%>
12
+ gem 'debase', '0.2.5.beta2', require: false
13
+ gem 'gem-release', '>= 2.2.2', require: false
14
+ <%- if @minitest -%>
15
+ gem 'minitest', '>= 5.18.0', require: false
16
+ gem 'minitest-reporters', '>= 1.6.0', require: false
17
+ gem 'minitest-screenshot-reporter', '~> 0.0.6', require: false
18
+ <%- end -%>
19
+ gem 'rake', require: false
20
+ <%- if @rspec -%>
21
+ gem 'rspec', require: false
22
+ <%- end -%>
23
+ gem 'rubocop', require: false
24
+ gem 'rubocop-md', require: false
25
+ <%- if @minitest -%>
26
+ gem 'rubocop-minitest', require: false
27
+ <%- end -%>
28
+ gem 'rubocop-performance', require: false
29
+ gem 'rubocop-rake', require: false
30
+ gem 'rubocop-rspec', require: false
31
+ gem 'ruby-debug-ide', require: false
32
+ end
33
+ <%- end -%>
34
+ <%- if @plugin -%>
35
+ group :test, :development do
36
+ gem 'bundler', '>= 2.4.6', require: false
37
+ gem 'capybara', '~> 3.39.1', require: false
38
+ gem 'capybara_minitest_spec', '~> 1.0.7', require: false
39
+ <%- if @repository.public? -%>
40
+ gem 'coveralls', require: false
41
+ <%- end -%>
42
+ gem 'database_cleaner', '~> 2.0.2', require: false
43
+ gem 'gem-release', '>= 2.2.2', require: false
44
+ gem 'poltergeist', '~> 1.10.1', require: false
45
+ gem 'quiet_assets'
46
+ gem 'rubocop', require: false
47
+ gem 'rubocop-md', require: false
48
+ gem 'rubocop-performance', require: false
49
+ gem 'rubocop-rake', require: false
50
+ <%- if @rspec -%>
51
+ gem 'rubocop-rspec', require: false
52
+ <%- end -%>
53
+ gem 'selenium-webdriver', '~> 4.9.1', require: false
54
+ gem 'sqlite3'
55
+ end
56
+ <%- end -%>
@@ -0,0 +1,62 @@
1
+ # <%= @class_name %>
2
+
3
+ <%- if @repository.public? -%>
4
+ # `<%= gem_name.capitalize %>` [![Gem Version](https://badge.fury.io/rb/<%= gem_name %>.svg)](https://badge.fury.io/rb/<%= gem_name %>)
5
+ <%- else -%>
6
+ # `<%= gem_name.capitalize %>`
7
+ <%- end -%>
8
+
9
+ <%= @todo %>Description of <%= @class_name %>
10
+
11
+
12
+ ## Installation
13
+
14
+ <%- if @jekyll -%>
15
+ Add this line to your Jekyll website's Gemfile, within the jekyll_plugins group:
16
+
17
+ group :jekyll_plugins do
18
+ gem '<%= @gem_name %>'
19
+ end
20
+ <%- end -%>
21
+ <%- unless @jekyll -%>
22
+ Add this line to your application's Gemfile:
23
+
24
+ ```ruby
25
+ gem '<%= @gem_name %>'
26
+ ```
27
+ <%- end -%>
28
+
29
+ And then execute:
30
+ ```shell
31
+ $ bundle
32
+ ```
33
+
34
+
35
+ ## Usage
36
+
37
+ <%= @todo %>Describe how to use this gem
38
+
39
+
40
+ ## Development
41
+
42
+ After checking out the repo, run `bin/setup` to install dependencies.
43
+ Then, run `rake test` to run the tests.
44
+ You can also run `bin/console` for an interactive prompt that will allow you to experiment.
45
+
46
+ To install this gem onto your local machine, run `bundle exec rake install`.
47
+
48
+ To release a new version, run `bundle exec rake release`,
49
+ which will create a git tag for the version, push git commits and tags,
50
+ and push the `.gem` file to <%= @repository.gem_server_url -%>.
51
+
52
+
53
+ ## Contributing
54
+
55
+ Bug reports and pull requests are welcome on <%= @repository.host %> at <%= @repository.url %>.
56
+
57
+
58
+ <%- if @repository.public? -%>
59
+ ## License
60
+
61
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
62
+ <%- end -%>
@@ -0,0 +1,51 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << 'test'
6
+ t.libs << 'lib'
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ <%- if @engine -%>
11
+ APP_RAKEFILE = File.expand_path('../test/dummy/Rakefile', __FILE__)
12
+ load 'rails/tasks/engine.rake'
13
+
14
+ load 'rails/tasks/statistics.rake'
15
+
16
+ <%- end -%>
17
+ desc 'Bump patch version'
18
+ task :patch do
19
+ system 'gem bump --tag'
20
+ end
21
+
22
+ desc 'Bump minor version'
23
+ task :minor do
24
+ system 'gem bump --version minor --tag'
25
+ end
26
+
27
+ desc 'Bump major version'
28
+ task :major do
29
+ system 'gem bump --version major --tag'
30
+ end
31
+
32
+ task publish: [:build] do
33
+ $VERBOSE = nil
34
+ load '<%= @gem_name %>/version.rb'
35
+ <%- if @repository.private? -%>
36
+ system "gem inabox pkg/<%= @gem_name %>-#{<%= @class_name %>::VERSION}.gem"
37
+ <%- else -%>
38
+ system "gem push pkg/<%= @gem_name %>-#{<%= @class_name %>::VERSION}.gem"
39
+ <%- end -%>
40
+ end
41
+
42
+ desc 'Bump patch version, create git tag, build the gem and release to geminabox (default)'
43
+ task release_patch: %i[test patch publish]
44
+
45
+ desc 'Bump minor version, create git tag, build the gem and release to geminabox'
46
+ task release_minor: %i[test minor publish]
47
+
48
+ desc 'Bump major version, create git tag, build the gem and release to geminabox'
49
+ task release_major: %i[test major publish]
50
+
51
+ task default: :test
@@ -0,0 +1,34 @@
1
+ #!/bin/bash
2
+
3
+ # Change to parent directory of this script
4
+ SOURCE=${BASH_SOURCE[0]}
5
+ while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
6
+ DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
7
+ SOURCE=$(readlink "$SOURCE")
8
+ [[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
9
+ done
10
+ DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
11
+ cd "$DIR/.."
12
+
13
+ # Requires the target project contains a script called _bin/debug.
14
+ # See https://www.mslinn.com/blog/2022/02/21/jekyll-debugging.html
15
+
16
+ if [ -z "$1" ]; then
17
+ echo "Error: Please provide the project directory to run the test from."
18
+ exit 1
19
+ fi
20
+
21
+ if [ ! -f "$1/_bin/debug" ]; then
22
+ echo "Error: $1/_bin/debug does not exist."
23
+ exit 1
24
+ fi
25
+
26
+ GIT_ROOT="$( git rev-parse --show-toplevel )"
27
+ cd "${GIT_ROOT}"
28
+
29
+ bin/build
30
+
31
+ set -e
32
+
33
+ cd "$1" > /dev/null || exit 1
34
+ _bin/debug
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require_relative '../lib/<%= @gem_name %>'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ require 'irb'
10
+ IRB.start
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # The application 'rake' is installed as part of a gem, and
4
+ # this file is here to facilitate running it.
5
+
6
+ require 'pathname'
7
+
8
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', Pathname.new(__dir__).realpath)
9
+
10
+ require 'rubygems'
11
+ require 'bundler/setup'
12
+
13
+ load Gem.bin_path('rake', 'rake')
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Change to parent directory of this script
4
+ SOURCE=${BASH_SOURCE[0]}
5
+ while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
6
+ DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
7
+ SOURCE=$(readlink "$SOURCE")
8
+ [[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
9
+ done
10
+ DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
11
+ cd "$DIR/.." || exit
12
+
13
+ rm -f Gemfile.lock
14
+ bundle
15
+
16
+ bundle binstubs debase --force --path binstub
17
+ <%- if @jekyll -%>
18
+ bundle binstubs jekyll --force --path binstub
19
+ <%- end -%>
20
+ bundle binstubs rspec-core --force --path binstub
21
+ bundle binstubs rubocop --force --path binstub
22
+ bundle binstubs ruby-debug-ide --force --path binstub
23
+
24
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,3 @@
1
+ module <%= @class_name %>
2
+ VERSION = '0.1.0'.freeze unless defined? VERSION
3
+ end
@@ -0,0 +1,12 @@
1
+ <%- if @jekyll -%>
2
+ require 'jekyll'
3
+ require 'jekyll_plugin_logger'
4
+ require 'jekyll_plugin_support'
5
+
6
+ <%- end -%>
7
+ require_relative '<%= @gem_name %>/version'
8
+
9
+ # Require all Ruby files in 'lib/', except this file
10
+ Dir[File.join(__dir__, '*.rb')].each do |file|
11
+ require file unless file.end_with?('/<%= @gem_name %>.rb')
12
+ end
@@ -0,0 +1,11 @@
1
+ require_relative 'test_helper'
2
+
3
+ class <%= @class_name %>Test < Minitest::Test
4
+ def test_it_is_a_module
5
+ assert_kind_of Module, <%= @class_name %>
6
+ end
7
+
8
+ def test_that_it_has_a_version_number
9
+ refute_nil ::<%= @class_name %>::VERSION
10
+ end
11
+ end
@@ -0,0 +1,96 @@
1
+ <%- unless @repository.private? -%>
2
+ require 'coveralls'
3
+ Coveralls.wear!
4
+ <%- end -%>
5
+
6
+ <%- unless @plugin -%>
7
+ $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
8
+ require '<%= @gem_name %>'
9
+ <%- end -%>
10
+
11
+ require 'minitest/autorun'
12
+
13
+ require 'minitest/reporters'
14
+ <%- if @plugin -%>
15
+ require 'minitest/reporters/screenshot_reporter'
16
+ Minitest::Reporters.use! [Minitest::Reporters::SpecReporter.new,
17
+ Minitest::Reporters::JUnitReporter.new,
18
+ Minitest::Reporters::ScreenshotReporter.new]
19
+ <%- else -%>
20
+ Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
21
+ <%- end -%>
22
+
23
+ # Filter out Minitest backtrace while allowing backtrace from other libraries to be shown.
24
+ Minitest.backtrace_filter = Minitest::BacktraceFilter.new
25
+
26
+ <%- if @plugin -%>
27
+ require File.expand_path('../test/dummy/config/environment.rb', __dir__)
28
+ ActiveRecord::Migrator.migrations_paths = [File.expand_path('../test/dummy/db/migrate', __dir__)]
29
+ <%- if @mountable -%>
30
+ ActiveRecord::Migrator.migrations_paths << File.expand_path('../db/migrate', __dir__)
31
+ <%- end -%>
32
+ require 'rails/test_help'
33
+
34
+ # Load support files
35
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
36
+
37
+ # Load fixtures from the engine
38
+ if ActiveSupport::TestCase.respond_to?(:fixture_path=)
39
+ ActiveSupport::TestCase.fixture_path = File.expand_path('fixtures', __dir__)
40
+ ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path
41
+ ActiveSupport::TestCase.fixtures :all
42
+ end
43
+
44
+ # default test class for unit tests
45
+ class UnitTest < ActiveSupport::TestCase
46
+ # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
47
+ fixtures :all
48
+ end
49
+
50
+ # configure webtests with capybara and poltergeist (headless)
51
+ require 'capybara/rails'
52
+ require 'capybara_minitest_spec'
53
+ require 'capybara/poltergeist'
54
+
55
+ CAPYBARA_WINDOW_SIZE = [1024, 768]
56
+
57
+ if ENV['HEADLESS'] == 'true'
58
+ # headless driver configuration
59
+ Capybara.register_driver :poltergeist do |app|
60
+ poltergeist_options = { debug: false, timeout: 30, js_errors: true, window_size: CAPYBARA_WINDOW_SIZE }
61
+ Capybara::Poltergeist::Driver.new(app, poltergeist_options)
62
+ end
63
+ Capybara.default_driver = :poltergeist
64
+ else
65
+ # chrome browser driver configuration
66
+ Capybara.register_driver :selenium do |app|
67
+ Capybara::Selenium::Driver.new(app, :browser => :chrome)
68
+ end
69
+ Capybara.default_driver = :selenium
70
+ Capybara.current_session.driver.browser.manage.window.resize_to CAPYBARA_WINDOW_SIZE[0], CAPYBARA_WINDOW_SIZE[1]
71
+ end
72
+ Capybara.default_max_wait_time = 5 # how long should capybara wait for elements to appear on the page (ajax)
73
+
74
+ # use database_cleaner to clean the database after every test with truncation, instead of using transactional fixtures
75
+ require 'database_cleaner'
76
+ DatabaseCleaner.strategy = :truncation
77
+
78
+ # default test class for webtests
79
+ class WebTest < ActionDispatch::IntegrationTest
80
+ include Capybara::DSL
81
+ extend Minitest::Spec::DSL
82
+ include Minitest::Reporters::Screenshot
83
+
84
+ # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
85
+ fixtures :all
86
+
87
+ # disable transactional fixtures, as we use DatabaseCleaner
88
+ self.use_transactional_fixtures = false
89
+
90
+ # clean database after each test with database_cleaner
91
+ def after_teardown
92
+ super
93
+ DatabaseCleaner.clean
94
+ end
95
+ end
96
+ <%- end -%>
@@ -0,0 +1,23 @@
1
+ require 'jekyll_plugin_support'
2
+ require_relative '<%= @gem_name %>/version.rb'
3
+
4
+ module <%= @class_name %>
5
+ PLUGIN_NAME = '<%= @block_name %>'.freeze unless defined? PLUGIN_NAME
6
+
7
+ # This class implements the Jekyll block tag functionality
8
+ class <%= @jekyll_class_name %> < JekyllBlock
9
+ VERSION = <%= @class_name %>::VERSION
10
+
11
+ def initialize(tag_name, argument_string, parse_context)
12
+ class << self
13
+ include NoArgParsing
14
+ end
15
+
16
+ super
17
+ @logger.debug { "#{self.class}: respond_to?(:o_arg_parsing) #{respond_to?(:no_arg_parsing) ? 'yes' : 'no'}." }
18
+ rescue StandardError => e
19
+ @logger.error { "#{self.class} died with a #{e.full_message}" }
20
+ exit 2
21
+ end
22
+ end
23
+ end