bootstrap_views_generator 0.1.14 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 003b0f07a0458189484b4c34627607a2b8f650bd376c2a0a895ff60de0962ed6
4
- data.tar.gz: 7493353ce548589eacbd36e2c10ad29bb5b821305c81765788399f50313db19d
3
+ metadata.gz: 1e8a0bd048ee64107d721f90158e12aeecdeeac0b4f35f99187a42fa7027dc19
4
+ data.tar.gz: 5a82a5c01c0f544b214ec007a6f76a5cab6816bc03ce09c58391bb3c9c868fbf
5
5
  SHA512:
6
- metadata.gz: afd409ca4c1d52a9b64524c60dd17b790e335031cf0798ac26c33a93bbcae9e09fd1c0908caf2d76b84f36b083af786a393cabead1b0c5e8b4309080b4922484
7
- data.tar.gz: 730a77186a21ccc7abf80d08807d513a90ae93f0a81cce7d0baf35d3be0881a89ca329fde7d2eaaf2ee5ab1216a8aeca37fb0d30112b492f7c60f8212dae0a00
6
+ metadata.gz: a07e32cbfa623f93ef8857eedd0d30fade0d2b209dada912b1faea2b07418a42d4a622778115bb9325645145beb773adb361b3038ee38384901627cdbebf67c8
7
+ data.tar.gz: 6364cc3e4fa0640f2360b600e063b2b19e8defb420deeeb4427397d54c96796d60d59e00c7d2c1f4a72d0e98f2b66fba4ea3a59224b251409600eb6ba723645e
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)
@@ -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
@@ -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.15'
5
6
  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
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.15
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: 2021-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -80,6 +80,7 @@ extra_rdoc_files: []
80
80
  files:
81
81
  - ".gitignore"
82
82
  - ".travis.yml"
83
+ - CHANGELOG.md
83
84
  - Gemfile
84
85
  - Gemfile.lock
85
86
  - LICENSE.txt
@@ -89,6 +90,7 @@ files:
89
90
  - bin/setup
90
91
  - bootstrap_views_generator.gemspec
91
92
  - lib/bootstrap_views_generator.rb
93
+ - lib/bootstrap_views_generator/helpers.rb
92
94
  - lib/bootstrap_views_generator/version.rb
93
95
  - lib/generators/bootstrap/config/simple_form.rb
94
96
  - lib/generators/bootstrap/devise_generator.rb
@@ -186,7 +188,9 @@ licenses:
186
188
  metadata:
187
189
  homepage_uri: https://github.com/tarellel/bootstrap_views_generator
188
190
  source_code_uri: https://github.com/tarellel/bootstrap_views_generator
189
- post_install_message:
191
+ bug_tracker_uri: https://github.com/tarellel/bootstrap_views_generator/issues
192
+ changelog_uri: https://github.com/tarellel/bootstrap_views_generator/blob/main/CHANGELOG.md
193
+ post_install_message:
190
194
  rdoc_options: []
191
195
  require_paths:
192
196
  - lib
@@ -201,8 +205,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
205
  - !ruby/object:Gem::Version
202
206
  version: '0'
203
207
  requirements: []
204
- rubygems_version: 3.0.6
205
- signing_key:
208
+ rubygems_version: 3.2.11
209
+ signing_key:
206
210
  specification_version: 4
207
211
  summary: Bootstrap generators for overwriting the default Rails view generators
208
212
  test_files: []