cook.ie 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/cookie +0 -1
- data/lib/cookie_cutter/cookie.rb +10 -4
- data/lib/cookie_cutter/version.rb +1 -1
- 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: eee2f3661463449054da34d3e9f9e923756887f1
|
4
|
+
data.tar.gz: 48294e8d234071e6a9612dec7f086e055a1471f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af26ee0983faa3eaa60ab609651f1b44aeee3898ee0f2436878bb9d8f60f0afd18c96ffaec748138615cb870dc328abfdadaa2a3abf8f86202febda88cdf43a3
|
7
|
+
data.tar.gz: 4b632e8b6ef5259485e255ff6a5d81b4751961aa29d67ce3f48f074bf9493abed1d044985c6de5562e42a9bc19ed7d5d8b4dd74dc4c875109896ff8cc5765a0b
|
data/bin/cookie
CHANGED
data/lib/cookie_cutter/cookie.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'pathname'
|
2
|
+
require 'erb'
|
2
3
|
|
3
4
|
module CookieCutter
|
4
5
|
# builds a text file with specified parameters
|
@@ -6,8 +7,8 @@ module CookieCutter
|
|
6
7
|
# * it's name
|
7
8
|
# * where to save itself
|
8
9
|
class Cookie
|
9
|
-
attr_accessor :name, :
|
10
|
-
attr_accessor :template_options
|
10
|
+
attr_accessor :name, :output
|
11
|
+
attr_accessor :overwrite, :template_options
|
11
12
|
|
12
13
|
# constants
|
13
14
|
OUTPUT_DIR = 'output_dir'
|
@@ -18,17 +19,22 @@ module CookieCutter
|
|
18
19
|
# defaults
|
19
20
|
@overwrite = true
|
20
21
|
@name = name
|
22
|
+
@output = {}
|
23
|
+
@output[:name] = name
|
21
24
|
@template_options = template_options
|
22
25
|
end
|
23
26
|
|
24
27
|
def assemble
|
25
|
-
|
28
|
+
_template_path = File.open(self.template_path).read
|
29
|
+
output = ERB.new(_template_path).result(binding)
|
30
|
+
return output
|
26
31
|
end
|
27
32
|
|
28
33
|
def save
|
34
|
+
template_output = self.assemble
|
29
35
|
save_path = File.join(self.where_to_save, "#{@name}.txt")
|
30
36
|
f = File.open(save_path, 'w+')
|
31
|
-
f.write(
|
37
|
+
f.write(template_output)
|
32
38
|
end
|
33
39
|
|
34
40
|
# assumption, all templates will be kept in the config directory
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cook.ie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ritchie Macapinlac
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: log4r
|