rails_app_generator 0.1.9 → 0.1.12

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.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/after_templates/addons/rails_html_sanitizer/_.rb +15 -0
  4. data/after_templates/addons/rails_html_sanitizer/home/index.html.erb +31 -0
  5. data/after_templates/addons/{rails_html_sanitizer → rails_html_sanitizer_xxx/home}/index.html.erb +0 -0
  6. data/lib/rails_app_generator/app_generator.rb +1 -2
  7. data/lib/rails_app_generator/version.rb +1 -1
  8. data/package-lock.json +2 -2
  9. data/package.json +1 -1
  10. data/profiles/addons/rails-html-sanitizer.json +2 -2
  11. data/profiles/addons/rails_html_sanitizer.json +12 -0
  12. data/tasks/addon.thor +8 -22
  13. data/tasks/gem_info.rb +47 -0
  14. data/tasks/profile.thor +104 -2
  15. data/templates/thor_task/profile/after_template.rb.tt +15 -0
  16. data/templates/thor_task/profile/home/index.html.erb.tt +3 -0
  17. data/templates/thor_task/profile/profile.json.tt +12 -0
  18. metadata +23 -17
  19. data/after_templates/addons/rails_html_sanitizer.rb +0 -15
  20. data/templates/app_x/controllers/authorized_controller.rb.erb +0 -10
  21. data/templates/app_x/controllers/errors_controller.rb.erb +0 -24
  22. data/templates/app_x/javascript/images/checkmark.svg +0 -1
  23. data/templates/app_x/javascript/images/logo.svg +0 -1
  24. data/templates/app_x/javascript/stylesheets/components.scss +0 -206
  25. data/templates/app_x/views/errors/internal_error.html.erb +0 -14
  26. data/templates/app_x/views/errors/not_found.html.erb +0 -14
  27. data/templates/app_x/views/errors/unacceptable.html.erb +0 -14
  28. data/templates/app_x/views/layouts/application.html.erb.tt +0 -30
  29. data/templates/app_x/views/pages/home.html.erb.tt +0 -20
  30. data/templates/app_x/views/shared/_flashes.html.erb.tt +0 -12
  31. data/templates/app_x/views/shared/_footer.html.erb.tt +0 -21
  32. data/templates/app_x/views/shared/_navbar.html.erb.tt +0 -55
  33. data/templates/app_x/workers/application_worker.rb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96c2c0a83f21efd278ae574b7161c8b3d4522880f3b01b37d43b783ede17d7ec
4
- data.tar.gz: 54c7745878991f2bbc49e894a205582c90dd7bda79d6b3d7de811a48622beaf5
3
+ metadata.gz: f2307c0ebef36cdf172922b01efbf07d2e24adaa855afca17b7e6490dd4b3e45
4
+ data.tar.gz: 6dff48114607c3adaa8ef5325651762e0738a62032e9e50e6f41e1c7cfbae536
5
5
  SHA512:
6
- metadata.gz: 8bc7eebffc7d3c2f8bc1c4a6d758d8ca826355d0e2421a01dfec5b57d3b00a8bbab37f3cb8b6eab59ef2f9d30f47bd81596dfb6b0b7d0b996f15c783aa52a22d
7
- data.tar.gz: 4e9dc215f0574e203240817ad2b5f5aa231e0628fb7c352b2274c59612a7d88c89dda174ed19083929b9c39eae0235bdbdc878e2947e5b055c27ff26a02831cc
6
+ metadata.gz: e1daf6f4579973228d26d984c4db2adf8531091fd9bb169a17ead6df4c641e817f3fe29ba3bf929b5f674a11323ecce929eb2e839d79a866ed82f7725cdfd3b4
7
+ data.tar.gz: ea7d93cb6434418ab160fc2d37b6981b9a6056b26fa8f49baa198d3084be07e06e29d09ef2af0d6893b34d68bc2d2521f9d07e02a3439faa1e0b78a4d048ac2d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## [0.1.11](https://github.com/klueless-io/rails_app_generator/compare/v0.1.10...v0.1.11) (2022-08-02)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add thor task to create profiles ([0ec4ae0](https://github.com/klueless-io/rails_app_generator/commit/0ec4ae01a2879fc627422cb79e4cbc685e78dcb8))
7
+
8
+ ## [0.1.10](https://github.com/klueless-io/rails_app_generator/compare/v0.1.9...v0.1.10) (2022-08-02)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * refactor GemInfo ([9294d5f](https://github.com/klueless-io/rails_app_generator/commit/9294d5faff71e69f6812868c976a26171a12d4c5))
14
+
15
+ ## [0.1.9](https://github.com/klueless-io/rails_app_generator/compare/v0.1.8...v0.1.9) (2022-08-02)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * add thor task to create add-ons, plus profile rails-html-santaizer ([098700f](https://github.com/klueless-io/rails_app_generator/commit/098700facf9eb7d74ce6dfed8495e22d0904a386))
21
+ * cops ([61f106e](https://github.com/klueless-io/rails_app_generator/commit/61f106e8d5bfa918731430efd5c6fea34d25a41b))
22
+
1
23
  ## [0.1.8](https://github.com/klueless-io/rails_app_generator/compare/v0.1.7...v0.1.8) (2022-07-31)
2
24
 
3
25
 
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ # HTML sanitization for Rails applications
4
+ require 'pry'
5
+
6
+ self.local_template_path = File.dirname(__FILE__)
7
+
8
+ gac 'base rails 7 image created'
9
+
10
+ add_controller('home', 'index')
11
+ route("root 'home#index'")
12
+
13
+ force_copy
14
+
15
+ copy_file 'home/index.html.erb', 'app/views/home/index.html.erb'
@@ -0,0 +1,31 @@
1
+ <h1>Rails HTML Sanitizer</h1>
2
+
3
+ <p>Read more here <a href="https://github.com/rails/rails-html-sanitizer">rails-html-sanitizer</a></p>
4
+
5
+ <textarea rows="4" cols="200">
6
+ full_sanitizer = Rails::Html::FullSanitizer.new
7
+ full_sanitizer.sanitize("<b>Bold</b> no more! <a href='more.html'>See more here</a>...")
8
+ </textarea>
9
+
10
+ <hr>
11
+ <%=
12
+ Rails::Html::FullSanitizer
13
+ .new
14
+ .sanitize("<b>Bold</b> no more! <a href='more.html'>See more here</a>...")
15
+ %>
16
+
17
+ <br/><br/><br/>
18
+
19
+ <hr>
20
+
21
+ <textarea rows="4" cols="200">
22
+ link_sanitizer = Rails::Html::LinkSanitizer.new
23
+ link_sanitizer.sanitize('<a href="example.com">Only the link text will be kept.</a>')
24
+ # => Only the link text will be kept.
25
+ </textarea>
26
+
27
+ <%=
28
+ Rails::Html::LinkSanitizer
29
+ .new
30
+ .sanitize('<a href="example.com">Only the link text will be kept.</a>')
31
+ %>
@@ -69,8 +69,6 @@ module RailsAppGenerator
69
69
  # webmock 3.13.0 3.14.0 = 3.13.0 development, test
70
70
  # websocket-driver 0.6.5 0.7.5
71
71
 
72
- # gem "rails-html-sanitizer", "1.3.0"
73
- # gem "unicorn", "5.3.0"
74
72
  # gem "honeybadger", "4.6.0"
75
73
  # gem "pg", "0.20.0"
76
74
  # gem "redis", "3.3.3"
@@ -345,6 +343,7 @@ module RailsAppGenerator
345
343
  # gsub_file 'app/views/layouts/application.html.erb', %(container mx-auto mt-28 px-5 flex), 'container mx-auto px-5'
346
344
  # template 'home.css', 'app/assets/stylesheets/home.css'
347
345
 
346
+ # OLD style will be removed soon
348
347
  def local_template_base(xxx)
349
348
  File.join(File.dirname(xxx), File.basename(xxx, '.*'))
350
349
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsAppGenerator
4
- VERSION = '0.1.9'
4
+ VERSION = '0.1.12'
5
5
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "rails_app_generator",
3
- "version": "0.1.9",
3
+ "version": "0.1.12",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "rails_app_generator",
9
- "version": "0.1.9",
9
+ "version": "0.1.12",
10
10
  "dependencies": {
11
11
  "daisyui": "^2.20.0"
12
12
  },
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rails_app_generator",
3
- "version": "0.1.9",
3
+ "version": "0.1.12",
4
4
  "description": "Create new Rails Application with custom opinions",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "args": {
3
- "app_path": "rails-html-sanitizer",
3
+ "app_path": "rails_html_sanitizer",
4
4
  "destination_root": "/Users/davidcruwys/dev/kgems/rails_app_generator/a/addons"
5
5
  },
6
6
  "opts": {
7
7
  "skip_git": true,
8
8
  "skip_test": true,
9
- "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/rails_html_sanitizer.rb",
9
+ "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/rails_html_sanitizer/_.rb",
10
10
  "add_rails_html_sanitizer": true
11
11
  }
12
12
  }
@@ -0,0 +1,12 @@
1
+ {
2
+ "args": {
3
+ "app_path": "rails_html_sanitizer",
4
+ "destination_root": "/Users/davidcruwys/dev/kgems/rails_app_generator/a/addons"
5
+ },
6
+ "opts": {
7
+ "skip_git": true,
8
+ "skip_test": true,
9
+ "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/rails_html_sanitizer/_.rb",
10
+ "add_rails_html_sanitizer": true
11
+ }
12
+ }
data/tasks/addon.thor CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  # https://codecrate.com/2014/01/replace-rake-with-thor.html
4
4
 
5
- require 'pry'
6
5
  require 'net/http'
7
6
  require 'json'
7
+ require_relative 'gem_info'
8
8
 
9
9
  # Thor task to create a new AddOn for Rails App Generator
10
10
  class AddOn < Thor
@@ -40,32 +40,18 @@ class AddOn < Thor
40
40
  end
41
41
 
42
42
  def build_required_gem_code
43
- return nil unless options[:gem]
44
-
45
- gem_name = options[:gem] == 'gem' ? name : options[:gem]
46
-
47
- info = gem_info(gem_name)
43
+ info = gem_info
48
44
 
49
45
  " required_gem gem.version('#{info.name}', '#{info.version}', '#{info.description}')"
50
46
  end
51
47
 
52
48
  # example: 'https://rubygems.org/api/v1/gems/draper.json'
53
- def gem_info(name)
54
- link = "https://rubygems.org/api/v1/gems/#{name.downcase}.json"
55
- info = Net::HTTP.get(URI.parse(link))
56
- json = JSON.parse(info)
57
-
58
- GemInfo.new(
59
- name: json['name'],
60
- version: json['version'],
61
- description: json['info']
62
- )
63
- rescue SocketError
64
- abort 'Internet connection cannot be established to RubyGems.org'
65
- rescue JSON::ParserError
66
- abort "Check you have entered the right Gem name\n#{link}"
49
+ def gem_info
50
+ return nil unless options[:gem]
51
+
52
+ gem_name = options[:gem] == 'gem' ? name : options[:gem]
53
+
54
+ ::GemInfo.get(gem_name)
67
55
  end
68
56
  end
69
57
  end
70
- # /Users/davidcruwys/dev/kgems/rails_app_generator/templates/thor/addon
71
- # /Users/davidcruwys/dev/kgems/rails_app_generator/lib/templates/thor
data/tasks/gem_info.rb ADDED
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Retrieve GemInfo from RubyGems.org
4
+ class GemInfo
5
+ attr_reader :name
6
+ attr_reader :version
7
+ attr_reader :description
8
+
9
+ def initialize(name, version, description)
10
+ @name = name
11
+ @version = version
12
+ @description = description
13
+ end
14
+
15
+ def debug
16
+ puts "name: #{name}"
17
+ puts "version: #{version}"
18
+ puts "description: #{description}"
19
+ end
20
+
21
+ class << self
22
+ def get(name)
23
+ gem_info = query_ruby_gems(name)
24
+
25
+ return gem_info if gem_info
26
+
27
+ return query_ruby_gems(name.gsub('_', '-')) if name.include?('_')
28
+ return query_ruby_gems(name.gsub('-', '_')) if name.include?('-')
29
+
30
+ abort "Cannot find GEM (#{name}) on RubyGems.org"
31
+ end
32
+
33
+ private
34
+
35
+ def query_ruby_gems(name)
36
+ link = "https://rubygems.org/api/v1/gems/#{name.downcase}.json"
37
+ info = Net::HTTP.get(URI.parse(link))
38
+ json = JSON.parse(info)
39
+
40
+ new(json['name'], json['version'], json['info'])
41
+ rescue SocketError
42
+ abort 'Internet connection cannot be established to RubyGems.org'
43
+ rescue JSON::ParserError
44
+ nil
45
+ end
46
+ end
47
+ end
data/tasks/profile.thor CHANGED
@@ -2,11 +2,113 @@
2
2
 
3
3
  # https://codecrate.com/2014/01/replace-rake-with-thor.html
4
4
 
5
+ require 'pry'
6
+ require_relative 'gem_info'
7
+ require 'cmdlet'
8
+
5
9
  # Thor task to create a new Profile for Rails App Generator
6
10
  class Profile < Thor
11
+ include Thor::Actions
12
+
13
+ source_root(File.expand_path('../templates/thor_task', File.dirname(__FILE__)))
14
+
15
+ Data = Struct.new(
16
+ :name,
17
+ :name_dash,
18
+ :name_snake,
19
+ :name_human,
20
+ :description,
21
+ :destination_root,
22
+ :template_file,
23
+ keyword_init: true
24
+ )
25
+
26
+ attr_accessor :data
27
+
7
28
  desc 'new', 'Create a new Profile for testing Rails App Generator settings'
29
+ method_option :variant, type: :string, default: 'default', desc: 'Profile variant to create, valid values are (nil, addons)'
30
+ method_option :gem, type: :string, default: nil, desc: 'Gem name is looked up to find version and description'
31
+ method_option :force, type: :boolean, default: false, desc: 'Overwrite existing files'
32
+ # rubocop:disable Metrics/AbcSize
8
33
  def new(name)
9
- # do something here
10
- puts "new #{name}"
34
+ @data = build_data(name)
35
+
36
+ say "Creating profile #{name}"
37
+ puts "Variant: #{options[:variant]}"
38
+
39
+ template('profile/profile.json', profile_path("#{data.name_dash}.json"), force: options[:force])
40
+ template('profile/after_template.rb', after_template_path('_.rb'), force: options[:force])
41
+ template('profile/home/index.html.erb', after_template_path('home/index.html.erb'), force: options[:force])
42
+ end
43
+ # rubocop:enable Metrics/AbcSize
44
+
45
+ # rubocop:disable Metrics/BlockLength
46
+ no_commands do
47
+ def human(value)
48
+ Cmdlet::Case::Human.new.call(value)
49
+ end
50
+
51
+ def dash(value)
52
+ Cmdlet::Case::Dash.new.call(value)
53
+ end
54
+
55
+ def snake(value)
56
+ Cmdlet::Case::Snake.new.call(value)
57
+ end
58
+
59
+ def profile_path(file)
60
+ path = 'profiles'
61
+ path = File.join(path, options[:variant]) if options[:variant]
62
+ File.join(path, file)
63
+ end
64
+
65
+ def after_template_path(file)
66
+ path = 'after_templates'
67
+ path = File.join(path, options[:variant]) if options[:variant]
68
+ path = File.join(path, data.name_snake)
69
+ File.join(path, file)
70
+ end
71
+
72
+ def build_data(name)
73
+ gi = gem_info(name)
74
+
75
+ name_dash = dash(name)
76
+ name_snake = snake(name)
77
+ description = gi ? gi.description : 'Description goes here'
78
+
79
+ Data.new(
80
+ name: name,
81
+ name_dash: name_dash,
82
+ name_snake: name_snake,
83
+ name_human: human(name_dash),
84
+ description: description,
85
+ destination_root: build_destination_root,
86
+ template_file: build_template_file(name_snake)
87
+ )
88
+ end
89
+
90
+ def build_template_file(name_snake)
91
+ path = '~/dev/kgems/rails_app_generator/after_templates/'
92
+ path = File.join(path, options[:variant]) if options[:variant]
93
+ path = File.join(path, "#{name_snake}/_.rb")
94
+ File.expand_path(path)
95
+ end
96
+
97
+ def build_destination_root
98
+ # Do not use destination_root as the method name because it already exists on Thor::Actions
99
+ path = '~/dev/kgems/rails_app_generator/a/'
100
+ path = File.join(path, options[:variant]) if options[:variant]
101
+ File.expand_path(path)
102
+ end
103
+
104
+ # example: 'https://rubygems.org/api/v1/gems/draper.json'
105
+ def gem_info(name)
106
+ return nil unless options[:gem]
107
+
108
+ gem_name = options[:gem] == 'gem' ? name : options[:gem]
109
+
110
+ GemInfo.get(gem_name)
111
+ end
11
112
  end
113
+ # rubocop:enable Metrics/BlockLength
12
114
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ # <%= data.description %>
4
+ require 'pry'
5
+
6
+ self.local_template_path = File.dirname(__FILE__)
7
+
8
+ gac 'base rails 7 image created'
9
+
10
+ add_controller('home', 'index')
11
+ route("root 'home#index'")
12
+
13
+ force_copy
14
+
15
+ copy_file 'home/index.html.erb', 'app/views/home/index.html.erb'
@@ -0,0 +1,3 @@
1
+ <h1><%= data.name_human %></h1>
2
+
3
+ <h2><%= data.description %></h2>
@@ -0,0 +1,12 @@
1
+ {
2
+ "args": {
3
+ "app_path": "<%= data.name_snake %>",
4
+ "destination_root": "<%= data.destination_root %>"
5
+ },
6
+ "opts": {
7
+ "skip_git": true,
8
+ "skip_test": true,
9
+ "template": "<%= data.template_file %>",
10
+ "add_<%= data.name_snake %>": true
11
+ }
12
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_app_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: cmdlet
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
125
139
  description: " Create new Rails Application with custom opinions\n"
126
140
  email:
127
141
  - david@ideasmen.com.au
@@ -146,8 +160,9 @@ files:
146
160
  - README.md
147
161
  - Rakefile
148
162
  - after_templates/README.md
149
- - after_templates/addons/rails_html_sanitizer.rb
150
- - after_templates/addons/rails_html_sanitizer/index.html.erb
163
+ - after_templates/addons/rails_html_sanitizer/_.rb
164
+ - after_templates/addons/rails_html_sanitizer/home/index.html.erb
165
+ - after_templates/addons/rails_html_sanitizer_xxx/home/index.html.erb
151
166
  - after_templates/rag_bootstrap.rb
152
167
  - after_templates/rag_bootstrap/application-yield.html.erb
153
168
  - after_templates/rag_bootstrap/application.html.erb
@@ -339,6 +354,7 @@ files:
339
354
  - package-lock.json
340
355
  - package.json
341
356
  - profiles/addons/rails-html-sanitizer.json
357
+ - profiles/addons/rails_html_sanitizer.json
342
358
  - profiles/rag-add-some-pages.json
343
359
  - profiles/rag-bootstrap.json
344
360
  - profiles/rag-devise.json
@@ -355,6 +371,7 @@ files:
355
371
  - profiles/rag-tailwind.json
356
372
  - sig/rails_app_generator.rbs
357
373
  - tasks/addon.thor
374
+ - tasks/gem_info.rb
358
375
  - tasks/profile.thor
359
376
  - templates/Gemfile-original-r7
360
377
  - templates/Gemfile-original-schienenzeppelin.erb
@@ -397,21 +414,10 @@ files:
397
414
  - templates/addons/scaffold/lib/templates/erb/scaffold/new.html.erb
398
415
  - templates/addons/scaffold/lib/templates/erb/scaffold/show.html.erb
399
416
  - templates/addons/services/app/services/application_service.rb
400
- - templates/app_x/controllers/authorized_controller.rb.erb
401
- - templates/app_x/controllers/errors_controller.rb.erb
402
- - templates/app_x/javascript/images/checkmark.svg
403
- - templates/app_x/javascript/images/logo.svg
404
- - templates/app_x/javascript/stylesheets/components.scss
405
- - templates/app_x/views/errors/internal_error.html.erb
406
- - templates/app_x/views/errors/not_found.html.erb
407
- - templates/app_x/views/errors/unacceptable.html.erb
408
- - templates/app_x/views/layouts/application.html.erb.tt
409
- - templates/app_x/views/pages/home.html.erb.tt
410
- - templates/app_x/views/shared/_flashes.html.erb.tt
411
- - templates/app_x/views/shared/_footer.html.erb.tt
412
- - templates/app_x/views/shared/_navbar.html.erb.tt
413
- - templates/app_x/workers/application_worker.rb
414
417
  - templates/thor_task/addon/addon.tt
418
+ - templates/thor_task/profile/after_template.rb.tt
419
+ - templates/thor_task/profile/home/index.html.erb.tt
420
+ - templates/thor_task/profile/profile.json.tt
415
421
  homepage: http://appydave.com/gems/rails_app_generator
416
422
  licenses:
417
423
  - MIT
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Rails HTML Sanitizer is responsible for sanitizing HTML fragments in Rails applications, i.e. in the sanitize, sanitize_css, strip_tags and strip_links methods.
4
- require 'pry'
5
-
6
- self.local_template_path = local_template_base(__FILE__)
7
-
8
- gac 'base rails 7 image created'
9
-
10
- add_controller('home', 'index')
11
- route("root 'home#index'")
12
-
13
- force_copy
14
-
15
- copy_file 'index.html.erb', 'app/views/home/index.html.erb'
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class AuthorizedController < ApplicationController
4
- include Pundit
5
-
6
- before_action :authenticate_user!
7
-
8
- after_action :verify_authorized, except: :index
9
- after_action :verify_policy_scoped, only: :index
10
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class ErrorsController < ApplicationController
4
- def not_found
5
- respond_to do |format|
6
- format.html { render status: 404 }
7
- format.json { render json: { error: 'Resource not found' }, status: 404 }
8
- end
9
- end
10
-
11
- def unacceptable
12
- respond_to do |format|
13
- format.html { render status: 422 }
14
- format.json { render json: { error: 'Params unacceptable' }, status: 422 }
15
- end
16
- end
17
-
18
- def internal_error
19
- respond_to do |format|
20
- format.html { render status: 500 }
21
- format.json { render json: { error: 'Internal server error' }, status: 500 }
22
- end
23
- end
24
- end
@@ -1 +0,0 @@
1
- <svg fill="#fff" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M0 11l2-2 5 5L18 3l2 2L7 18z"/></svg>
@@ -1 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 92.81 122.88" style="enable-background:new 0 0 92.81 122.88" xml:space="preserve"><style type="text/css">.st0{fill-rule:evenodd;clip-rule:evenodd;}</style><g><path class="st0" d="M66.69,101.35H26.68l-4.7,6.94h49.24L66.69,101.35L66.69,101.35z M17.56,114.81l-5.47,8.07H0l19.64-29.46 h-3.49c-4.76,0-8.66-3.9-8.66-8.66V8.66C7.5,3.9,11.39,0,16.15,0h61.22c4.76,0,8.66,3.9,8.66,8.66v76.1c0,4.76-3.9,8.66-8.66,8.66 h-3.4l18.83,29.04H80.45l-4.99-7.65H17.56L17.56,114.81z M62.97,67.66h10.48c1.14,0,2.07,0.93,2.07,2.07V80.2 c0,1.14-0.93,2.07-2.07,2.07H62.97c-1.14,0-2.07-0.93-2.07-2.07V69.72C60.9,68.59,61.83,67.66,62.97,67.66L62.97,67.66z M18.98,67.66h10.48c1.14,0,2.07,0.93,2.07,2.07V80.2c0,1.14-0.93,2.07-2.07,2.07H18.98c-1.14,0-2.07-0.93-2.07-2.07V69.72 C16.91,68.59,17.84,67.66,18.98,67.66L18.98,67.66z M25.1,16.7h42.81c4.6,0,8.36,3.76,8.36,8.37v13.17c0,4.6-3.76,8.36-8.36,8.36 H25.1c-4.6,0-8.36-3.76-8.36-8.36V25.07C16.74,20.47,20.5,16.7,25.1,16.7L25.1,16.7z M38.33,3.8h16.2C55.34,3.8,56,4.46,56,5.27 v6.38c0,0.81-0.66,1.47-1.47,1.47h-16.2c-0.81,0-1.47-0.66-1.47-1.47V5.27C36.85,4.46,37.51,3.8,38.33,3.8L38.33,3.8z"/></g></svg>
@@ -1,206 +0,0 @@
1
-
2
- .btn {
3
- @apply font-normal text-base rounded cursor-pointer border border-transparent appearance-none inline-block select-none leading-normal antialiased align-baseline;
4
-
5
- padding: 0.35rem 0.75rem;
6
- transition: 0.15s ease;
7
-
8
- }
9
-
10
- .btn-default {
11
- @apply bg-white border border-gray-400 text-gray-700;
12
-
13
- &:hover,
14
- &:focus {
15
- @apply border-gray-700;
16
- }
17
- }
18
-
19
- .btn-blue {
20
- @apply bg-blue-600 text-white;
21
-
22
- &:hover,
23
- &:focus {
24
- @apply bg-blue-700;
25
- }
26
-
27
- &.btn-outline {
28
- @apply bg-transparent text-blue-600 border border-blue-600;
29
-
30
- &:hover,
31
- &:focus {
32
- @apply bg-blue-600 text-white;
33
- }
34
- }
35
- }
36
-
37
- .btn-group {
38
- .btn {
39
- @apply rounded-none;
40
-
41
- &:first-child {
42
- @apply rounded-tr-none rounded-br-none border-r-0 rounded-tl rounded-bl;
43
- }
44
-
45
- &:last-child {
46
- @apply rounded-tl-none rounded-bl-none border-l-0 rounded-tr rounded-br;
47
- }
48
- }
49
- }
50
-
51
- %focus-style {
52
- @apply shadow outline-none border-gray-500;
53
-
54
- box-shadow: 0 0 0 0.2rem theme("colors.gray.200");
55
- background-clip: padding-box;
56
- }
57
-
58
- .input {
59
- @apply appearance-none block w-full text-gray-700 border border-gray-400 rounded px-3 leading-tight bg-white shadow-inner;
60
- padding-top: .65rem;
61
- padding-bottom: .65rem;
62
- }
63
-
64
- .input:focus,
65
- .input:hover {
66
- @extend %focus-style;
67
- }
68
-
69
- .label {
70
- @apply block text-gray-700 text-sm font-bold mb-2;
71
- }
72
-
73
- .select {
74
- @apply appearance-none py-3 px-4 pr-8 block w-full bg-white border border-gray-300 text-gray-700 rounded leading-tight;
75
- -webkit-appearance: none;
76
-
77
- }
78
-
79
- .select:focus {
80
- @apply outline-none border-gray-400;
81
-
82
- box-shadow: 0 0 0 0.2rem theme("colors.gray.100");
83
- background-clip: padding-box;
84
- }
85
-
86
- .caret {
87
- @apply pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-800;
88
- }
89
-
90
- .input-group {
91
- @apply mb-6;
92
- }
93
-
94
- .input-file {
95
- height: auto;
96
- z-index: 2;
97
- cursor: pointer;
98
-
99
- @apply inline-block opacity-0 pl-0 pr-0 py-3 px-3 overflow-hidden absolute border-none;
100
-
101
- + label {
102
- @extend .btn;
103
- @extend .btn-default;
104
-
105
- @apply cursor-pointer inline-flex items-center justify-start w-auto;
106
-
107
- * {
108
- pointer-events: none;
109
- }
110
-
111
- &:focus {
112
- outline: 1px dotted #000;
113
- outline: -webkit-focus-ring-color auto 5px;
114
- }
115
- }
116
- }
117
-
118
- .input-checkbox {
119
- @apply flex items-center justify-start;
120
-
121
- input[type="checkbox"] {
122
- @apply hidden appearance-none;
123
-
124
- &:checked ~ label:before {
125
- content: "";
126
- background-image: url('~images/checkmark.svg');
127
- background-size: 10px 10px;
128
- border-radius: 2px;
129
- @apply bg-blue-500 border-transparent text-white bg-no-repeat bg-center transition ease-in-out duration-100 shadow-none;
130
- }
131
-
132
- &:disabled {
133
- @apply pointer-events-none opacity-50;
134
- }
135
- }
136
-
137
- label {
138
- @apply cursor-pointer appearance-none;
139
-
140
- &:before {
141
- border-radius: 2px;
142
- border: 1px solid rgb(209, 209, 209);
143
- box-shadow: inset 0 1px 1px rgba(#ddd, .8);
144
- content: "";
145
- height: 16px;
146
- margin-right: 10px;
147
- top: -5px;
148
- width: 16px;
149
-
150
- @apply bg-white inline-flex items-center justify-center relative transition ease-in-out duration-200;
151
-
152
- }
153
-
154
- &:hover::before {
155
- @apply bg-gray-100 border-gray-500;
156
- }
157
- }
158
- }
159
-
160
- .input-radio {
161
- @apply flex items-center justify-start;
162
-
163
- input[type="radio"] {
164
- @apply hidden appearance-none;
165
-
166
- &:checked ~ label:before {
167
- content: "";
168
- @apply bg-blue-500 border-transparent text-white transition ease-in-out duration-100 shadow-none;
169
- }
170
-
171
- &:checked ~ label:after {
172
- @apply bg-white rounded-full;
173
- content: "";
174
- width: 6px;
175
- height: 6px;
176
- position: absolute;
177
- top: 8px;
178
- left: 5px;
179
- box-shadow: 0 1px 1px rgba(#2B6CB0, .9);
180
- }
181
-
182
- &:disabled {
183
- @apply pointer-events-none opacity-50;
184
- }
185
- }
186
-
187
- label {
188
- @apply cursor-pointer appearance-none relative;
189
-
190
- &:before {
191
- border: 1px solid rgb(209, 209, 209);
192
- box-shadow: inset 0 1px 1px rgba(#ddd, .8);
193
- content: "";
194
- height: 16px;
195
- margin-right: 4px;
196
- top: -5px;
197
- width: 16px;
198
-
199
- @apply bg-white inline-flex items-center justify-center relative transition ease-in-out duration-200 rounded-full;
200
- }
201
-
202
- &:hover::before {
203
- @apply bg-gray-100 border-gray-500;
204
- }
205
- }
206
- }
@@ -1,14 +0,0 @@
1
- <div class="container mx-auto px-4">
2
- <section class="py-8 px-4 text-center">
3
- <div class="max-w-auto mx-auto">
4
- <div class="md:max-w-lg mx-auto flex justify-center">
5
- <svg class="fill-current text-gray-300 h-48" viewBox="0 0 445 202" xmlns="http://www.w3.org/2000/svg">
6
- <path d="M38.804 144.71c1.527 8.356 4.447 14.803 8.76 19.34 4.312 4.537 10.601 6.805 18.867 6.805 9.523 0 16.778-3.346 21.764-10.04 4.987-6.693 7.48-15.116 7.48-25.268 0-9.973-2.336-18.396-7.008-25.269-4.672-6.873-11.95-10.31-21.832-10.31-4.672 0-8.715.585-12.129 1.753-6.02 2.156-10.557 6.154-13.611 11.994l-34.5-1.617L20.34 4.15h107.678v32.614H48.103l-7.008 42.72c5.93-3.863 10.556-6.423 13.88-7.681 5.57-2.067 12.354-3.1 20.35-3.1 16.172 0 30.277 5.436 42.317 16.307 12.039 10.87 18.058 26.683 18.058 47.437 0 18.059-5.795 34.186-17.385 48.381-11.59 14.196-28.93 21.293-52.02 21.293-18.597 0-33.87-4.986-45.82-14.959C8.527 177.19 1.879 163.04.53 144.711h38.274zm155.789-43.528c0 22.46 1.842 39.643 5.525 51.547 3.684 11.905 11.23 17.857 22.64 17.857 11.411 0 18.89-5.952 22.44-17.857 3.548-11.904 5.323-29.086 5.323-51.547 0-23.54-1.775-40.97-5.324-52.29s-11.028-16.98-22.438-16.98c-11.41 0-18.957 5.66-22.64 16.98-3.684 11.32-5.526 28.75-5.526 52.29zM222.759.242c24.887 0 42.339 8.76 52.356 26.28 10.018 17.52 15.027 42.406 15.027 74.66s-5.01 57.095-15.027 74.525c-10.017 17.43-27.47 26.145-52.356 26.145-24.887 0-42.339-8.715-52.357-26.145-10.017-17.43-15.026-42.271-15.026-74.525 0-32.254 5.009-57.14 15.026-74.66C180.42 9.001 197.872.241 222.76.241zm125.332 100.94c0 22.46 1.842 39.643 5.525 51.547 3.684 11.905 11.23 17.857 22.64 17.857 11.411 0 18.89-5.952 22.44-17.857 3.548-11.904 5.323-29.086 5.323-51.547 0-23.54-1.775-40.97-5.324-52.29s-11.028-16.98-22.438-16.98c-11.41 0-18.957 5.66-22.64 16.98-3.684 11.32-5.526 28.75-5.526 52.29zM376.257.242c24.887 0 42.339 8.76 52.356 26.28 10.018 17.52 15.027 42.406 15.027 74.66s-5.01 57.095-15.027 74.525c-10.017 17.43-27.47 26.145-52.356 26.145-24.887 0-42.339-8.715-52.357-26.145-10.017-17.43-15.026-42.271-15.026-74.525 0-32.254 5.009-57.14 15.026-74.66C333.918 9.001 351.37.241 376.257.241z" fill-rule="nonzero"/>
7
- </svg>
8
- </div>
9
- <h2 class="mt-8 uppercase text-xl lg:text-5xl font-black">Something went terribly wrong</h2>
10
- <p class="mt-6 text-sm lg:text-base text-gray-900">If you are the application owner check the logs for more information.</p>
11
- <a href="/" class="mt-12 btn btn-default">Back To Homepage</a>
12
- </div>
13
- </section>
14
- </div>
@@ -1,14 +0,0 @@
1
- <div class="container mx-auto px-4">
2
- <section class="py-8 px-4 text-center">
3
- <div class="max-w-auto mx-auto">
4
- <div class="md:max-w-lg mx-auto flex justify-center">
5
- <svg class="fill-current text-gray-300 h-48" viewBox="0 0 445 202" xmlns="http://www.w3.org/2000/svg">
6
- <path d="M137.587 154.953h-22.102V197h-37.6v-42.047H.53v-33.557L72.36 2.803h43.125V124.9h22.102v30.053zM77.886 124.9V40.537L28.966 124.9h48.92zm116.707-23.718c0 22.46 1.842 39.643 5.525 51.547 3.684 11.905 11.23 17.857 22.64 17.857 11.411 0 18.89-5.952 22.44-17.857 3.548-11.904 5.323-29.086 5.323-51.547 0-23.54-1.775-40.97-5.324-52.29s-11.028-16.98-22.438-16.98c-11.41 0-18.957 5.66-22.64 16.98-3.684 11.32-5.526 28.75-5.526 52.29zM222.759.242c24.887 0 42.339 8.76 52.356 26.28 10.018 17.52 15.027 42.406 15.027 74.66s-5.01 57.095-15.027 74.525c-10.017 17.43-27.47 26.145-52.356 26.145-24.887 0-42.339-8.715-52.357-26.145-10.017-17.43-15.026-42.271-15.026-74.525 0-32.254 5.009-57.14 15.026-74.66C180.42 9.001 197.872.241 222.76.241zm221.824 154.711h-22.102V197h-37.6v-42.047h-77.355v-33.557l71.83-118.593h43.125V124.9h22.102v30.053zM384.882 124.9V40.537l-48.92 84.363h48.92z" fill-rule="nonzero" />
7
- </svg>
8
- </div>
9
- <h2 class="mt-8 uppercase text-xl lg:text-5xl font-black">Page not found</h2>
10
- <p class="mt-6 text-sm lg:text-base text-gray-900">The page you are looking for might have been removed had its name changed or is temporarily unavailable.</p>
11
- <a href="/" class="mt-12 btn btn-default">Back To Homepage</a>
12
- </div>
13
- </section>
14
- </div>
@@ -1,14 +0,0 @@
1
- <div class="container mx-auto px-4">
2
- <section class="py-8 px-4 text-center">
3
- <div class="max-w-auto mx-auto">
4
- <div class="md:max-w-lg mx-auto flex justify-center">
5
- <svg class="fill-current text-gray-300 h-48" viewBox="0 0 445 202" xmlns="http://www.w3.org/2000/svg">
6
- <path d="M137.587 154.953h-22.102V197h-37.6v-42.047H.53v-33.557L72.36 2.803h43.125V124.9h22.102v30.053zM77.886 124.9V40.537L28.966 124.9h48.92zm77.49 72.1c.36-14.016 3.37-26.818 9.03-38.408 5.48-13.028 18.417-26.818 38.812-41.373 17.7-12.668 29.154-21.742 34.365-27.223 7.996-8.535 11.994-17.879 11.994-28.031 0-8.266-2.29-15.139-6.873-20.62-4.582-5.48-11.14-8.22-19.676-8.22-11.68 0-19.63 4.357-23.853 13.072-2.426 5.032-3.863 13.028-4.313 23.989h-37.33c.63-16.622 3.639-30.053 9.03-40.295C176.804 10.394 194.997.646 221.142.646c20.664 0 37.105 5.728 49.324 17.183 12.219 11.455 18.328 26.616 18.328 45.483 0 14.465-4.313 27.313-12.938 38.543-5.66 7.458-14.958 15.768-27.896 24.932l-15.363 10.916c-9.614 6.828-16.195 11.77-19.743 14.824a43.443 43.443 0 00-8.962 10.647h85.306V197H155.376zm153.498 0c.36-14.016 3.37-26.818 9.03-38.408 5.48-13.028 18.417-26.818 38.812-41.373 17.7-12.668 29.154-21.742 34.365-27.223 7.996-8.535 11.994-17.879 11.994-28.031 0-8.266-2.29-15.139-6.873-20.62-4.582-5.48-11.14-8.22-19.676-8.22-11.68 0-19.63 4.357-23.853 13.072-2.426 5.032-3.863 13.028-4.313 23.989h-37.33c.63-16.622 3.639-30.053 9.03-40.295C330.302 10.394 348.495.646 374.64.646c20.664 0 37.105 5.728 49.324 17.183 12.219 11.455 18.328 26.616 18.328 45.483 0 14.465-4.312 27.313-12.938 38.543-5.66 7.458-14.958 15.768-27.896 24.932l-15.363 10.916c-9.614 6.828-16.195 11.77-19.743 14.824a43.443 43.443 0 00-8.962 10.647h85.306V197H308.874z" fill-rule="nonzero"/>
7
- </svg>
8
- </div>
9
- <h2 class="mt-8 uppercase text-xl lg:text-5xl font-black">The change you wanted was rejected</h2>
10
- <p class="mt-6 text-sm lg:text-base text-gray-900">Maybe you tried to change something you didn't have access to?</p>
11
- <a href="/" class="mt-12 btn btn-default">Back To Homepage</a>
12
- </div>
13
- </section>
14
- </div>
@@ -1,30 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title><%= camelized %></title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <%%= csrf_meta_tags %>
7
- <%%= csp_meta_tag %>
8
-
9
- <%- if options[:skip_javascript] -%>
10
- <%%= stylesheet_link_tag 'application' %>
11
- <%- else -%>
12
- <%- unless options[:skip_turbolinks] -%>
13
- <%%= stylesheet_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
14
- <%%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
15
- <%- else -%>
16
- <%%= stylesheet_pack_tag 'application' %>
17
- <%%= javascript_pack_tag 'application' %>
18
- <%- end -%>
19
- <%- end -%>
20
- </head>
21
-
22
- <body class="flex flex-col min-h-screen">
23
- <%%= render 'shared/navbar' %>
24
- <%%= render 'shared/flashes' %>
25
- <main class="flex-grow">
26
- <%%= yield %>
27
- </main>
28
- <%%= render 'shared/footer' %>
29
- </body>
30
- </html>
@@ -1,20 +0,0 @@
1
- <div class="py-20 bg-gray-100">
2
- <div class="container mx-auto px-6">
3
- <h2 class="text-6xl font-bold mb-2">
4
- <%= camelized %>
5
- </h2>
6
- <h3 class="text-2xl mb-8 text-gray-800">
7
- Created with <a class="underline" href="https://github.com/hschne/schienenzeppelin">Schienenzeppelin</a>
8
- </h3>
9
- <button class="btn btn-blue">
10
- View Documentation
11
- </button>
12
- </div>
13
- </div>
14
-
15
- <section class="container mx-auto px-6 p-10 text-center">
16
- <h2 class="text-2xl font-bold text-gray-800 mb-2">Ready to do some magic?</h2>
17
- <p>Edit this page in <code class="bg-gray-100">app/views/pages/home.html.erb</code></p>
18
- </section>
19
-
20
-
@@ -1,12 +0,0 @@
1
- <%% flash.each do |type, message| %>
2
- <%% if type == "alert" %>
3
- <div class="bg-red-500">
4
- <div class="container px-2 py-4 mx-auto font-sans font-medium text-center text-white"><%%= message %></div>
5
- </div>
6
- <%% end %>
7
- <%% if type == "notice" %>
8
- <div class="bg-green-500">
9
- <div class="container px-2 py-4 mx-auto font-sans font-medium text-center text-white"><%%= message %></div>
10
- </div>
11
- <%% end %>
12
- <%% end %>
@@ -1,21 +0,0 @@
1
- <footer class="bg-gray-100">
2
- <div class="container mx-auto px-8">
3
-
4
- <div class="w-full flex py-6 justify-between">
5
- <div class="flex align-middle">
6
- © <%%= Date.current.year %> <%= app_name.capitalize %>
7
- </div>
8
- <div class="flex w-1/3 justify-end">
9
- <ul class="list-reset w-full flex justify-around align-middle items-center mb-6">
10
- <li class="mt-2 mr-2 md:mr-0">
11
- <a href="#" class="no-underline hover:underline">About</a>
12
- </li>
13
- <li class="mt-2 mr-2 md:mr-0">
14
- <a href="#" class="no-underline hover:underline">Contact</a>
15
- </li>
16
- </ul>
17
- </div>
18
- </div>
19
- </div>
20
- </footer>
21
-
@@ -1,55 +0,0 @@
1
- <header class="shadow">
2
- <nav
3
- <%-if uses?(:stimulus_components) -%>
4
- data-controller="dropdown"
5
- <%- end -%>
6
- class="container mx-auto flex flex-wrap justify-between items-center p-5">
7
- <div>
8
- <a
9
- class="flex items-center mr-2"
10
- <%- if uses?(:high_voltage) -%>
11
- href="<%%= root_path %>"
12
- <%- else -%>
13
- href="/"
14
- <%- end -%>
15
- >
16
- <%- if uses?(:inline_svg) -%>
17
- <%%= inline_svg_pack_tag('media/images/logo.svg', class: "rounded mx-2", size: "3rem * 3rem") %>
18
- <%- end -%>
19
- <p class="font-bold text-lg"><%= app_name.capitalize %> </p>
20
- </a>
21
- </div>
22
- <div class="flex md:hidden">
23
- <button
24
- <%- if uses?(:stimulus_components) -%>
25
- data-action="click->dropdown#toggle click@window->dropdown#hide"
26
- <%- end -%>
27
- class="px-3 py-2 border border-gray-500 rounded text-grey hover:text-gray-600 hover:border-gray-600" >
28
- <svg class="w-3 h-3 fill-current" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
29
- <title>Menu</title>
30
- <path d="M0 3h20v2H0V3zm0 6h20v2H0V9zm0 6h20v2H0v-2z"/>
31
- </svg>
32
- </button>
33
- </div>
34
- <div
35
- <%-if uses?(:stimulus_components) -%>
36
- data-dropdown-target="menu"
37
- <%- end -%>
38
- class="hidden md:flex-grow md:flex w-full md:w-auto text-right md:text-left text-bold mt-5 md:mt-0 border-t-2 border-gray-200 md:border-none">
39
- <div class="justify-start flex-grow">
40
- <!-- SZ Link Placeholder -->
41
- </div>
42
- <%-if uses?(:devise) -%>
43
- <ul class="w-full flex-col md:flex md:flex-row items-center justify-end md:w-auto">
44
- <%% if user_signed_in? %>
45
- <li><%%= link_to "Edit account", edit_user_registration_path, class: "btn btn-default md:mr-2 my-2 md:my-0 " %></li>
46
- <li><%%= link_to "Log out", destroy_user_session_path, method: :delete, class: "btn btn-default" %></li>
47
- <%% else %>
48
- <li><%%= link_to "Login", new_user_session_path, class: "btn btn-blue md:mr-2 my-2 md:my-0" %></li>
49
- <li><%%= link_to "Sign Up", new_user_registration_path, class: "btn btn-blue" %></li>
50
- <%% end %>
51
- </ul>
52
- <%- end -%>
53
- </div>
54
- </nav>
55
- </header>
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class ApplicationWorker
4
- include Sidekiq::Worker
5
- end