bin/scms in scms-1.7.9 vs bin/scms in scms-1.8.6
- old
+ new
@@ -31,16 +31,16 @@
options[:action] = a
end
options[:mode] = "pub"
opts.on( '-m', '--mode MODE', 'CMS or Publish' ) do|m|
- options[:mode] = m
+ options[:mode] = m
end
options[:html] = "true"
opts.on( '-f', '--html HTML', 'true or false' ) do|h|
- options[:html] = h
+ options[:html] = h
end
options[:verbose] = false
opts.on( '-v', '--verbose', 'Output more information' ) do
options[:verbose] = true
@@ -51,30 +51,33 @@
puts opts
exit
end
end
optparse.parse!
-#Now raise an exception if we have not found a website option
-if options[:website].nil?
- puts "Please specify a website directory, e.g."
- puts "staticcms -w ~/websites/mystaticwebsite"
- raise OptionParser::MissingArgument
+
+$website = Dir.pwd
+unless options[:website].nil?
+ $website = options[:website]
end
+puts "Compiling #{$website}"
+##Set globals
+$html = (ENV["SCMS_HTML_OUT"] or "false")
+
$stdout.sync = true
root_folder = File.expand_path("../", File.dirname(__FILE__))
-@pub = File.join("#{options[:website]}/compiled")
+@pub = File.join("#{$website}/_site")
unless options[:pub].nil?
@pub = options[:pub]
end
Folders = {
:root => root_folder,
- :website => File.join(options[:website]),
+ :website => File.join($website),
:pub => (ENV["SCMS_PUBLISH_FOLDER"] or @pub),
:assets => (ENV["SCMS_STATICCMS_FOLDER"] or File.join(root_folder, "assets")),
- :config => (ENV["SCMS_CONFIG_FOLDER"] or File.join(options[:website]))
+ :config => (ENV["SCMS_CONFIG_FOLDER"] or File.join($website))
}
if options[:action] == "create"
if Dir.exists? Folders[:website]
throw "Website already exists!!!"
@@ -109,19 +112,17 @@
#puts "Website folder = #{Folders[:website]}"
#puts "Pub dir = #{Folders[:pub]}"
#puts "Config dir = #{Folders[:config]}"
#puts "Mode = #{options[:mode]}"
-##Set globals
-$website = Folders[:website]
-$html = (ENV["SCMS_HTML_OUT"] or "false")
-
deployDir = StaticCMS.build(Folders[:pub], Folders[:config], options[:mode])
if options[:action] == "crunch"
StaticCMS.crunch(deployDir)
end
#puts "deployDir = #{deployDir}"
if options[:action] == "deploy"
StaticCMS.crunch(deployDir)
StaticCMS.deploy(deployDir, Folders[:config])
+ backupdir = File.join(Folders[:website], "private")
+ S3Deploy.backup(backupdir, Folders[:config]) if File.directory? backupdir
end
\ No newline at end of file