scms 1.8.8 → 1.9.0
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/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/Rakefile +1 -0
- data/assets/blank-template/{config.yml → _config.yml} +6 -6
- data/assets/blank-template/{s3config.template.yml → _s3config.template.yml} +0 -0
- data/assets/blank-template/{templates → _templates}/menu.xml +0 -0
- data/assets/blank-template/{templates → _templates}/skin.erb.html +1 -1
- data/assets/blank-template/{views → _views}/about-intro.html +0 -0
- data/assets/blank-template/{views → _views}/about-main.html +0 -0
- data/assets/blank-template/{views → _views}/home-intro.html +0 -0
- data/assets/blank-template/{views → _views}/home-main.html +0 -0
- data/assets/{blank-app-template/public → blank-template}/images/glyphicons-halflings-white.png +0 -0
- data/assets/{blank-app-template/public → blank-template}/images/glyphicons-halflings.png +0 -0
- data/assets/{blank-app-template/public → blank-template}/robots.txt +0 -0
- data/assets/blank-template/{public/scripts → scripts}/air-monkey-hook.js +0 -0
- data/assets/{blank-app-template/public/scripts/libs → blank-template/scripts}/bootstrap.js +0 -0
- data/assets/{blank-app-template/public/scripts/libs → blank-template/scripts}/jquery-1.8.2.min.js +0 -0
- data/assets/blank-template/{public/scripts → scripts}/script.js +0 -0
- data/assets/{blank-app-template/public → blank-template}/stylesheets/bootstrap-responsive.css +0 -0
- data/assets/{blank-app-template/public → blank-template}/stylesheets/bootstrap.css +0 -0
- data/assets/{blank-app-template/public → blank-template}/stylesheets/style.css +0 -0
- data/bin/scms +9 -43
- data/build commands.txt +3 -2
- data/lib/scms.rb +87 -66
- data/lib/scms/s3deploy.rb +23 -41
- data/lib/scms/{scms_utils.rb → scms-utils.rb} +5 -20
- data/lib/scms/version.rb +2 -2
- data/scms.gemspec +28 -21
- metadata +58 -63
- data/assets/blank-app-template/application.xml +0 -57
- data/assets/blank-app-template/cert.p12 +0 -0
- data/assets/blank-app-template/config.yml +0 -32
- data/assets/blank-app-template/debug.cmd +0 -6
- data/assets/blank-app-template/package.cmd +0 -16
- data/assets/blank-app-template/public/ico/favicon.ico +0 -0
- data/assets/blank-app-template/public/ico/logo-128.png +0 -0
- data/assets/blank-app-template/public/ico/logo-16.png +0 -0
- data/assets/blank-app-template/public/ico/logo-32.png +0 -0
- data/assets/blank-app-template/public/ico/logo-48.png +0 -0
- data/assets/blank-app-template/public/scripts/air/AIRAliases.js +0 -240
- data/assets/blank-app-template/public/scripts/air/AIRIntrospector.js +0 -1949
- data/assets/blank-app-template/public/scripts/air/AIRMenuBuilder.js +0 -1322
- data/assets/blank-app-template/public/scripts/air/applicationupdater.swf +0 -0
- data/assets/blank-app-template/public/scripts/air/applicationupdater_ui.swf +0 -0
- data/assets/blank-app-template/public/scripts/air/servicemonitor.swf +0 -0
- data/assets/blank-app-template/public/scripts/libs/jquery.fn.custom.js +0 -67
- data/assets/blank-app-template/public/scripts/libs/knockout-2.1.0-min.js +0 -86
- data/assets/blank-app-template/public/scripts/presenters/dashboard-presenter.js +0 -3
- data/assets/blank-app-template/public/scripts/presenters/global-presenter.js +0 -8
- data/assets/blank-app-template/public/scripts/shared/data-persistance.js +0 -22
- data/assets/blank-app-template/public/scripts/shared/utils.js +0 -107
- data/assets/blank-app-template/s3config.template.yml +0 -9
- data/assets/blank-app-template/templates/menu.xml +0 -5
- data/assets/blank-app-template/templates/skin.erb.html +0 -84
- data/assets/blank-app-template/tools/msxsl.exe +0 -0
- data/assets/blank-app-template/tools/update-descriptor.xsl +0 -18
- data/assets/blank-app-template/tools/version.xsl +0 -10
- data/assets/blank-app-template/views/about.html +0 -15
- data/assets/blank-app-template/views/dashboard.html +0 -7
- data/assets/blank-template/public/images/glyphicons-halflings-white.png +0 -0
- data/assets/blank-template/public/images/glyphicons-halflings.png +0 -0
- data/assets/blank-template/public/robots.txt +0 -4
- data/assets/blank-template/public/scripts/bootstrap.js +0 -2027
- data/assets/blank-template/public/scripts/jquery-1.8.2.min.js +0 -2
- data/assets/blank-template/public/stylesheets/bootstrap-responsive.css +0 -1058
- data/assets/blank-template/public/stylesheets/bootstrap.css +0 -5774
- data/assets/blank-template/public/stylesheets/style.css +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 949a83b503e813115cd68ca5706861040b203b2d
|
4
|
+
data.tar.gz: 1788aa5ae7872d4982339907414c44ebc6f02a44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae97e05a269a910e5a74894a3b92a62ad4119134b8f72eb07dfefa98cc7b74559d904aa326b07f8a467db2fa618a15dfabb4dc88a44ca4607230d6773ae5794e
|
7
|
+
data.tar.gz: 3ff7747ef6ce525e1f33d4d09012eaae42db529b20550f1246b9d7cff0299db16be68045108d07baec92727e46ade1f4ace6a89dd8bd906536e05b482d13352a
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Courtenay Probert
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -1,16 +1,16 @@
|
|
1
|
-
template:
|
1
|
+
template: _templates/skin.erb.html
|
2
2
|
|
3
3
|
pages:
|
4
4
|
- index:
|
5
5
|
generate: index.html
|
6
6
|
views :
|
7
|
-
intro:
|
8
|
-
main:
|
7
|
+
intro: _views/home-intro.html
|
8
|
+
main: _views/home-main.html
|
9
9
|
- about:
|
10
10
|
generate: about.html
|
11
11
|
views :
|
12
|
-
intro:
|
13
|
-
main:
|
12
|
+
intro: _views/about-intro.html
|
13
|
+
main: _views/about-main.html
|
14
14
|
|
15
15
|
scripts:
|
16
16
|
- script:
|
@@ -27,4 +27,4 @@ stylesheets:
|
|
27
27
|
- stylesheets/style.css
|
28
28
|
|
29
29
|
#options:
|
30
|
-
# build_dir: <%= ENV['TEMP'] %>\my-
|
30
|
+
# build_dir: <%= ENV['TEMP'] %>\my-Scms-website
|
File without changes
|
File without changes
|
@@ -47,7 +47,7 @@
|
|
47
47
|
end
|
48
48
|
|
49
49
|
require 'nokogiri'
|
50
|
-
xml_doc = Nokogiri::XML(File.read(File.join(data.sitedir, "
|
50
|
+
xml_doc = Nokogiri::XML(File.read(File.join(data.sitedir, "_templates", "menu.xml")))
|
51
51
|
xml_doc.xpath('/menu/page').each do |link|
|
52
52
|
%>
|
53
53
|
<li><a href='<%= link.attr("href") %>' class='<%=isActive(link.attr("href"))%> <%= link.attr("class") %>'>
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/assets/{blank-app-template/public → blank-template}/images/glyphicons-halflings-white.png
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/assets/{blank-app-template/public/scripts/libs → blank-template/scripts}/jquery-1.8.2.min.js
RENAMED
File without changes
|
File without changes
|
data/assets/{blank-app-template/public → blank-template}/stylesheets/bootstrap-responsive.css
RENAMED
File without changes
|
File without changes
|
File without changes
|
data/bin/scms
CHANGED
@@ -9,13 +9,13 @@
|
|
9
9
|
|
10
10
|
require 'optparse'
|
11
11
|
require 'fileutils'
|
12
|
-
require '
|
12
|
+
require 'Scms'
|
13
13
|
|
14
14
|
options = {}
|
15
15
|
optparse = OptionParser.new do|opts|
|
16
16
|
# Set a banner, displayed at the top
|
17
17
|
# of the help screen.
|
18
|
-
opts.banner = "Usage:
|
18
|
+
opts.banner = "Usage: Scms [options]"
|
19
19
|
|
20
20
|
# Define the options, and what they do
|
21
21
|
opts.on('-w', '--website WEBSITE', "Website directory (full path)") do |w|
|
@@ -54,26 +54,15 @@ optparse = OptionParser.new do|opts|
|
|
54
54
|
end
|
55
55
|
optparse.parse!
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
$website = options[:website]
|
60
|
-
end
|
61
|
-
puts "Compiling #{$website}"
|
62
|
-
|
63
|
-
##Set globals
|
57
|
+
#Set globals
|
58
|
+
$website = (options[:website].nil?) ? Dir.pwd : options[:website]
|
64
59
|
$html = (ENV["SCMS_HTML_OUT"] or "false")
|
65
|
-
|
66
60
|
$stdout.sync = true
|
67
61
|
root_folder = File.expand_path("../", File.dirname(__FILE__))
|
68
|
-
@pub = File.join("#{$website}/-site")
|
69
|
-
unless options[:pub].nil?
|
70
|
-
@pub = options[:pub]
|
71
|
-
end
|
72
|
-
|
73
62
|
Folders = {
|
74
63
|
:root => root_folder,
|
75
64
|
:website => File.join($website),
|
76
|
-
:pub => (ENV["SCMS_PUBLISH_FOLDER"] or
|
65
|
+
:pub => (ENV["SCMS_PUBLISH_FOLDER"] or options[:pub]),
|
77
66
|
:assets => (ENV["SCMS_STATICCMS_FOLDER"] or File.join(root_folder, "assets")),
|
78
67
|
:config => (ENV["SCMS_CONFIG_FOLDER"] or File.join($website))
|
79
68
|
}
|
@@ -92,37 +81,14 @@ if options[:action] == "create"
|
|
92
81
|
exit
|
93
82
|
end
|
94
83
|
|
95
|
-
if options[:action] == "createapp"
|
96
|
-
if Dir.exists? Folders[:website]
|
97
|
-
throw "App already exists!!!"
|
98
|
-
else
|
99
|
-
puts "Making Air app: #{Folders[:website]}"
|
100
|
-
FileUtils.mkdir_p Folders[:website]
|
101
|
-
Dir.chdir(File.join(Folders[:assets], "blank-app-template")) do
|
102
|
-
files = Dir.glob('*')
|
103
|
-
FileUtils.cp_r files, Folders[:website]
|
104
|
-
end
|
105
|
-
end
|
106
|
-
exit
|
107
|
-
end
|
108
|
-
|
109
|
-
raise "No website in folder #{Folders[:website]}" if !File::directory?(Folders[:website])
|
110
|
-
|
111
84
|
#puts "System root folder = #{Folders[:root]}"
|
112
85
|
#puts "Website folder = #{Folders[:website]}"
|
113
86
|
#puts "Pub dir = #{Folders[:pub]}"
|
114
87
|
#puts "Config dir = #{Folders[:config]}"
|
115
88
|
#puts "Mode = #{options[:mode]}"
|
116
89
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
StaticCMS.crunch(deployDir)
|
121
|
-
end
|
90
|
+
raise "No website in folder #{Folders[:website]}" if !File::directory?(Folders[:website])
|
91
|
+
Scms.Upgrade()
|
92
|
+
deployDir = Scms.build(Folders[:pub], Folders[:config], options[:mode])
|
122
93
|
#puts "deployDir = #{deployDir}"
|
123
|
-
if options[:action] == "deploy"
|
124
|
-
StaticCMS.crunch(deployDir)
|
125
|
-
StaticCMS.deploy(deployDir, Folders[:config])
|
126
|
-
backupdir = File.join(Folders[:website], "private")
|
127
|
-
S3Deploy.backup(backupdir, Folders[:config]) if File.directory? backupdir
|
128
|
-
end
|
94
|
+
Scms.deploy(deployDir, Folders[:config]) if options[:action] == "deploy"
|
data/build commands.txt
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
|
2
|
-
gem
|
1
|
+
rake install
|
2
|
+
gem build Scms.gemspec
|
3
|
+
gem push Scms-1.7.9.gem
|
data/lib/scms.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
require "scms/version"
|
2
|
+
|
3
|
+
module Scms
|
4
|
+
require 'scms/scms-utils.rb'
|
4
5
|
require 'scms/s3deploy.rb'
|
5
6
|
|
6
7
|
require 'erb'
|
@@ -8,40 +9,51 @@ module StaticCMS
|
|
8
9
|
require 'yaml'
|
9
10
|
require 'sass'
|
10
11
|
require 'packr'
|
12
|
+
require 'maruku'
|
11
13
|
|
12
14
|
include YAML
|
13
15
|
|
14
|
-
def
|
15
|
-
@pub =
|
16
|
-
@cleanpub =
|
16
|
+
def Scms.build(pub, config, mode)
|
17
|
+
@pub = $website
|
18
|
+
@cleanpub = false
|
19
|
+
if pub != nil
|
20
|
+
@pub = pub
|
21
|
+
@cleanpub = true
|
22
|
+
end
|
23
|
+
|
17
24
|
@configdir = config
|
18
25
|
@mode = mode
|
19
|
-
|
20
|
-
@source = File.join($website, @webroot)
|
26
|
+
#ScmsUtils.log("Mode: #{mode}")
|
21
27
|
|
22
|
-
|
23
|
-
|
24
|
-
|
28
|
+
@source = File.join($website)
|
29
|
+
# Support for legacy publick folders
|
30
|
+
if (Dir.exists? File.join($website, "public"))
|
31
|
+
@source = File.join($website, "public")
|
32
|
+
@pub = File.join($website, "_site") if pub == nil
|
33
|
+
end
|
25
34
|
|
26
|
-
|
27
|
-
|
28
|
-
|
35
|
+
ScmsUtils.log("Source #{@source}")
|
36
|
+
Scms.sassall(@source)
|
37
|
+
|
38
|
+
yamlpath=File.join(@configdir, "_config.yml")
|
39
|
+
ScmsUtils.log("Loading Config: #{ScmsUtils.uriEncode("file:///#{yamlpath}")}")
|
40
|
+
$settings = Scms.getsettings(yamlpath)
|
29
41
|
if $settings
|
30
42
|
if $settings["options"] != nil
|
43
|
+
# Don't overwrite environment settings
|
31
44
|
if ENV["SCMS_PUBLISH_FOLDER"] == nil && $settings["options"]["build_dir"] != nil
|
32
|
-
ScmsUtils.log("
|
45
|
+
ScmsUtils.log("_Getting pub dir from _config.yml_")
|
33
46
|
@pub = $settings["options"]["build_dir"]
|
34
47
|
end
|
35
|
-
if $settings["options"]["clean_build_dir"] ==
|
36
|
-
|
48
|
+
if $settings["options"]["clean_build_dir"] == true
|
49
|
+
ScmsUtils.log("Cleaning build dir")
|
50
|
+
@cleanpub = true
|
37
51
|
end
|
38
52
|
end
|
39
53
|
|
40
54
|
if @cleanpub
|
41
|
-
|
55
|
+
Scms.cleanpubdir(@pub)
|
42
56
|
@cleanpub = false
|
43
|
-
else
|
44
|
-
ScmsUtils.log("Skipping cleaning \n#{@pub}")
|
45
57
|
end
|
46
58
|
|
47
59
|
#Bootstrap here
|
@@ -60,21 +72,18 @@ module StaticCMS
|
|
60
72
|
end
|
61
73
|
|
62
74
|
#Bundle resources
|
63
|
-
scripts =
|
64
|
-
stylesheets =
|
75
|
+
scripts = Scms.bundlescripts($settings["scripts"])
|
76
|
+
stylesheets = Scms.bundlestylesheets($settings["stylesheets"])
|
65
77
|
#Generate pages
|
66
|
-
|
78
|
+
Scms.parsepages(scripts, stylesheets)
|
67
79
|
else
|
68
80
|
ScmsUtils.errLog("Config is empty")
|
69
81
|
end
|
70
82
|
|
71
|
-
if
|
72
|
-
ScmsUtils.log("
|
73
|
-
|
74
|
-
if @cleanpub
|
75
|
-
StaticCMS.cleanpubdir(@pub)
|
76
|
-
end
|
83
|
+
if @pub != $website
|
84
|
+
ScmsUtils.log("Merging 'public' folder")
|
77
85
|
|
86
|
+
Scms.cleanpubdir(@pub) if @cleanpub
|
78
87
|
FileUtils.mkdir @pub unless Dir.exists? @pub
|
79
88
|
Dir.chdir(@source) do
|
80
89
|
#files = Dir.glob('*')
|
@@ -86,21 +95,17 @@ module StaticCMS
|
|
86
95
|
File.file?(oldfile) ? FileUtils.copy(oldfile, newfile) : FileUtils.mkdir(newfile) unless File.exist? newfile
|
87
96
|
end
|
88
97
|
end
|
89
|
-
else
|
90
|
-
ScmsUtils.log("**No 'public' folder in #{@source} - skiping merge**")
|
91
98
|
end
|
92
99
|
|
93
|
-
ScmsUtils.
|
94
|
-
ScmsUtils.log("[_#{@pub}_](#{ScmsUtils.uriEncode("file:///#{@pub}")})")
|
95
|
-
|
100
|
+
ScmsUtils.log(ScmsUtils.uriEncode("file:///#{@pub}"))
|
96
101
|
return @pub
|
97
102
|
end
|
98
103
|
|
99
|
-
def
|
104
|
+
def Scms.parsepages(scripts, stylesheets)
|
100
105
|
# build views from templates
|
101
106
|
@template = $settings["template"]
|
102
107
|
if $settings["pages"] != nil
|
103
|
-
ScmsUtils.log("
|
108
|
+
ScmsUtils.log("Compiling Pages:")
|
104
109
|
$settings["pages"].each do |page|
|
105
110
|
if page != nil
|
106
111
|
page.each do |option|
|
@@ -128,7 +133,7 @@ module StaticCMS
|
|
128
133
|
end
|
129
134
|
end
|
130
135
|
|
131
|
-
hasHandler =
|
136
|
+
hasHandler = "no"
|
132
137
|
if pageconfig["handler"] != nil
|
133
138
|
handlerpath = File.join($website, pageconfig["handler"])
|
134
139
|
if File.exists?(handlerpath)
|
@@ -158,13 +163,26 @@ module StaticCMS
|
|
158
163
|
ScmsUtils.log("_Rendering with handler_")
|
159
164
|
viewSnippet = Handler.render(viewpath)
|
160
165
|
else
|
161
|
-
|
166
|
+
snnipetCode = File.read(viewpath)
|
167
|
+
case File.extname(view[1])
|
168
|
+
when ".md"
|
169
|
+
begin
|
170
|
+
doc = Maruku.new(snnipetCode)
|
171
|
+
viewSnippet = doc.to_html
|
172
|
+
rescue Exception => e
|
173
|
+
viewSnippet = snnipetCode
|
174
|
+
puts e.message
|
175
|
+
puts e.backtrace.inspect
|
176
|
+
end
|
177
|
+
else
|
178
|
+
viewSnippet = snnipetCode
|
179
|
+
end
|
162
180
|
end
|
163
181
|
|
164
182
|
if @mode == "cms"
|
165
|
-
views[view[0]] = "<div class='cms' data-view='#{view[1]}' data-page='#{page}'>#{
|
183
|
+
views[view[0]] = "<div class='cms' data-view='#{view[1]}' data-page='#{page}'>#{Scms.parsetemplate(viewSnippet, model)}</div>"
|
166
184
|
else
|
167
|
-
views[view[0]] =
|
185
|
+
views[view[0]] = Scms.parsetemplate(viewSnippet, model)
|
168
186
|
end
|
169
187
|
else
|
170
188
|
ScmsUtils.writelog(@pub, "Empty file: #{viewpath}")
|
@@ -198,13 +216,11 @@ module StaticCMS
|
|
198
216
|
if File.exists?(erb)
|
199
217
|
pubsubdir = File.dirname(out)
|
200
218
|
Dir.mkdir(pubsubdir, 755) unless File::directory?(pubsubdir)
|
201
|
-
html =
|
219
|
+
html = Scms.parsetemplate(File.read(erb), hash)
|
202
220
|
File.open(out, 'w') {|f| f.write(html) }
|
203
221
|
else
|
204
222
|
ScmsUtils.errLog("Template doesn't exist: #{erb}")
|
205
223
|
end
|
206
|
-
|
207
|
-
|
208
224
|
end
|
209
225
|
end
|
210
226
|
#ScmsUtils.log( out )
|
@@ -212,10 +228,10 @@ module StaticCMS
|
|
212
228
|
end
|
213
229
|
end
|
214
230
|
|
215
|
-
def
|
231
|
+
def Scms.bundlescripts(scriptsConfig)
|
216
232
|
scripts = Hash.new
|
217
233
|
if scriptsConfig != nil
|
218
|
-
ScmsUtils.log("
|
234
|
+
ScmsUtils.log("Bundeling Scripts:")
|
219
235
|
scriptsConfig.each do |script|
|
220
236
|
#ScmsUtils.log( "script (#{script.class}) = #{script}" )
|
221
237
|
script.each do |option|
|
@@ -228,7 +244,7 @@ module StaticCMS
|
|
228
244
|
scriptname = "#{name}-v#{scriptversion}.js"
|
229
245
|
scriptsdir = File.join(@pub, "scripts")
|
230
246
|
|
231
|
-
puts scriptsdir
|
247
|
+
#puts scriptsdir
|
232
248
|
FileUtils.mkdir_p(scriptsdir) unless File::directory?(scriptsdir)
|
233
249
|
#Dir.mkdir_p(scriptsdir, 755 ) if !File::directory?(scriptsdir)
|
234
250
|
out = File.join(scriptsdir, scriptname)
|
@@ -251,16 +267,17 @@ module StaticCMS
|
|
251
267
|
|
252
268
|
scripts[name] = "scripts/#{scriptname}"
|
253
269
|
File.open(out, 'w') {|f| f.write(content) }
|
270
|
+
Scms.packr(out) unless /(-min)|(\.min)/.match(name)
|
254
271
|
end
|
255
272
|
end
|
256
273
|
end
|
257
274
|
return scripts
|
258
275
|
end
|
259
276
|
|
260
|
-
def
|
277
|
+
def Scms.bundlestylesheets(styleConfig)
|
261
278
|
stylesheets = Hash.new
|
262
279
|
if styleConfig != nil
|
263
|
-
ScmsUtils.log("
|
280
|
+
ScmsUtils.log("Bundeling Stylesheets:")
|
264
281
|
styleConfig.each do |stylesheet|
|
265
282
|
#ScmsUtils.log( "stylesheet (#{stylesheet.class}) = #{stylesheet}" )
|
266
283
|
stylesheet.each do |option|
|
@@ -299,7 +316,7 @@ module StaticCMS
|
|
299
316
|
return stylesheets
|
300
317
|
end
|
301
318
|
|
302
|
-
def
|
319
|
+
def Scms.parsetemplate(template, hash)
|
303
320
|
data = OpenStruct.new(hash)
|
304
321
|
result = ""
|
305
322
|
|
@@ -314,7 +331,7 @@ module StaticCMS
|
|
314
331
|
return result
|
315
332
|
end
|
316
333
|
|
317
|
-
def
|
334
|
+
def Scms.getsettings(yamlpath)
|
318
335
|
config = nil
|
319
336
|
|
320
337
|
if File.exist?(yamlpath)
|
@@ -325,7 +342,7 @@ module StaticCMS
|
|
325
342
|
config = YAML.load(myconfig)
|
326
343
|
#config = YAML.load_file(yamlpath)
|
327
344
|
rescue Exception => e
|
328
|
-
ScmsUtils.errLog("Error Loading
|
345
|
+
ScmsUtils.errLog("Error Loading _config.yml (check there are no tabs in the file)")
|
329
346
|
ScmsUtils.log( "_[Verify your config](http://yaml-online-parser.appspot.com/)_")
|
330
347
|
ScmsUtils.errLog( e.message )
|
331
348
|
ScmsUtils.errLog( e.backtrace.inspect )
|
@@ -337,7 +354,7 @@ module StaticCMS
|
|
337
354
|
return config
|
338
355
|
end
|
339
356
|
|
340
|
-
def
|
357
|
+
def Scms.cleanpubdir(pub)
|
341
358
|
ScmsUtils.log("_Cleaning pub folder #{pub}_")
|
342
359
|
FileUtils.rm_rf pub
|
343
360
|
#FileUtils.remove_dir(pub, force = true)
|
@@ -346,32 +363,32 @@ module StaticCMS
|
|
346
363
|
FileUtils.chmod 0755, pub
|
347
364
|
end
|
348
365
|
|
349
|
-
def
|
366
|
+
def Scms.crunch(crunchDir)
|
350
367
|
ScmsUtils.log( "Starting crunching CSS and JavaScript in:\n#{crunchDir}\n\n" )
|
351
|
-
#
|
368
|
+
#Scms.sassall(crunchDir)
|
352
369
|
Dir.chdir(crunchDir) do
|
353
370
|
Dir.glob("**/*.js").reject{|f| /-min/.match(f) != nil || /\.min/.match(f) != nil || /\.pack/.match(f) != nil }.each do |asset|
|
354
|
-
|
371
|
+
Scms.packr(asset)
|
355
372
|
end
|
356
373
|
#Dir.glob("**/*.{css, js}").each do |asset|
|
357
374
|
# #fullFileName = File.basename(asset)
|
358
375
|
# #ScmsUtils.log( "Crunching #{fullFileName}" )
|
359
376
|
# ext = File.extname(asset)
|
360
|
-
#
|
377
|
+
# Scms.yuicompress(asset, ext)
|
361
378
|
#end
|
362
379
|
end
|
363
380
|
end
|
364
381
|
|
365
|
-
def
|
366
|
-
ScmsUtils.log( "
|
382
|
+
def Scms.sassall(crunchDir)
|
383
|
+
ScmsUtils.log( "Minimising Sass Files (.scss)" )
|
367
384
|
Dir.chdir(crunchDir) do
|
368
385
|
Dir.glob("**/*.{scss}").each do |asset|
|
369
|
-
|
386
|
+
Scms.sass(asset)
|
370
387
|
end
|
371
388
|
end
|
372
389
|
end
|
373
390
|
|
374
|
-
def
|
391
|
+
def Scms.sass(asset)
|
375
392
|
if File.exists?(asset)
|
376
393
|
begin
|
377
394
|
template = File.read(asset)
|
@@ -391,13 +408,13 @@ module StaticCMS
|
|
391
408
|
end
|
392
409
|
end
|
393
410
|
|
394
|
-
def
|
411
|
+
def Scms.packr(asset)
|
395
412
|
if File.exists?(asset)
|
396
413
|
begin
|
397
414
|
code = File.read(asset)
|
398
415
|
compressed = Packr.pack(code)
|
399
416
|
File.open(asset, 'w') { |f| f.write(compressed) }
|
400
|
-
ScmsUtils.log( "
|
417
|
+
ScmsUtils.log( "Minified #{File.basename(asset)}" )
|
401
418
|
rescue Exception => e
|
402
419
|
ScmsUtils.errLog( "Error processing: #{asset}" )
|
403
420
|
ScmsUtils.errLog( e.message )
|
@@ -405,7 +422,7 @@ module StaticCMS
|
|
405
422
|
end
|
406
423
|
end
|
407
424
|
|
408
|
-
def
|
425
|
+
def Scms.yuicompress(asset, ext)
|
409
426
|
if File.exists?(asset)
|
410
427
|
#ScmsUtils.log( " Encoding: #{asset.encoding}" )
|
411
428
|
enc = "--charset utf-8"
|
@@ -423,13 +440,17 @@ module StaticCMS
|
|
423
440
|
end
|
424
441
|
end
|
425
442
|
|
426
|
-
def
|
427
|
-
yamlpath=File.join(config, "
|
443
|
+
def Scms.deploy(pub, config)
|
444
|
+
yamlpath=File.join(config, "_s3config.yml")
|
428
445
|
if File.exists?(yamlpath)
|
429
446
|
S3Deploy.sync(pub, config)
|
430
447
|
else
|
431
448
|
raise "The following file doesn't exist #{yamlpath}"
|
432
449
|
end
|
433
|
-
|
450
|
+
end
|
451
|
+
|
452
|
+
def Scms.Upgrade()
|
453
|
+
File.rename("config.yml", "_config.yml") if File.exists? File.join($website, "config.yml")
|
454
|
+
File.rename("s3config.yml", "_s3config.yml") if File.exists? File.join($website, "s3config.yml")
|
434
455
|
end
|
435
456
|
end
|