elm-rails 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +3 -2
- data/lib/elm/rails.rb +6 -0
- data/lib/elm/rails/sprockets.rb +37 -21
- data/lib/elm/rails/version.rb +1 -1
- metadata +33 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 592fe0f86123f0ad238f843c561347cf32199e00
|
4
|
+
data.tar.gz: 6022ce54d4354c1318d1568b886e5158061510f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d26269dfbbfc7a8a2d3a74e3c29e36a8f6c3d5c1c6154354d675b2a490096764b0642d454cc6ec5b5af085c4d934a4d7dba77c9d4f5abc1c3eb9577b4df673a
|
7
|
+
data.tar.gz: 032b7dc7d53ddb166253810de041d9b1a889cfe35d092c6f6360c57cc3b99d355add224279f763c336699de4c4d66ff71bf082e5f212fbef735b7176d2b527cb
|
data/Rakefile
CHANGED
data/lib/elm/rails.rb
CHANGED
data/lib/elm/rails/sprockets.rb
CHANGED
@@ -24,37 +24,53 @@ module Elm
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def call(input)
|
27
|
-
context
|
28
|
-
|
29
|
-
|
27
|
+
context = input[:environment].context_class.new(input)
|
28
|
+
DependencyGraph.new(input[:filename], input[:load_path]).each do |dependency|
|
29
|
+
context.depend_on dependency
|
30
|
+
end
|
31
|
+
compiled = Elm::Compiler.compile(input[:filename], {
|
32
|
+
debug: debug_flag,
|
33
|
+
elm_make_path: Elm::Rails.elm_make_path
|
34
|
+
})
|
35
|
+
context.metadata.merge data: compiled
|
30
36
|
end
|
31
37
|
|
32
38
|
private
|
33
39
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
40
|
+
def debug_flag
|
41
|
+
case ENV['ELM_RAILS_DEBUG']
|
42
|
+
when nil, /^false$/i, '0'
|
43
|
+
false
|
44
|
+
else
|
45
|
+
true
|
46
|
+
end
|
47
|
+
end
|
42
48
|
|
43
|
-
|
44
|
-
|
49
|
+
class DependencyGraph < Struct.new(:filename, :load_path)
|
50
|
+
def each &block
|
51
|
+
recurse File.read(filename), block
|
52
|
+
end
|
45
53
|
|
46
|
-
|
47
|
-
dependency_logical_name = module_name.gsub(".", "/")
|
54
|
+
private
|
48
55
|
|
49
|
-
|
50
|
-
|
56
|
+
def recurse source, block
|
57
|
+
source.scan(import_regex) do |(module_name)|
|
58
|
+
logical_name = module_name.gsub(".", "/")
|
59
|
+
filepath = load_path + "/" + logical_name + ".elm"
|
51
60
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
61
|
+
# If we don't find the dependency in our filesystem, assume it's because
|
62
|
+
# it comes in through a third-party package rather than our sources.
|
63
|
+
if File.file?(filepath)
|
64
|
+
block.call logical_name
|
65
|
+
recurse File.read(filepath), block
|
66
|
+
end
|
56
67
|
end
|
57
68
|
end
|
69
|
+
|
70
|
+
def import_regex
|
71
|
+
# `import Quiz.Question exposing (..)`
|
72
|
+
/^import\s+([^\s]+)/
|
73
|
+
end
|
58
74
|
end
|
59
75
|
end
|
60
76
|
end
|
data/lib/elm/rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elm-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Bonetti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,14 +30,42 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.3.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.3.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: appraisal
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
41
69
|
description: Description of ElmRails.
|
42
70
|
email:
|
43
71
|
- frank.r.bonetti@gmail.com
|
@@ -73,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
101
|
version: '0'
|
74
102
|
requirements: []
|
75
103
|
rubyforge_project:
|
76
|
-
rubygems_version: 2.
|
104
|
+
rubygems_version: 2.6.8
|
77
105
|
signing_key:
|
78
106
|
specification_version: 4
|
79
107
|
summary: Summary of ElmRails.
|