bin/scms in scms-1.8.8 vs bin/scms in scms-1.9.0

- old
+ new

@@ -7,17 +7,17 @@ # with respect to your use of this software code. # (c) 2007 Static-CMS require 'optparse' require 'fileutils' -require 'scms' +require 'Scms' options = {} optparse = OptionParser.new do|opts| # Set a banner, displayed at the top # of the help screen. - opts.banner = "Usage: scms [options]" + opts.banner = "Usage: Scms [options]" # Define the options, and what they do opts.on('-w', '--website WEBSITE', "Website directory (full path)") do |w| options[:website] = w end @@ -52,30 +52,19 @@ exit end end optparse.parse! -$website = Dir.pwd -unless options[:website].nil? - $website = options[:website] -end -puts "Compiling #{$website}" - -##Set globals +#Set globals +$website = (options[:website].nil?) ? Dir.pwd : options[:website] $html = (ENV["SCMS_HTML_OUT"] or "false") - $stdout.sync = true root_folder = File.expand_path("../", File.dirname(__FILE__)) -@pub = File.join("#{$website}/-site") -unless options[:pub].nil? - @pub = options[:pub] -end - Folders = { :root => root_folder, :website => File.join($website), - :pub => (ENV["SCMS_PUBLISH_FOLDER"] or @pub), + :pub => (ENV["SCMS_PUBLISH_FOLDER"] or options[:pub]), :assets => (ENV["SCMS_STATICCMS_FOLDER"] or File.join(root_folder, "assets")), :config => (ENV["SCMS_CONFIG_FOLDER"] or File.join($website)) } if options[:action] == "create" @@ -90,39 +79,16 @@ end end exit end -if options[:action] == "createapp" - if Dir.exists? Folders[:website] - throw "App already exists!!!" - else - puts "Making Air app: #{Folders[:website]}" - FileUtils.mkdir_p Folders[:website] - Dir.chdir(File.join(Folders[:assets], "blank-app-template")) do - files = Dir.glob('*') - FileUtils.cp_r files, Folders[:website] - end - end - exit -end - -raise "No website in folder #{Folders[:website]}" if !File::directory?(Folders[:website]) - #puts "System root folder = #{Folders[:root]}" #puts "Website folder = #{Folders[:website]}" #puts "Pub dir = #{Folders[:pub]}" #puts "Config dir = #{Folders[:config]}" #puts "Mode = #{options[:mode]}" -deployDir = StaticCMS.build(Folders[:pub], Folders[:config], options[:mode]) - -if options[:action] == "crunch" - StaticCMS.crunch(deployDir) -end +raise "No website in folder #{Folders[:website]}" if !File::directory?(Folders[:website]) +Scms.Upgrade() +deployDir = Scms.build(Folders[:pub], Folders[:config], options[:mode]) #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 +Scms.deploy(deployDir, Folders[:config]) if options[:action] == "deploy" \ No newline at end of file