bin/scms in scms-2.1.7 vs bin/scms in scms-2.1.8
- old
+ new
@@ -22,19 +22,19 @@
optparse = OptionParser.new do|opts|
# Set a banner, displayed at the top of the help screen.
opts.banner = "Usage: scms [options]"
# Define the options, and what they do
- opts.on('-w', '--website WEBSITE', "Website directory (full path)") do |w|
+ opts.on('-w', '--website WEBSITE', "Website directory (defaults to ./)") do |w|
options[:website] = w
end
- opts.on('-c', '--config CONFIGDIR', "Configeration directory if different from Website (full path)") do |c|
+ opts.on('-c', '--config CONFIGDIR', "Configeration directory if different from Website (defaults to ./)") do |c|
options[:configdir] = c
end
- opts.on('-o', '--output BuildDIR', "Website build dir (full path)") do |o|
+ opts.on('-o', '--output BuildDIR', "Website build dir (defaults to ./)") do |o|
options[:pub] = o
end
options[:action] = "build"
opts.on( '-a', '--action ACTION', 'build, deploy, listen or create' ) do|a|
@@ -45,11 +45,11 @@
opts.on( '-s', '--server', 'Run a scms server on port localhost:8008' ) do
options[:server] = true
end
options[:mode] = "pub"
- opts.on( '-m', '--mode MODE', 'CMS or Publish' ) do|m|
+ opts.on( '-m', '--mode MODE', 'CMS or Publish (for use with Air-Monkey: http://ipassexam.github.io/Air-Monkey/)' ) do|m|
options[:mode] = m
end
opts.on( '-v', '--version', 'Output scms version' ) do
puts "Version: #{Scms::VERSION}"
@@ -105,25 +105,35 @@
raise "No website in folder #{Folders[:website]}" if !File::directory?(Folders[:website])
Scms.upgrade(Folders[:website])
Scms.build(Folders[:website], Folders[:config], options[:mode])
Scms.copywebsite(Folders[:website], Folders[:pub]) if Folders[:pub] != nil
+threads = []
+
if options[:server]
- if system('scms-server --dir "#{Folders[:website]}"')
- puts "Launched scms-server"
- else
- puts "Close scms-server?"
- end
+ threads << Thread.new {
+ if system('scms-server')
+ puts "Launched scms-server"
+ else
+ puts "Stop scms?"
+ abort
+ end
+ }
end
if options[:action] == "watch"
- require 'filewatcher'
- FileWatcher.new(["_views", "_templates", "_source"], "Watching for changes in _views, _templates or _source").watch do |filename|
- puts "Updated " + filename
- Scms.build(Folders[:website], Folders[:config], options[:mode])
- end
+ watcher = Thread.new {
+ require 'filewatcher'
+ FileWatcher.new(["_views", "_templates", "_source"], "Watching for changes in _views, _templates or _source").watch do |filename|
+ puts "Updated " + filename
+ Scms.build(Folders[:website], Folders[:config], options[:mode])
+ end
+ }
+ watcher.join
end
mimetypefile = File.join(Folders[:root], "assets", "mime.types")
S3Deploy.sync(Folders[:website], Folders[:config], mimetypefile) if options[:action] == "deploy"
-Process.exit!(true)
+threads.each { |t|
+ t.join
+}
\ No newline at end of file