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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48eb52d12b998f1474c0c6d9a1ad5ba29601a195
4
- data.tar.gz: bf14913ad0ab3f4cd24c93081b54ec07d51f69a4
3
+ metadata.gz: 6b85a2b7d571b9c700c5126e8a021ee9d749214a
4
+ data.tar.gz: 87464a8ef32dbb2f52ad4a3ae605f8afe38d5361
5
5
  SHA512:
6
- metadata.gz: 34f182ce750c5767e0286e7330439ea9569daed87517ac0f4f72b93e275a660048af189f32cb1a67cf9e8d7b9e84bb6eda0d6945ff347ffe827bcac4170fb841
7
- data.tar.gz: acc6a13a48fbe48594c67f947b1cb56ff58ff9e382a8e33d53242563430c7f706f493dea7c8a21b1acc3eb429e971c7647081151b71789603ef01f37edb1aacf
6
+ metadata.gz: 406d58c264b22c8007aa7b275bdfefd8776941222d53f64700b603dd19454c445db96d24ad6f98fa6324a1477e04c4df5c3f312e83db7bf28cb1c3c6d477e7da
7
+ data.tar.gz: 716386c0d4017871b24a0d0b834e8103652e3a36ac38afd0a15ff75838f8b7c2262770e4ba770c88ab831cbf69067fa2c0a7ff1b303aa7149086df1a7e2243db
data/lib/fangorn/app.rb CHANGED
@@ -19,6 +19,9 @@ module Fangorn
19
19
  opts.on('-d', '--dist', 'Compile a distribution package') do
20
20
  Output::dist!
21
21
  end
22
+ opts.on('-e', '--env=ENV', 'Use environment name with fangorn.yml settings') do |env|
23
+ Output::env = env
24
+ end
22
25
  end
23
26
 
24
27
  begin
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?, input.sub(File.join(Output::source, ''), ''))
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
- f.write File.read(@input)
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
@@ -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.7
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-07-28 00:00:00.000000000 Z
11
+ date: 2016-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: listen