partial_compiler 0.0.3 → 0.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea61ca2744f267a516fa1bbdf0509ca403d6da93
4
- data.tar.gz: fcaa34f7fd2c0d80d44ba9ad564c5aa3319c05a7
3
+ metadata.gz: ecb61c73e1e6b3b596587d301227d2d8297ec7d1
4
+ data.tar.gz: 9b314598fae54a39c4ce82c31e314a8bda466c1f
5
5
  SHA512:
6
- metadata.gz: 2351b4a326e1b91200ee7846ad524f242db014fd4d8629f6ee42b3fdc1566a31a2c83a61efebd96fbddd5cdbd6614618373601d080c8abb3a17e50eed3af4bea
7
- data.tar.gz: 553d23d029889c944c8462b05353c3b9c5a155f1382841b9b1d63ffa028a76fc175fa5cd8c47bd1d32fc356e80362b02161ad3d2fbcaa5355d5935122b0328bf
6
+ metadata.gz: 54d58d29f2860e9094c576874293deefca96db78a87e7de3ec2e13037e367ed4dba4dd49f23a4c69d6fc4659190dd862dfe680d1d8789ea6adcc47f1c9023935
7
+ data.tar.gz: 9a2fd94ac7b1048e9d0c5ec1daee36dea90c200634b0dca347a338f227c9f511220fdc6e5347fc0478e52822c484fc06e35e3aa82a057b4340363569f980538e
@@ -2,7 +2,7 @@ module PartialCompiler
2
2
  class Plugin
3
3
  def initialize
4
4
  original_extension = PartialCompiler.config[:original_extension]
5
- template_engine = PartialCompiler.config[:template_engine]
5
+ template_engine = get_template_engine
6
6
  if !PartialCompiler.config[:run_compiled]
7
7
  ActionView::Template.register_template_handler(
8
8
  "uc.#{original_extension}".to_sym, "uncompiled.#{original_extension}".to_sym,
@@ -12,10 +12,14 @@ module PartialCompiler
12
12
  ActionView::Template.register_template_handler("compiled.#{original_extension}".to_sym, template_engine.send(:new))
13
13
  end
14
14
  end
15
- end
16
15
 
17
- def self.start
18
- Plugin.new
16
+ private
17
+
18
+ def get_template_engine
19
+ template_engine_class = PartialCompiler.config[:template_engine]
20
+ return "ActionView::Template::Handlers::#{template_engine_class}".constantize
21
+ end
19
22
  end
23
+
20
24
  end
21
25
 
@@ -1,5 +1,5 @@
1
1
  #:nocov:
2
2
  module PartialCompiler
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  #:nocov:
@@ -1,7 +1,8 @@
1
1
  module PartialCompiler
2
2
  require 'partial_compiler/railtie' if defined?(Rails)
3
+
3
4
  @config = {
4
- template_engine: ActionView::Template::Handlers::ERB,
5
+ template_engine: "ERB",
5
6
  original_extension: "html.erb",
6
7
  rendering_engine_partial_format: "= render partial:",
7
8
  # This code would be the code that's executing inside your template, e.g. `render partial: 'my_partial'`
@@ -18,6 +19,10 @@ module PartialCompiler
18
19
  def self.config
19
20
  @config
20
21
  end
22
+
23
+ def self.start
24
+ Plugin.new
25
+ end
21
26
  end
22
27
 
23
28
  require "partial_compiler/plugin"
@@ -1,6 +1,6 @@
1
1
  namespace :compiler do
2
2
  desc "Compiles your partials"
3
- task :run do
3
+ task :run => :environment do
4
4
  PartialCompiler::Compiler.new
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: partial_compiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noah Kochanowicz