action_view_preview 0.1.3 → 0.1.4
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 +4 -4
- data/README.md +5 -0
- data/lib/action_view_preview/engine.rb +27 -0
- data/lib/action_view_preview/version.rb +1 -1
- data/lib/action_view_preview.rb +4 -7
- metadata +3 -4
- data/lib/tasks/action_view_preview_tasks.rake +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0df4dc41ff998ad490e65caace4beb0c6440d30b5057d4bf8d8c5abaca650cc5
|
4
|
+
data.tar.gz: dbdfaba6e935fe35602c79fe458905af2be6ca95b68d37a8c26cf3179a8bb92f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9add839c2bfa7fb1e7963a13310ee25a8eb5153281561459f820b388f1542ae44484070699ed08118f5844698d62a4b047892cb0db877f7b87407f4bffaecf44
|
7
|
+
data.tar.gz: d515accf986e5c108575212f08a3019a264a6a16697d9ffb5f51dd20b8bceb7c2e0d936e7ba8ae9f9f56ba493840039fa09b9251f9475dce33a423ad3cb47aa9
|
data/README.md
CHANGED
@@ -21,6 +21,11 @@ $ gem install action_view_preview
|
|
21
21
|
```
|
22
22
|
|
23
23
|
## Usage
|
24
|
+
### Command Line Install
|
25
|
+
|
26
|
+
Run `rails generate action_view_preview:install` and the generator should create a `hello_preview.rb` and mount the route in your `routes.rb` file, similar to the steps shown below in the manual install.
|
27
|
+
|
28
|
+
### Manual Install
|
24
29
|
1. Mount the engine in your `routes.rb`:
|
25
30
|
|
26
31
|
```ruby
|
@@ -1,5 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails"
|
4
|
+
|
1
5
|
module ActionViewPreview
|
2
6
|
class Engine < ::Rails::Engine
|
3
7
|
isolate_namespace ActionViewPreview
|
8
|
+
|
9
|
+
config.action_view_preview = ActionViewPreview
|
10
|
+
config.eager_load_namespaces << ActionViewPreview
|
11
|
+
|
12
|
+
initializer "action_view_preview.set_configs" do |app|
|
13
|
+
options = app.config.action_view_preview
|
14
|
+
|
15
|
+
options.preview_path ||= defined?(Rails.root) ? "#{Rails.root}/test/views/previews" : nil
|
16
|
+
|
17
|
+
ActiveSupport.on_load(:action_view_preview) do
|
18
|
+
options.each { |k, v| ActionViewPreview.send("#{k}=", v) }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
initializer "action_view_preview.set_autoload_paths" do |app|
|
23
|
+
options = app.config.action_view_preview
|
24
|
+
|
25
|
+
if options.preview_path
|
26
|
+
ActiveSupport::Dependencies.autoload_paths << options.preview_path
|
27
|
+
end
|
28
|
+
end
|
4
29
|
end
|
5
30
|
end
|
31
|
+
|
32
|
+
require 'action_view_preview' if !defined?(ActionViewPreview::Base)
|
data/lib/action_view_preview.rb
CHANGED
@@ -1,19 +1,16 @@
|
|
1
1
|
require "action_view_preview/version"
|
2
|
-
require "
|
2
|
+
require "active_support/dependencies/autoload"
|
3
3
|
|
4
4
|
module ActionViewPreview
|
5
5
|
extend ::ActiveSupport::Autoload
|
6
6
|
|
7
7
|
autoload :Base
|
8
8
|
|
9
|
-
mattr_accessor :preview_path
|
9
|
+
mattr_accessor :preview_path, instance_writer: false
|
10
10
|
|
11
11
|
def self.setup
|
12
12
|
yield self
|
13
13
|
end
|
14
|
-
|
15
|
-
def self.preview_path
|
16
|
-
@@preview_path || "#{Rails.root}/test/views/previews"
|
17
|
-
end
|
18
|
-
|
19
14
|
end
|
15
|
+
|
16
|
+
require "action_view_preview/engine" if defined?(Rails::Engine)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_view_preview
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lucas Campanari
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -57,7 +57,6 @@ files:
|
|
57
57
|
- lib/generators/action_view_preview/action_view_preview_generator.rb
|
58
58
|
- lib/generators/action_view_preview/install_generator.rb
|
59
59
|
- lib/generators/action_view_preview/templates/test/views/previews/%file_name%_preview.rb.tt
|
60
|
-
- lib/tasks/action_view_preview_tasks.rake
|
61
60
|
homepage: https://github.com/lcampanari/action_view_preview
|
62
61
|
licenses:
|
63
62
|
- MIT
|
@@ -80,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
79
|
- !ruby/object:Gem::Version
|
81
80
|
version: '0'
|
82
81
|
requirements: []
|
83
|
-
rubygems_version: 3.
|
82
|
+
rubygems_version: 3.1.6
|
84
83
|
signing_key:
|
85
84
|
specification_version: 4
|
86
85
|
summary: Views preview for Rails
|