client_variable 0.0.2 → 0.0.3
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/client_variable.gemspec +1 -0
- data/lib/client_variable/helper/view.rb +1 -1
- data/lib/client_variable/rails/engine.rb +35 -0
- data/lib/client_variable/rails/railtie.rb +9 -0
- data/lib/client_variable/rails/task.rake +9 -0
- data/lib/client_variable/request.rb +1 -1
- data/lib/client_variable/version.rb +1 -1
- data/lib/client_variable.rb +2 -2
- data/lib/generators/client_variable/install/templates/config.yml +2 -2
- data/vendor/assets/javascripts/{variable.js.erb → variable.js} +1 -1
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94d0c9ee41377b46876a345e273f048bde3be5b1
|
4
|
+
data.tar.gz: d49028dba0fdc43f0e29571f0a9d10b2b609189d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5643aaa782229097bfbc9179b6089c9b460414f5b8c2c6ae2b2d8da967b427d8e09cb39d12094f72f371fe8b8d4c22257ba9374ee7066c24e348b5d8cf30df7d
|
7
|
+
data.tar.gz: ad95e6cd2a9a338c4614c2c9de466d67c23d5ae2a9b6782cc50d6033b5fff836892c5bbc26265a947a5a862c997eb349496596fbad01e49eefed7ac1783a0f6d
|
data/client_variable.gemspec
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'sprockets/engines'
|
2
|
+
require 'tilt/template'
|
3
|
+
|
4
|
+
module Client
|
5
|
+
class Engine < Rails::Engine
|
6
|
+
initializer "sprockets.mquy", :after => "sprockets.environment", :group => :all do |app|
|
7
|
+
app.assets.register_engine('.mquy', TiltHandlebars)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class TiltHandlebars < Tilt::Template
|
12
|
+
def self.default_mime_type
|
13
|
+
'application/javascript'
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize_engine; end
|
17
|
+
|
18
|
+
def prepare; end
|
19
|
+
|
20
|
+
# Generates Javascript code from a HandlebarsJS template.
|
21
|
+
# The SC template name is derived from the lowercase logical asset path
|
22
|
+
# by replacing non-alphanum characheters by underscores.
|
23
|
+
def evaluate(scope, locals, &block)
|
24
|
+
binding.pry
|
25
|
+
template = data.dup
|
26
|
+
template.gsub!(/"/, '\\"')
|
27
|
+
template.gsub!(/\r?\n/, '\\n')
|
28
|
+
template.gsub!(/\t/, '\\t')
|
29
|
+
return 'console.log(1223);'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
Tilt.register 'mquy', Client::TiltHandlebars
|
35
|
+
Sprockets.register_engine '.mquy', Client::TiltHandlebars
|
data/lib/client_variable.rb
CHANGED
@@ -47,10 +47,10 @@ module Client
|
|
47
47
|
|
48
48
|
def self.generate
|
49
49
|
data = YAML.load(ERB.new(File.new("#{Rails.root}/config/client_variable.yml").read).result)
|
50
|
-
data[Rails.env]
|
50
|
+
data[Rails.env]
|
51
51
|
end
|
52
52
|
|
53
|
-
class Engine <
|
53
|
+
class Engine < Rails::Engine; end
|
54
54
|
|
55
55
|
require 'client_variable/request'
|
56
56
|
require 'client_variable/global'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: client_variable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MQuy
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description: export variable in rails to client-side
|
42
56
|
email:
|
43
57
|
- sugiacupit@gmail.com
|
@@ -56,13 +70,16 @@ files:
|
|
56
70
|
- lib/client_variable/global.rb
|
57
71
|
- lib/client_variable/helper/controller.rb
|
58
72
|
- lib/client_variable/helper/view.rb
|
73
|
+
- lib/client_variable/rails/engine.rb
|
74
|
+
- lib/client_variable/rails/railtie.rb
|
75
|
+
- lib/client_variable/rails/task.rake
|
59
76
|
- lib/client_variable/request.rb
|
60
77
|
- lib/client_variable/version.rb
|
61
78
|
- lib/generators/client_variable/install/install_generator.rb
|
62
79
|
- lib/generators/client_variable/install/templates/config.yml
|
63
80
|
- spec/client_variable_spec.rb
|
64
81
|
- spec/spec_helper.rb
|
65
|
-
- vendor/assets/javascripts/variable.js
|
82
|
+
- vendor/assets/javascripts/variable.js
|
66
83
|
homepage: https://github.com/MQuy
|
67
84
|
licenses:
|
68
85
|
- MIT
|