tonka 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tonka.rb +29 -8
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba1aa8d09a66bf1c6d2e9e99968fdcf1815b62cb
4
- data.tar.gz: 5b22ff47176e0760f8aeb11c4ca5c08077fbe466
3
+ metadata.gz: df8bb22acdad807b7edb8d8a1f9d6f745120019a
4
+ data.tar.gz: 49071c6e35b5468c15b766080ef1c8d3b5222444
5
5
  SHA512:
6
- metadata.gz: 84d04882770f1e806f11b981eed9f60ea3cf7b5af6ac914b985fe0c6c3b1735fdc03c0715713250a61ffe9810c7602efd1fcd2f0f60cf69fc924a83ce47b7ca0
7
- data.tar.gz: 337ee62b145c138c4dde186d1eef000e188570aa44bdb8581fd9a50407a21ab78712f5e82fbdafeae2fa2cf4f50bc2d2975e5ac0d7ada2b2e1a388ab6280c1fc
6
+ metadata.gz: b71bb721e9c0e1ca3ad8c459267c0c517669bc5880383965023010773e8fba9a70b40dee723a3fdbbd1300dbc56938207dbeeb39f0e72c0f7cf8fe04a7b5040e
7
+ data.tar.gz: 32725633450430250fbe2696a154047d463492b0a3bf696def8492120f2e4055944245ae706b34b1b094e1d8fb55085f2aa0c57f24323f290b05a942bf806efa
data/lib/tonka.rb CHANGED
@@ -103,10 +103,14 @@ class Tonka
103
103
  "build\s\t\t\tbuilds a basic static site with the name passed in as SITE_NAME\n\n",
104
104
  "destroy\s\t\t\tdestroys a previously built site with the name passed in as SITE_NAME\n\n",
105
105
  "serve\s\t\t\tserves your files using WEBrick on port 2000 (a different port can be passed in as an argument)\n\n",
106
- "The most common options:\n\n","
107
- -jquery \t\tadds jquery to index.html file.\n",
106
+ "The most common options:\n\n",
107
+ "-jquery \t\tadds jquery to index.html file.\n",
108
108
  "-underscore \t\tadds underscore.js to the javascripts folder and the index.html file.\n",
109
- "-backbone \t\tadds backbone.js to the javascripts folder and the index.html file."]
109
+ "-backbone \t\tadds backbone.js, underscore.js, and jquery.js to the javascripts folder and the index.html file.\n",
110
+ "-handlebars \t\tadds handlebars.js to the javascripts folder and the index.html file.\n",
111
+ "-d3 \t\t\tadds d3.js to the javascripts folder and the index.html file.\n",
112
+ "-raphael \t\tadds raphael.js to the javascripts folder and the index.html file.\n"
113
+ ]
110
114
  puts usage_array.join("")
111
115
  end
112
116
 
@@ -126,8 +130,9 @@ class Tonka::HTML
126
130
  @script_array = add_js_files(options)
127
131
  @layout_array_2 = [
128
132
  "</head>\n",
129
- "<body>\n",
130
- "\</body>\n",
133
+ "<body>\n"]
134
+ @script_array_2 = add_handlebars_template(options)
135
+ @layout_array_3 = ["</body>\n",
131
136
  "</html>"]
132
137
 
133
138
 
@@ -137,7 +142,7 @@ class Tonka::HTML
137
142
 
138
143
  def render(options)
139
144
  @index_html = File.new("#{$SITE_NAME}/index.html","w")
140
- @layout = @layout_array_1.join("") + @script_array.join("") + @layout_array_2.join("")
145
+ @layout = @layout_array_1.join("") + @script_array.join("") + @layout_array_2.join("") + @script_array_2.join("") + @layout_array_3.join("")
141
146
  @index_html.puts @layout
142
147
  @index_html.close
143
148
  puts "\t\tbuilt ".green+"#{$SITE_NAME}/index.html"
@@ -168,6 +173,19 @@ class Tonka::HTML
168
173
  return tags
169
174
  end
170
175
 
176
+ def add_handlebars_template(options)
177
+ tag = []
178
+ handlebars_template = "\t<script id='template' type='text/x-handlebars-template'>\n \t</script>\n"
179
+
180
+ options.each do |option|
181
+ library_name = option.gsub("-","")
182
+ if library_name == "handlebars"
183
+ tag << handlebars_template
184
+ end
185
+ end
186
+
187
+ return tag
188
+ end
171
189
 
172
190
  end
173
191
 
@@ -192,7 +210,10 @@ class Tonka::JS
192
210
  [
193
211
  {"jquery" => "http://code.jquery.com/jquery-1.10.2.min.js"},
194
212
  {"underscore" => "https://raw.github.com/jashkenas/underscore/master/underscore.js"},
195
- {"backbone" => "https://raw.github.com/jashkenas/backbone/master/backbone.js"}
213
+ {"backbone" => "https://raw.github.com/jashkenas/backbone/master/backbone.js"},
214
+ {"handlebars" => "http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v1.3.0.js"},
215
+ {"d3" => "https://raw.github.com/mbostock/d3/master/d3.min.js"},
216
+ {"raphael" => "https://raw.github.com/DmitryBaranovskiy/raphael/master/raphael-min.js"}
196
217
  ]
197
218
  end
198
219
 
@@ -214,7 +235,7 @@ class Tonka::JS
214
235
  end
215
236
  js_file.puts js_file_content
216
237
  js_file.close
217
- script_tag = "\t<script src='/javascripts/#{file_name}.js'></script>\n"
238
+ script_tag = "\t<script src='javascripts/#{file_name}.js'></script>\n"
218
239
  puts "\t\tbuilt ".green+"#{$SITE_NAME}/javascripts/#{file_name}.js"
219
240
  return script_tag
220
241
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tonka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Omar Delarosa
@@ -9,9 +9,9 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-16 00:00:00.000000000 Z
12
+ date: 2014-02-21 00:00:00.000000000 Z
13
13
  dependencies: []
14
- description: A static site builder, destroy and server.
14
+ description: A static site builder, destroyer and server.
15
15
  email: thedelarosa@gmail.com
16
16
  executables:
17
17
  - tonka