scms 1.9.5 → 1.9.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8afbf980cb75d561c9a31da6363773ed87695218
4
- data.tar.gz: 14b0ec6f0fe85009bcc5758ac7ddd6d761bb5f81
3
+ metadata.gz: ef0303045a52ddd8fcd7999b9904b1d9149fa47d
4
+ data.tar.gz: aad39bc24d3458379629a8e9e8706eff9c23ff90
5
5
  SHA512:
6
- metadata.gz: eeb4cac2eea8f198918e020d4c5ffeebce645b18299306290603577382d7a598fc0798f33a15b3a8b827bccd07f4995bbc601373749726d667568cc3ebc8d41f
7
- data.tar.gz: d366328cd072ca5f08a6434c987b2f17685073d46e3960a138ade8028a145e2abc7502bfa2c78d4201f7dce2338c96daa73e7d77889dda45e97439b6ccaedb3f
6
+ metadata.gz: 48b720247e9f72f87b223c6c8630f70b0e25957e74148d99f65c547fa2df939257c989eaa21cb749be651e377bf4a9859899868760d2a6ef4eb456e20df4159b
7
+ data.tar.gz: b880bda1b8863d08bcd5f4d1b0e9e941151db2549b8a6275a7d1471ba9c02a1b80660a432de9421c4442c9ec39cedb4641f1120a66a9f2f3b12e767c451a32ce
@@ -37,23 +37,19 @@
37
37
  <div class="nav-collapse collapse">
38
38
  <ul class="nav">
39
39
 
40
- <%
41
- @page = data.page
42
- @page = "/" if @page == "index.html"
43
- def isActive(href)
44
- if @page == href
45
- return "active"
46
- end
47
- end
48
-
49
- require 'nokogiri'
50
- xml_doc = Nokogiri::XML(File.read(File.join(data.sitedir, "_templates", "menu.xml")))
51
- xml_doc.xpath('/menu/page').each do |link|
52
- %>
53
- <li><a href='<%= link.attr("href") %>' class='<%=isActive(link.attr("href"))%> <%= link.attr("class") %>'>
54
- <%= link.content %>
55
- </a></li>
56
- <% end %>
40
+ <%
41
+ @currentpagename = data.pagename
42
+ def isActive(pagename)
43
+ return active = "active" if @currentpagename == pagename
44
+ end
45
+ data.navigation.each do |nav|
46
+ %>
47
+ <li class='<%=isActive(nav[:name])%>'>
48
+ <a href='<%= nav[:url] %>'>
49
+ <%= nav[:name] %>
50
+ </a>
51
+ </li>
52
+ <% end %>
57
53
 
58
54
  <li class="dropdown">
59
55
  <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
@@ -105,24 +105,35 @@ module Scms
105
105
  def Scms.parsepages(scripts, stylesheets, bundles)
106
106
  # build views from templates
107
107
  @template = $settings["template"]
108
+
108
109
  if $settings["pages"] != nil
110
+ # Build navigation
111
+ navigation = Array.new
112
+ $settings["pages"].each do |page|
113
+ if page != nil
114
+ page.each do |pageoptions|
115
+ pagename = pageoptions[0]
116
+ pageconfig = pageoptions[1]
117
+ pageurl = pageconfig["generate"]
118
+ navigation.push({:name => pagename, :url => pageurl}) unless pageconfig["navigation"] == false
119
+ end
120
+ end
121
+ end
122
+
109
123
  ScmsUtils.log("Compiling Pages:")
110
124
  $settings["pages"].each do |page|
111
125
  if page != nil
112
- page.each do |option|
113
- #ScmsUtils.log( "option (#{option.class}) = #{option[0]}" )
114
- pageconfig = option[1]
115
- #ScmsUtils.log( "Pageconfig = #{pageconfig}" )
116
-
126
+ page.each do |pageoptions|
127
+ pagename = pageoptions[0]
128
+ pageconfig = pageoptions[1]
129
+ pageurl = pageconfig["generate"]
130
+ ScmsUtils.successLog("#{pageurl}")
117
131
  if pageconfig["template"] == nil
118
132
  skin = @template
119
133
  else
120
134
  skin = pageconfig["template"]
121
135
  end
122
136
 
123
- page = pageconfig["generate"]
124
- ScmsUtils.successLog("#{page}")
125
-
126
137
  resource = Hash.new
127
138
  if pageconfig["resource"] != nil
128
139
  resourcepath = File.join($website, pageconfig["resource"])
@@ -194,14 +205,16 @@ module Scms
194
205
  end
195
206
  #ScmsUtils.log( "view = #{view[0]} - #{view[1]}" )
196
207
  end
197
-
208
+
198
209
  monkeyhook = "";
199
210
  if @mode == "cms"
200
211
  monkeyhook = "<script src='scripts/air-monkey-hook.js'></script>"
201
212
  end
202
213
 
203
214
  hash = {
204
- :page => page,
215
+ :page => pageurl,
216
+ :pagename => pagename,
217
+ :pageurl => pageurl,
205
218
  :views => views,
206
219
  :resource => resource,
207
220
  :config => pageconfig,
@@ -209,7 +222,8 @@ module Scms
209
222
  :stylesheets => stylesheets,
210
223
  :bundles => bundles,
211
224
  :sitedir => $website,
212
- :monkeyhook => monkeyhook
225
+ :monkeyhook => monkeyhook,
226
+ :navigation => navigation
213
227
  }
214
228
 
215
229
  erb = File.join($website, skin)
@@ -282,8 +296,8 @@ module Scms
282
296
  begin
283
297
  result = ERB.new(template).result(data.instance_eval { binding })
284
298
  rescue Exception => e
285
- ScmsUtils.errLog("**Critical Error: Could not parse template**")
286
- ScmsUtils.log( "_(if your using resources make sure their not empty)_" )
299
+ ScmsUtils.errLog("Critical Error: Could not parse template")
300
+ ScmsUtils.log( "(if your using resources make sure their not empty)" )
287
301
  ScmsUtils.errLog( e.message )
288
302
  end
289
303
 
@@ -302,7 +316,8 @@ module Scms
302
316
  #config = YAML.load_file(yamlpath)
303
317
  rescue Exception => e
304
318
  ScmsUtils.errLog("Error Loading _config.yml (check there are no tabs in the file)")
305
- ScmsUtils.log( "_[Verify your config](http://yaml-online-parser.appspot.com/)_")
319
+ ScmsUtils.log( "Verify your config")
320
+ ScmsUtils.log( "http://yaml-online-parser.appspot.com/")
306
321
  ScmsUtils.errLog( e.message )
307
322
  ScmsUtils.errLog( e.backtrace.inspect )
308
323
  end
@@ -378,34 +393,4 @@ module Scms
378
393
  File.rename("config.yml", "_config.yml") if File.exists? File.join($website, "config.yml")
379
394
  File.rename("s3config.yml", "_s3config.yml") if File.exists? File.join($website, "s3config.yml")
380
395
  end
381
-
382
- def Scms.crunch(crunchDir)
383
- ScmsUtils.log( "Starting crunching CSS and JavaScript in:\n#{crunchDir}\n\n" )
384
- Dir.chdir(crunchDir) do
385
- Dir.glob("**/*.{css, js}").each do |asset|
386
- #fullFileName = File.basename(asset)
387
- #ScmsUtils.log( "Crunching #{fullFileName}" )
388
- ext = File.extname(asset)
389
- Scms.yuicompress(asset, ext)
390
- end
391
- end
392
- end
393
-
394
- def Scms.yuicompress(asset, ext)
395
- if File.exists?(asset)
396
- #ScmsUtils.log( " Encoding: #{asset.encoding}" )
397
- enc = "--charset utf-8"
398
- enc = ""
399
- cmd = "java"
400
- params = "-jar \"#{File.join(Folders[:tools], "yuicompressor", "yuicompressor-2.4.7.jar")}\" #{enc} --type #{ext.gsub(".","")} \"#{asset}\" -o \"#{asset}\""
401
- ##Need to check if asset exists
402
- if system("#{cmd} #{params}")
403
- ScmsUtils.log( "_Crunched #{File.basename(asset)}_" )
404
- else
405
- ScmsUtils.errLog( "Error crunching: #{asset}" )
406
- end
407
- else
408
- ScmsUtils.errLog( "#{asset} does not exist" )
409
- end
410
- end
411
396
  end
@@ -1,3 +1,3 @@
1
1
  module Scms
2
- VERSION = "1.9.5"
2
+ VERSION = "1.9.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scms
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.5
4
+ version: 1.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Courtenay Probert
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  version: '0'
169
169
  requirements: []
170
170
  rubyforge_project:
171
- rubygems_version: 2.0.3
171
+ rubygems_version: 2.0.4
172
172
  signing_key:
173
173
  specification_version: 4
174
174
  summary: Create simple static websites, in a jiffy