wavy 0.0.1 → 0.0.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/lib/wavy/core.rb +39 -8
- data/lib/wavy/help.rb +1 -1
- data/lib/wavy/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: ac8ffa39788f70fecb382bc3823098d937eb0298
|
4
|
+
data.tar.gz: 51008e427fe0861b6e0d3d3ccb74fd8d41fb0c6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65d547d231727c90a25fd376ce988ce98cc14444379edc780c93496cd8f35ddf3bed22af5da335d4cee0da6736c35bc635cf68cd9e62f5852204af16f0711c8d
|
7
|
+
data.tar.gz: 8feff9148a7a0dbddc03b739aaec771803faad93d329d4694761bddc25958ae31359b8504b044fcc33c489c4c60babccc264a1af2fcdb2b1b83d498da93bb616
|
data/lib/wavy/core.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
1
3
|
require 'wavy/utils'
|
2
4
|
require 'wavy/nodes'
|
3
5
|
require 'wavy/models'
|
@@ -17,7 +19,6 @@ module Wavy
|
|
17
19
|
|
18
20
|
String @view
|
19
21
|
String @config
|
20
|
-
String @filename
|
21
22
|
|
22
23
|
# Creates a new Core
|
23
24
|
#
|
@@ -29,18 +30,33 @@ module Wavy
|
|
29
30
|
@config = config
|
30
31
|
@save = save
|
31
32
|
@config_root = File.expand_path(File.dirname(@config))
|
32
|
-
@filename = File.basename(@view)
|
33
33
|
end
|
34
34
|
|
35
35
|
# Reads configuration and view files. Begins parsing.
|
36
36
|
def compile()
|
37
37
|
begin
|
38
|
+
|
38
39
|
@config = FILE_IMPORTER.load(@config, true)
|
40
|
+
|
39
41
|
Wavy::Parsers::Import.load(@config, @config_root)
|
40
42
|
Wavy::Parsers::Import.extract
|
41
|
-
|
42
|
-
|
43
|
-
|
43
|
+
|
44
|
+
if File.directory?(@view)
|
45
|
+
Dir.glob(@view + "/**/*.wavy") do |template|
|
46
|
+
full_path = template.dup
|
47
|
+
full_path.slice! @view
|
48
|
+
|
49
|
+
filename = File.basename(template)
|
50
|
+
|
51
|
+
template = FILE_IMPORTER.load(template)
|
52
|
+
render(template, full_path)
|
53
|
+
end
|
54
|
+
else
|
55
|
+
filename = File.basename(@view)
|
56
|
+
template = FILE_IMPORTER.load(@view)
|
57
|
+
render(template, filename)
|
58
|
+
end
|
59
|
+
|
44
60
|
rescue Exception => e
|
45
61
|
puts e.message
|
46
62
|
end
|
@@ -49,15 +65,30 @@ module Wavy
|
|
49
65
|
# Saves parsed template.
|
50
66
|
#
|
51
67
|
# @param (String) view Content of the view
|
52
|
-
def render(view)
|
68
|
+
def render(view, filename)
|
53
69
|
output = Wavy::Models::Template.new(view).parse
|
54
70
|
|
55
71
|
if @save != false
|
56
|
-
filename =
|
72
|
+
filename = filename.gsub("#{FILE_SUFFIX}", "")
|
57
73
|
path = File.expand_path(@save)
|
58
|
-
|
74
|
+
|
75
|
+
if filename[0] == "/"
|
76
|
+
filename[0] = ""
|
77
|
+
end
|
78
|
+
|
79
|
+
if path[-1,1] == "/"
|
80
|
+
path = path + filename
|
81
|
+
else
|
82
|
+
path = path + "/" + filename
|
83
|
+
end
|
59
84
|
|
60
85
|
begin
|
86
|
+
dirname = File.dirname(path)
|
87
|
+
puts dirname
|
88
|
+
unless File.directory?(dirname)
|
89
|
+
FileUtils.mkdir_p(dirname)
|
90
|
+
end
|
91
|
+
|
61
92
|
file = File.open(path, "w")
|
62
93
|
file.write(output)
|
63
94
|
rescue IOError => e
|
data/lib/wavy/help.rb
CHANGED
data/lib/wavy/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wavy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Govaere
|
@@ -10,7 +10,7 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2014-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: Wavy is a simple templating engine for HTML
|
13
|
+
description: Wavy is a simple templating engine for HTML – Inspired By Sass
|
14
14
|
email: matthew.govaere@gmail.com
|
15
15
|
executables:
|
16
16
|
- wavy
|