scms 3.1.0 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- M2MxZTlmM2Y0OTMzZDI4MzVhNDE2N2M4YzE1MDJlZmQ0MzdjZDVlZg==
4
+ ODViYzEwYjJkYmM3OGFlMDY0ZGI3Y2U3ZTQ1YjVjMDBhOWRmMDYwMg==
5
5
  data.tar.gz: !binary |-
6
- ZjJkNWQyNzlmMTY1MzVjOGQ2YzQ2NmIwZmZkYTIzYWNlNTMxYTI1OQ==
6
+ ODQ2Y2JhMDVjMmNkOGY0MGU3M2Q1OTU1MWM2N2VlZTBjNDEyNDNhYQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjJlZDU1MjFhYzFhNTkxYmE1N2UzZDJlOTU1OGFkYTUzNTljZWVkOTRjNWIz
10
- ZDU4YWQ3MjY0OTM0ZTliY2NmYTdhYTEzMTdmMGNlZGY2MDU0NjgxNTFhNmY3
11
- ZmI3M2Q2ZWYwYzZhZWZmYmVjMTAxNTAxOWNhMWQ1NDk2NTczYjA=
9
+ MjBlYTdiYTIzY2Y4NjQyMDIyMDU0MzNjZTQ5Mjg5NGVmMzEzZGUzNWM1ODlj
10
+ NGM3NTQ3YjM3NGYwNDc0OGRhNmI4YzhjNmY1M2ZhY2U3Nzk1ODRjZGIxZTA4
11
+ YjkxMDhhNzdkNmJmNmIxMWM3MmFjYWE2YjZjNDcwY2RmZmNlOGI=
12
12
  data.tar.gz: !binary |-
13
- ZWE2ODc1NWNmOGRjNmQxODg1ZTRhOGNjNzQ1N2JlZjhjMjQ2ODZiNTVlNDQy
14
- M2M2ZDcyMmNlYmY3MTgxYjY1ZGU0MThkZjg2YmYxNmFkZGM2NjkyNDIwMmZl
15
- MDZiNzJiZDI2OTJmYzVmNGI3NTI0MTY5OTZjMjljZDI0YTI4MWE=
13
+ YzRiMmZmZGZkOGU0Y2Y4YThhZWRmMzhiODdlZjgwNGZkYzVjOGNhMWY5OWE5
14
+ MTYxMjAxNGNmY2FjOTZmZDVlZDg5MjFjZDM3MGJhYmM1MzcyZTc5NTk4ZmYz
15
+ NzRmMmQxOTUxYmZiNmFkZWVjZTgzNDg3NTk5MDY4ZWQ5YmY5ZTA=
data/lib/scms.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "scms/version"
2
2
 
3
3
  module Scms
4
+ require 'scms/scms-helpers.rb'
4
5
  require 'scms/scms-utils.rb'
5
6
  require 'scms/scms-xmlhandler.rb'
6
7
  require 'scms/s3deploy.rb'
@@ -23,12 +24,12 @@ module Scms
23
24
  Scms.sassall(File.join(@website))
24
25
 
25
26
  yamlpath=File.join(config, "_config.yml")
26
- @settings = ScmsUtils.getsettings(yamlpath)
27
- if @settings
27
+ settings = ScmsUtils.getsettings(yamlpath)
28
+ if settings
28
29
  #Bootstrap here
29
- if @settings["bootstrap"] != nil
30
- bootstrap = File.join(@website, @settings["bootstrap"])
31
- #ScmsUtils.log("Bootstrap is: #{@settings["bootstrap"]}")
30
+ if settings["bootstrap"] != nil
31
+ bootstrap = File.join(@website, settings["bootstrap"])
32
+ #ScmsUtils.log("Bootstrap is: #{settings["bootstrap"]}")
32
33
  if File.exists?(bootstrap)
33
34
  begin
34
35
  require_relative bootstrap
@@ -37,14 +38,13 @@ module Scms
37
38
  ScmsUtils.log(e.backtrace.inspect)
38
39
  end
39
40
  else
40
- ScmsUtils.errLog("Bootstrap does not exist #{@settings["bootstrap"]}")
41
- ScmsUtils.writelog("::Bootstrap does not exist #{@settings["bootstrap"]}", @website)
41
+ ScmsUtils.errLog("Bootstrap does not exist #{settings["bootstrap"]}")
42
+ ScmsUtils.writelog("::Bootstrap does not exist #{settings["bootstrap"]}", @website)
42
43
  ScmsUtils.writelog("type NUL > #{bootstrap}", @website)
43
44
  end
44
45
  end
45
46
 
46
- bundles = Scms.bundle(@settings["bundles"])
47
- Scms.parsepages(bundles)
47
+ Scms.parsepages(settings)
48
48
  else
49
49
  ScmsUtils.errLog("Config is empty")
50
50
  end
@@ -53,14 +53,15 @@ module Scms
53
53
  ScmsUtils.log(ScmsUtils.uriEncode("file:///#{@website}"))
54
54
  end
55
55
 
56
- def Scms.parsepages(bundles)
56
+ def Scms.parsepages(settings)
57
+ bundles = Scms.bundle(settings["bundles"])
57
58
  # build views from templates
58
- @template = @settings["template"]
59
+ @template = settings["template"]
59
60
 
60
- if @settings["pages"] != nil
61
+ if settings["pages"] != nil
61
62
  # Build navigation
62
63
  navigation = Array.new
63
- @settings["pages"].each do |pagedata|
64
+ settings["pages"].each do |pagedata|
64
65
  if pagedata != nil
65
66
  pagedata.each do |pageoptions|
66
67
  pagename = pageoptions[0]
@@ -76,7 +77,7 @@ module Scms
76
77
  end
77
78
 
78
79
  ScmsUtils.log("Compiling Pages:")
79
- @settings["pages"].each do |pagedata|
80
+ settings["pages"].each do |pagedata|
80
81
  if pagedata != nil
81
82
  pagedata.each do |pageoptions|
82
83
  pagename = pageoptions[0]
@@ -264,7 +265,7 @@ module Scms
264
265
 
265
266
  html = html.gsub('~/', ScmsUtils.uriEncode("file:///#{@website}/")) if @mode == "cms"
266
267
  websiteroot = '/'
267
- websiteroot = @settings["url"] unless @settings["rooturl"] == nil
268
+ websiteroot = settings["url"] unless settings["rooturl"] == nil
268
269
 
269
270
  html = html.gsub('~/', websiteroot)
270
271
  begin
@@ -285,9 +286,15 @@ module Scms
285
286
  end
286
287
  end
287
288
 
288
- def Scms.parsetemplate(template, hash)
289
- page = OpenStruct.new(hash)
289
+ def Scms.parsetemplate(template, hash = Hash.new)
290
290
  result = ""
291
+ OpenStruct.new(hash)
292
+
293
+ if hash.class == OpenStruct
294
+ page = hash
295
+ else
296
+ page = OpenStruct.new(hash)
297
+ end
291
298
 
292
299
  begin
293
300
  result = ERB.new(template).result(page.instance_eval { binding })
@@ -0,0 +1,27 @@
1
+ module ScmsHelpers
2
+ require 'find'
3
+
4
+ def ScmsHelpers.isActive(pagename, activepage)
5
+ return active = "active" if activepage.include? pagename
6
+ end
7
+
8
+ def ScmsHelpers.txt_2_html(rawsnippet)
9
+ if rawsnippet != nil
10
+ rawsnippet.gsub!(/(http:\/\/\S+)/, '<a href="\1" target="_blank" ref="external">\1</a>')
11
+ rawsnippet.gsub!(/(file:\/\/\/\S+)/, '<a href="\1" target="_blank" ref="external">\1</a>')
12
+ rawsnippet.gsub!(/\n/, "<br />")
13
+ end
14
+
15
+ return rawsnippet
16
+ end
17
+
18
+ def ScmsHelpers.uriEncode(uri)
19
+ return uri.gsub(" ", "%20")
20
+ end
21
+
22
+ def ScmsHelpers.uriDecode(uri)
23
+ return uri.gsub("%20", " ")
24
+ end
25
+
26
+ end
27
+
data/lib/scms/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Scms
2
- VERSION = "3.1.0"
2
+ VERSION = "3.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scms
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Courtenay Probert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-15 00:00:00.000000000 Z
11
+ date: 2013-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cprobert-s3sync
@@ -189,6 +189,7 @@ files:
189
189
  - build commands.txt
190
190
  - lib/scms.rb
191
191
  - lib/scms/s3deploy.rb
192
+ - lib/scms/scms-helpers.rb
192
193
  - lib/scms/scms-httpserver.rb
193
194
  - lib/scms/scms-utils.rb
194
195
  - lib/scms/scms-xmlhandler.rb