dog_biscuits 0.5.5 → 0.5.6
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71c03a6e89458b01913889f32d2b524be47258e9b88c707fd7e789b95d7aa1ee
|
4
|
+
data.tar.gz: 0a4cb9cc5f6a6e0b7262dbe969b0f81c367498833e0f9b748a576f77b646aff4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84362a1e341973479f6cf4996970c866dcc98e5c57090879b4d72ae5696f4e2f821f443876d77666f3f496fc59f0aa6b19881fac211531193ce5c30386aec10e
|
7
|
+
data.tar.gz: 6f43da07453911a68d54d957dbf76ce2049ac5374e254b5feb93662d1467097223d4a11585e2eac4c7898c9d2139ac58641e1595e0410e92c722e862d5e1b79d
|
data/lib/dog_biscuits/version.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'rails/generators'
|
3
|
+
require 'rails/generators/model_helpers'
|
4
|
+
|
5
|
+
class DogBiscuits::PresenterGenerator < Rails::Generators::NamedBase
|
6
|
+
include Rails::Generators::ModelHelpers
|
7
|
+
source_root File.expand_path('../../work/templates', __FILE__)
|
8
|
+
|
9
|
+
desc '
|
10
|
+
This generator makes the following changes to your application:
|
11
|
+
The DogBiscuits Presenter generator makes the following changes to your application:
|
12
|
+
1. Creates the presenter
|
13
|
+
'
|
14
|
+
|
15
|
+
def banner
|
16
|
+
say_status("info", "Creating presenter for: #{class_name}", :blue)
|
17
|
+
end
|
18
|
+
|
19
|
+
# This is in a separate generator to try and get round the NameError on first run
|
20
|
+
# caused when calling constantize on class_name (ie. the model class) in the template
|
21
|
+
def presenter_template
|
22
|
+
template('presenter.rb.erb', File.join('app/presenters/hyrax', class_path, "#{file_name}_presenter.rb"))
|
23
|
+
rescue NameError => e
|
24
|
+
say_status("error", e.message, :red)
|
25
|
+
end
|
26
|
+
end
|
@@ -44,7 +44,11 @@ This generator makes the following changes to your application:
|
|
44
44
|
say_status("info", "RUNNING rails generate hyrax:work #{class_name}", :blue)
|
45
45
|
generate "hyrax:work #{class_name}", '-f'
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
|
+
def create_actor
|
49
|
+
template('actor.rb.erb', File.join('app/actors/hyrax/actors', class_path, "#{file_name}_actor.rb"))
|
50
|
+
end
|
51
|
+
|
48
52
|
def create_indexer
|
49
53
|
if options[:skipmodel]
|
50
54
|
say_status("info", "SKIPPING INDEXER GENERATION", :blue)
|
@@ -52,7 +56,7 @@ This generator makes the following changes to your application:
|
|
52
56
|
template('indexer.rb.erb', File.join('app/indexers', class_path, "#{file_name}_indexer.rb"))
|
53
57
|
end
|
54
58
|
end
|
55
|
-
|
59
|
+
|
56
60
|
def create_model
|
57
61
|
if options[:skipmodel]
|
58
62
|
say_status("info", "SKIPPING MODEL GENERATION", :blue)
|
@@ -60,15 +64,15 @@ This generator makes the following changes to your application:
|
|
60
64
|
template('model.rb.erb', File.join('app/models/', class_path, "#{file_name}.rb"))
|
61
65
|
end
|
62
66
|
end
|
63
|
-
|
64
|
-
def
|
65
|
-
template('
|
67
|
+
|
68
|
+
def create_form
|
69
|
+
template('form.rb.erb', File.join('app/forms/hyrax', class_path, "#{file_name}_form.rb"))
|
66
70
|
end
|
67
|
-
|
68
|
-
def
|
69
|
-
|
71
|
+
|
72
|
+
def create_presenter
|
73
|
+
generate "dog_biscuits:presenter #{class_name}", '-f'
|
70
74
|
end
|
71
|
-
|
75
|
+
|
72
76
|
def create_attribute_rows
|
73
77
|
attributes_file = "app/views/hyrax/#{file_name.pluralize}/_attribute_rows.html.erb"
|
74
78
|
copy_file '_attribute_rows.html.erb', attributes_file
|
@@ -85,12 +89,6 @@ This generator makes the following changes to your application:
|
|
85
89
|
def imagify
|
86
90
|
generate "dog_biscuits:imagify #{class_name}", '-f' if File.exist?('config/initializers/version.rb') && File.read('config/initializers/version.rb').include?('Hyku')
|
87
91
|
end
|
88
|
-
|
89
|
-
# Sometimes we see a name error NameError because *_form.rb references the Model which hasn't yet been loaded
|
90
|
-
# rescue doesn't help, so run this last to ensure files are all in place before the error
|
91
|
-
def create_form
|
92
|
-
template('form.rb.erb', File.join('app/forms/hyrax', class_path, "#{file_name}_form.rb"))
|
93
|
-
end
|
94
92
|
|
95
93
|
def display_readme
|
96
94
|
readme 'README'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dog_biscuits
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julie Allinson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hyrax
|
@@ -437,6 +437,7 @@ files:
|
|
437
437
|
- lib/generators/dog_biscuits/imagify_generator.rb
|
438
438
|
- lib/generators/dog_biscuits/install_generator.rb
|
439
439
|
- lib/generators/dog_biscuits/locales_generator.rb
|
440
|
+
- lib/generators/dog_biscuits/presenter/presenter_generator.rb
|
440
441
|
- lib/generators/dog_biscuits/schema_org_generator.rb
|
441
442
|
- lib/generators/dog_biscuits/templates/_date_template.html.erb
|
442
443
|
- lib/generators/dog_biscuits/templates/app/controllers/catalog_controller.rb
|
@@ -504,7 +505,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
504
505
|
- !ruby/object:Gem::Version
|
505
506
|
version: '0'
|
506
507
|
requirements: []
|
507
|
-
rubygems_version: 3.0.
|
508
|
+
rubygems_version: 3.0.3
|
508
509
|
signing_key:
|
509
510
|
specification_version: 4
|
510
511
|
summary: DogBiscuits provides re-usable models, vocabularies and other services for
|