fangorn 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fangorn/app.rb +3 -0
- data/lib/fangorn/js.rb +19 -2
- data/lib/fangorn/output.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b85a2b7d571b9c700c5126e8a021ee9d749214a
|
4
|
+
data.tar.gz: 87464a8ef32dbb2f52ad4a3ae605f8afe38d5361
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 406d58c264b22c8007aa7b275bdfefd8776941222d53f64700b603dd19454c445db96d24ad6f98fa6324a1477e04c4df5c3f312e83db7bf28cb1c3c6d477e7da
|
7
|
+
data.tar.gz: 716386c0d4017871b24a0d0b834e8103652e3a36ac38afd0a15ff75838f8b7c2262770e4ba770c88ab831cbf69067fa2c0a7ff1b303aa7149086df1a7e2243db
|
data/lib/fangorn/app.rb
CHANGED
data/lib/fangorn/js.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
|
+
require 'yaml'
|
1
2
|
module Fangorn
|
2
3
|
class Js < Output
|
3
4
|
@@cleaned = false
|
4
5
|
|
5
6
|
def initialize(input)
|
6
|
-
output = Output::dist? ? application_js : File.join(Output::dest
|
7
|
+
output = Output::dist? ? application_js : File.join(Output::dest, input.sub(File.join(Output::source, ''), ''))
|
7
8
|
super input, output
|
9
|
+
|
10
|
+
@config = YAML.load_file 'fangorn.yml'
|
8
11
|
end
|
9
12
|
|
10
13
|
protected
|
@@ -14,12 +17,26 @@ module Fangorn
|
|
14
17
|
|
15
18
|
File.open(@output, Output::dist? ? 'a' : 'w') do |f|
|
16
19
|
f.puts "// #{@input}" if Output::dist?
|
17
|
-
|
20
|
+
|
21
|
+
contents = File.read(@input)
|
22
|
+
if config = get_config
|
23
|
+
config.each do |key,val|
|
24
|
+
contents.gsub!("${#{key}}", val.to_s)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
f.write contents
|
18
29
|
f.puts if Output::dist?
|
19
30
|
end
|
20
31
|
end
|
21
32
|
def application_js
|
22
33
|
File.join Output::dest, 'js', 'application.js'
|
23
34
|
end
|
35
|
+
|
36
|
+
def get_config
|
37
|
+
if @config
|
38
|
+
@config[Output::env]
|
39
|
+
end
|
40
|
+
end
|
24
41
|
end
|
25
42
|
end
|
data/lib/fangorn/output.rb
CHANGED
@@ -28,6 +28,10 @@ module Fangorn
|
|
28
28
|
@@dist
|
29
29
|
end
|
30
30
|
|
31
|
+
def self.env
|
32
|
+
@@env
|
33
|
+
end
|
34
|
+
|
31
35
|
def self.source
|
32
36
|
File.absolute_path(@@source)
|
33
37
|
end
|
@@ -48,9 +52,14 @@ module Fangorn
|
|
48
52
|
@@dest = dest
|
49
53
|
end
|
50
54
|
|
55
|
+
def self.env= (env)
|
56
|
+
@@env = env
|
57
|
+
end
|
58
|
+
|
51
59
|
@@dist = false
|
52
60
|
@@source = 'app'
|
53
61
|
@@dest = nil
|
62
|
+
@@env = 'default'
|
54
63
|
end
|
55
64
|
end
|
56
65
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fangorn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Calhoun
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: listen
|