bootstrap_views_generator 0.1.14 → 0.1.16

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: 003b0f07a0458189484b4c34627607a2b8f650bd376c2a0a895ff60de0962ed6
4
- data.tar.gz: 7493353ce548589eacbd36e2c10ad29bb5b821305c81765788399f50313db19d
3
+ metadata.gz: abe241fe4346c28532d9bbb3758ab62a3c31dfc49f6ca7ab5d3da18e6f712dc8
4
+ data.tar.gz: 8cc9c75146f456a19e60b9827664c4bb609c66907b950db82b889c5c0cef4376
5
5
  SHA512:
6
- metadata.gz: afd409ca4c1d52a9b64524c60dd17b790e335031cf0798ac26c33a93bbcae9e09fd1c0908caf2d76b84f36b083af786a393cabead1b0c5e8b4309080b4922484
7
- data.tar.gz: 730a77186a21ccc7abf80d08807d513a90ae93f0a81cce7d0baf35d3be0881a89ca329fde7d2eaaf2ee5ab1216a8aeca37fb0d30112b492f7c60f8212dae0a00
6
+ metadata.gz: 4376d3f83c6335ae118e636a2fee1ac36c6bfe6988ff25a4b63415b957a1de8b940dc590eef33d8884d55b57db4e66712d0534f4b2fd1b2ee8ac2fc64838fb6c
7
+ data.tar.gz: cc84231c346c162ecccb38c8dc0f978157a8eb8a16a335727476454cd23785243792435ab493fe1b6524973ebcbd45ba78809148eaa0e0ee49afd936f72164ba
data/CHANGELOG.md ADDED
@@ -0,0 +1,18 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## 2021-04-17
9
+
10
+ - Correct issue with HAML page title being misaligned
11
+ - Avoid deprecation errors when pulling the application name when using Rails > 6.0 vs earlier versions
12
+ - Added logic for pulling the `app_name` into a helper to prevent duplicate logic within all the layout templates
13
+ - Minor version bump
14
+
15
+ ## 2020-01-23
16
+
17
+ - Minor cleanup on ruby files (rubocop errors)
18
+ - Cleanup gemspec and added metadata so rubygems will display links for them on the gempage
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path('../lib', __FILE__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'bootstrap_views_generator/version'
@@ -14,18 +16,19 @@ Gem::Specification.new do |spec|
14
16
  spec.license = 'MIT'
15
17
 
16
18
  # Going off of minimum version required for Rails_v5.2.3
17
- spec.required_ruby_version = '>= 2.2.2'
19
+ spec.required_ruby_version = ">= #{BootstrapViewsGenerator::MIN_RUBY_VERSION}"
18
20
  if spec.respond_to?(:metadata)
19
21
  spec.metadata['homepage_uri'] = spec.homepage
20
22
  spec.metadata['source_code_uri'] = spec.homepage
23
+ spec.metadata['bug_tracker_uri'] = "#{spec.homepage}/issues"
24
+ spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/main/CHANGELOG.md"
21
25
  else
22
- raise "RubyGems 2.0 or newer is required to protect against " \
23
- "public gem pushes."
26
+ raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
24
27
  end
25
28
 
26
29
  # Specify which files should be added to the gem when it is released.
27
30
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
28
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
31
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
29
32
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
30
33
  end
31
34
  # spec.files = Dir.glob("{bin,lib}/**/*") # Used when building the gem locally (before commiting and pushing the gem publically)
@@ -33,7 +36,7 @@ Gem::Specification.new do |spec|
33
36
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
34
37
  spec.require_paths = ['lib']
35
38
 
36
- spec.add_runtime_dependency 'railties', '>= 4.0', '<= 7'
39
+ spec.add_runtime_dependency 'railties', '>= 6'
37
40
  spec.add_development_dependency 'bundler', '>= 1.17', '<= 3'
38
41
  spec.add_development_dependency 'rake', '>= 7.0', '<= 20.0'
39
42
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BootstrapViewsGenerator
4
+ module Helpers
5
+ # Return a cleaned up version of the name of the application being generated
6
+ # @return [String]
7
+ def app_name
8
+ # Avoid deprecation errors when pulling the application name when using Rails > 6.0
9
+ @app_name ||= if Rails.version.to_f >= 6.0
10
+ Rails.app_class.module_parent_name.demodulize.titleize
11
+ else
12
+ Rails.application.class.parent.to_s.titleize
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BootstrapViewsGenerator
4
- VERSION = '0.1.14'.freeze
4
+ MIN_RUBY_VERSION = '2.2.2'
5
+ VERSION = '0.1.16'
5
6
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'bootstrap_views_generator/version'
4
4
  require 'rails'
5
+ require 'bootstrap_views_generator/helpers'
5
6
 
6
7
  module BootstrapViewsGenerator
7
8
  class Error < StandardError; end
@@ -1,10 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'rails/generators'
4
+ require_relative '../../bootstrap_views_generator/helpers'
4
5
 
5
6
  module Bootstrap
6
7
  module Generators
7
8
  class DeviseGenerator < ::Rails::Generators::Base
9
+ include BootstrapViewsGenerator::Helpers
10
+
8
11
  hide!
9
12
  desc 'Overwrite default devise views'
10
13
  source_root ::File.expand_path('../templates/devise', __FILE__)
@@ -49,7 +52,8 @@ module Bootstrap
49
52
  private
50
53
  def file_template_location(file_location = '')
51
54
  return '' if file_location.blank?
52
- # Dpending if simpleform is to be used, it will return a path similar to one of the following:
55
+
56
+ # Depending if simpleform is to be used, it will return a path similar to one of the following:
53
57
  # => slim/unlocks/new.html.slim || simple_form/slim/unlocks/new.html.slim
54
58
  "#{simple_path}#{options[:template_engine]}/#{file_location}.html.#{options[:template_engine]}"
55
59
  end
@@ -2,10 +2,12 @@
2
2
 
3
3
  require 'rails/generators'
4
4
  require_relative 'devise_generator'
5
+ require_relative '../../bootstrap_views_generator/helpers'
5
6
 
6
7
  module Bootstrap
7
8
  module Generators
8
9
  class InstallGenerator < ::Rails::Generators::Base
10
+ include BootstrapViewsGenerator::Helpers
9
11
  desc 'Overwrite default view scaffolding'
10
12
  source_root ::File.expand_path('../templates', __FILE__)
11
13
  class_option :template_engine, type: :string, default: 'erb', aliases: '-t', enum: %w[erb slim haml],
@@ -52,8 +54,8 @@ module Bootstrap
52
54
  copy_file("simple_form/_form.html.#{options[:template_engine]}", "lib/templates/#{options[:template_engine]}/scaffold/_form.html.#{options[:template_engine]}", force: true) if options[:simpleform]
53
55
  end
54
56
 
55
- # Inject Bootstrap helpers into teh application_helper file
56
- def inject_helpers
57
+ # Inject Bootstrap helpers into the application_helper file
58
+ def inject_application_helpers
57
59
  pagy_helper = (options[:pagination] ? 'include Pagy::Frontend' : '')
58
60
  helper_str = <<~HELPER
59
61
  #{pagy_helper}
@@ -93,7 +95,7 @@ module Bootstrap
93
95
  end
94
96
  end
95
97
  HELPER
96
- inject_into_file 'app/helpers/application_helper.rb', optimize_indentation(helper_str,2), after: "module ApplicationHelper\n"
98
+ inject_into_file 'app/helpers/application_helper.rb', optimize_indentation(helper_str, 2), after: "module ApplicationHelper\n"
97
99
  end
98
100
 
99
101
  def invoke_devise_generator
@@ -5,10 +5,10 @@
5
5
  <meta content="IE=Edge" http-equiv="X-UA-Compatible" />
6
6
  <meta content="width=device-width, initial-scale=1.0" name="viewport" />
7
7
  <%- if options[:metatags] -%>
8
- <%%= display_meta_tags site: '<%= Rails.application.class.parent.to_s.titleize %>' %>
8
+ <%%= display_meta_tags site: '<%= app_name %>' %>
9
9
  <%- else -%>
10
- <title>Bootstrap template</title>
11
- <% end -%>
10
+ <title><%= app_name %></title>
11
+ <%- end -%>
12
12
  <%%= csrf_meta_tags %>
13
13
  <%%= csp_meta_tag %>
14
14
  <%%= stylesheet_link_tag 'application', media: 'all'<%= (options[:skip_turbolinks] || options[:skip_javascript]) ? '' : ", 'data-turbolinks-track': 'reload'" %> %>
@@ -6,9 +6,9 @@
6
6
  %meta{content: "IE=Edge", "http-equiv" => "X-UA-Compatible"}/
7
7
  %meta{content: "width=device-width, initial-scale=1.0", name: "viewport"}/
8
8
  <%- if options[:metatags] -%>
9
- = display_meta_tags site: '<%= Rails.application.class.parent.to_s.titleize %>'
9
+ = display_meta_tags site: '<%= app_name %>'
10
10
  <%- else -%>
11
- %title Bootstrap template
11
+ %title= '<%= app_name %>'
12
12
  <%- end -%>
13
13
  = csrf_meta_tags
14
14
  = csp_meta_tag
@@ -5,9 +5,9 @@ html
5
5
  meta content="IE=Edge" http-equiv="X-UA-Compatible"
6
6
  meta content="width=device-width, initial-scale=1.0" name="viewport"
7
7
  <%- if options[:metatags] -%>
8
- = display_meta_tags site: '<%= Rails.application.class.parent.to_s.titleize %>'
8
+ = display_meta_tags site: '<%= app_name %>'
9
9
  <%- else -%>
10
- title Bootstrap template
10
+ title <%= app_name %>
11
11
  <%- end -%>
12
12
  = csrf_meta_tags
13
13
  = csp_meta_tag
@@ -1,4 +1,4 @@
1
- <%- if options[:pagination] -%>
1
+ <%- if options[:metatags] -%>
2
2
  <h1><%%%= title('<%%= plural_table_name.titleize %>') %></h1>
3
3
  <%- else -%>
4
4
  <h1><%%= plural_table_name.titleize %></h1>
@@ -22,7 +22,10 @@
22
22
  <%% end -%>
23
23
  <td><%%%= link_to 'Show', <%%= model_resource_name %> %></td>
24
24
  <td><%%%= link_to 'Edit', edit_<%%= singular_route_name %>_path(<%%= singular_table_name %>) %></td>
25
- <td><%%%= link_to 'Destroy', <%%= model_resource_name %>, method: :delete, data: { confirm: 'Are you sure?' } %></td>
25
+ <td><%%%= link_to 'Destroy', <%%= model_resource_name %>, data: {
26
+ turbo_method: :delete,
27
+ turbo_confirm: "Are you sure?"
28
+ } %></td>
26
29
  </tr>
27
30
  <%%% end %>
28
31
  </tbody>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap_views_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Hicks
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-12 00:00:00.000000000 Z
11
+ date: 2023-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -16,20 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.0'
20
- - - "<="
21
- - !ruby/object:Gem::Version
22
- version: '7'
19
+ version: '6'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
- version: '4.0'
30
- - - "<="
31
- - !ruby/object:Gem::Version
32
- version: '7'
26
+ version: '6'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: bundler
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +74,7 @@ extra_rdoc_files: []
80
74
  files:
81
75
  - ".gitignore"
82
76
  - ".travis.yml"
77
+ - CHANGELOG.md
83
78
  - Gemfile
84
79
  - Gemfile.lock
85
80
  - LICENSE.txt
@@ -89,6 +84,7 @@ files:
89
84
  - bin/setup
90
85
  - bootstrap_views_generator.gemspec
91
86
  - lib/bootstrap_views_generator.rb
87
+ - lib/bootstrap_views_generator/helpers.rb
92
88
  - lib/bootstrap_views_generator/version.rb
93
89
  - lib/generators/bootstrap/config/simple_form.rb
94
90
  - lib/generators/bootstrap/devise_generator.rb
@@ -186,7 +182,9 @@ licenses:
186
182
  metadata:
187
183
  homepage_uri: https://github.com/tarellel/bootstrap_views_generator
188
184
  source_code_uri: https://github.com/tarellel/bootstrap_views_generator
189
- post_install_message:
185
+ bug_tracker_uri: https://github.com/tarellel/bootstrap_views_generator/issues
186
+ changelog_uri: https://github.com/tarellel/bootstrap_views_generator/blob/main/CHANGELOG.md
187
+ post_install_message:
190
188
  rdoc_options: []
191
189
  require_paths:
192
190
  - lib
@@ -201,8 +199,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
199
  - !ruby/object:Gem::Version
202
200
  version: '0'
203
201
  requirements: []
204
- rubygems_version: 3.0.6
205
- signing_key:
202
+ rubygems_version: 3.4.21
203
+ signing_key:
206
204
  specification_version: 4
207
205
  summary: Bootstrap generators for overwriting the default Rails view generators
208
206
  test_files: []