optipipe 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/optipipe/engine.rb +1 -1
- data/lib/optipipe/helpers/tag_helper.rb +1 -1
- data/lib/optipipe/models/mapper.rb +22 -14
- data/lib/optipipe/railtie.rb +10 -0
- data/lib/optipipe/version.rb +1 -1
- data/lib/optipipe.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e934634eec7b8b742655a7d7a7fdc6bab110e324
|
4
|
+
data.tar.gz: af7f6028b8c35d384a70554d26b35ec80ae60a25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cc1285a4696f09eba8ae8f3a940197e17aafdca339fa8e21107f27de6219394f052f2580f5ca9208018bd5b0640452e1cc4bca6a6f3d6717fe9beb4fa07ffe2
|
7
|
+
data.tar.gz: ff1b610312dfda6631d10f578ae215336b41a4069bcefab785c5d5b19a9bb5e114223d73dc1124887be6a045618af010e0334498fb7d5a79e8b67755871dd89d
|
data/lib/optipipe/engine.rb
CHANGED
@@ -1,9 +1,4 @@
|
|
1
1
|
module Optipipe
|
2
|
-
def self.initial_load!
|
3
|
-
Mapper.load_yaml_data('javascripts')
|
4
|
-
Mapper.load_yaml_data('stylesheets')
|
5
|
-
end
|
6
|
-
|
7
2
|
class Mapper
|
8
3
|
class << self
|
9
4
|
def get_javascript_mappers(controller_path)
|
@@ -14,21 +9,34 @@ module Optipipe
|
|
14
9
|
get_yaml_data('stylesheets')[controller_path]
|
15
10
|
end
|
16
11
|
|
17
|
-
def
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
12
|
+
def load_yamls!
|
13
|
+
javascript_files = Dir.glob(Rails.root.join('app', 'assets', 'javascripts', 'optipipe', 'mappers', '*'))
|
14
|
+
stylesheet_files = Dir.glob(Rails.root.join('app', 'assets', 'stylesheets', 'optipipe', 'mappers', '*'))
|
15
|
+
|
16
|
+
mapper_data = {
|
17
|
+
javascripts: {},
|
18
|
+
stylesheets: {}
|
19
|
+
}
|
20
|
+
javascript_files.sort.each do |yaml_path|
|
21
|
+
data = YAML.load(File.open(yaml_path))
|
22
|
+
mapper_data[:javascripts][data['controller_path']] ||= []
|
23
|
+
mapper_data[:javascripts][data['controller_path']] << data
|
24
|
+
end
|
25
|
+
stylesheet_files.sort.each do |yaml_path|
|
26
|
+
data = YAML.load(File.open(yaml_path))
|
27
|
+
mapper_data[:stylesheets][data['controller_path']] ||= []
|
28
|
+
mapper_data[:stylesheets][data['controller_path']] << data
|
24
29
|
end
|
25
|
-
|
30
|
+
|
31
|
+
Kernel.send(:remove_const, :OPTIPIPE_MAPPER_DATA) if Kernel.const_defined?(:OPTIPIPE_MAPPER_DATA)
|
32
|
+
Kernel.const_set(:OPTIPIPE_MAPPER_DATA, Marshal.load(Marshal.dump(mapper_data)))
|
26
33
|
end
|
27
34
|
|
28
35
|
private
|
29
36
|
|
30
37
|
def get_yaml_data(type)
|
31
|
-
|
38
|
+
data = Kernel.const_get(:OPTIPIPE_MAPPER_DATA)
|
39
|
+
Marshal.load(Marshal.dump(data))[type.to_sym]
|
32
40
|
end
|
33
41
|
end
|
34
42
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Optipipe
|
2
|
+
if defined?(Rails::Railtie)
|
3
|
+
class Railtie < Rails::Railtie
|
4
|
+
# Parse the mappers before any of the initializers
|
5
|
+
initializer :load_optipipe_mappers, :before => :load_environment_config do
|
6
|
+
Optipipe::Mapper.load_yamls!
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/lib/optipipe/version.rb
CHANGED
data/lib/optipipe.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: optipipe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ykogure
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -66,6 +66,7 @@ files:
|
|
66
66
|
- lib/optipipe/engine.rb
|
67
67
|
- lib/optipipe/helpers/tag_helper.rb
|
68
68
|
- lib/optipipe/models/mapper.rb
|
69
|
+
- lib/optipipe/railtie.rb
|
69
70
|
- lib/optipipe/version.rb
|
70
71
|
- lib/tasks/optipipe_tasks.rake
|
71
72
|
homepage: https://github.com/ZIGExN/optipipe
|