filegen 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,9 @@
1
+ 0.2.4: 2014-01-14
2
+ * Activate erb trim mode (see http://ruby-doc.org/stdlib-2.0.0/libdoc/erb/rdoc/ERB.html : new)
3
+
4
+ 0.2.3: 2014-01-14
5
+ * Handle SIG INT
6
+
1
7
  0.2.2: 2014-01-14
2
8
  * Better error messages if template file name is missing
3
9
  * Refactoring of ui messages
data/README.md CHANGED
@@ -32,24 +32,29 @@ available on the commandline.
32
32
  Please make sure you have an ERB-template available. It needs to end with
33
33
  `.erb`! Place in anywhere you like. It's important that the name of variable in
34
34
  the template matches the name of environment variable or yaml-key: wording,
35
- case. The lookup is case-sensitive. If you want to get access to the variable,
36
- you need to use the `lookup`-method. It also provides a default value if the
37
- variable looked up is undefined.
35
+ case. The lookup is case-sensitive. If you want to write the output to a file
36
+ you need to redirect stdout with `>`. Otherwise it will output the content on
37
+ `$stdout`.
38
+
39
+ ### Variable lookup
40
+
41
+ If you want to get access to the variable, you need to use the `lookup`-method.
38
42
 
39
43
  ```ruby
40
44
  # look up variable
41
45
  lookup(<variable>)
46
+ ```
47
+
48
+ The `lookup`-method will return an empty string '' if a variable cannot be
49
+ looked up. If a default value is given it will return the default value instead
50
+ of the empty string.
42
51
 
52
+ ```ruby
43
53
  # look up variable and use default value if variable is undefined
44
54
  lookup(<variable>, <default_value>)
45
55
  ```
46
56
 
47
- If you want to write the output to a file you need
48
- to redirect stdout with `>`. Otherwise it will output the content on `$stdout`.
49
-
50
- ### Variable lookup
51
-
52
- The default order of data sources to lookup a variable, is: 1st environment
57
+ The default order of data sources to lookup a variable, is: 1st environment
53
58
  variable and 2nd yaml file. The yaml file needs be given as command line argument
54
59
  see below at [Generate a file based on YAML file](#yaml).
55
60
 
@@ -69,7 +74,6 @@ commandline
69
74
  --data-sources yaml
70
75
  ```
71
76
 
72
-
73
77
  ### Generate a file based on Environment Variables
74
78
 
75
79
  The content of `template.erb`:
@@ -23,7 +23,7 @@ module Filegen
23
23
  # @param [IO] destination
24
24
  # The output io handle
25
25
  def compile(source, destination)
26
- erb = ERB.new(source.read)
26
+ erb = ERB.new(source.read, nil, '-')
27
27
  destination.puts erb.result(data.instance_binding)
28
28
  end
29
29
  end
@@ -1,4 +1,4 @@
1
1
  #main Filegen
2
2
  module Filegen
3
- VERSION = '0.2.3'
3
+ VERSION = '0.3.0'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filegen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: