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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c5959e7b31a7565a63bdec8802465c0fb4389527
4
- data.tar.gz: 3011bef5bf3f58bd30903199ef885c0e04de76b5
3
+ metadata.gz: ac8ffa39788f70fecb382bc3823098d937eb0298
4
+ data.tar.gz: 51008e427fe0861b6e0d3d3ccb74fd8d41fb0c6c
5
5
  SHA512:
6
- metadata.gz: dfba4d12c8b77b39955fe16d488644962767985d8dafb861123158365dbec2984ccca18dda71d6cbbb137a6d3783494633093fc977e8263293d2249384f9c41c
7
- data.tar.gz: 81241688917074d656d9608e9f6697efd5e652866dad8221d86c1ca68a5043c4a77a661ce5dfc64449481a3d7d409c36c735ffaaa27c73401d179f5139ca4a23
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
- @view = FILE_IMPORTER.load(@view)
43
- render(@view)
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 = @filename.gsub("#{FILE_SUFFIX}", "")
72
+ filename = filename.gsub("#{FILE_SUFFIX}", "")
57
73
  path = File.expand_path(@save)
58
- path = path + "/" + filename
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
@@ -4,5 +4,5 @@ Description:
4
4
  Converts Wavy files to HTML
5
5
 
6
6
  Options:
7
- -v, --version Prints Version
7
+ -v, --version Prints version
8
8
  "
data/lib/wavy/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Wavy
2
2
 
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
4
 
5
5
  class Version
6
6
 
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.1
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