Sha256: f1d98fb4ffb0087a5f60696c0b01a7ffa127b4e90c591f7397686919449ffe07

Contents?: true

Size: 1.58 KB

Versions: 1

Compression:

Stored size: 1.58 KB

Contents

#!/usr/bin/env ruby

require 'rails/all'
require 'caboose'
require 'caboose/engine'
require 'caboose/version'
require 'caboose/caboose_helper'
require 'trollop'

#puts "Usage:"
#puts "Create a new caboose app:"
#puts "  caboose new <app_path>"
#puts "Initialize an existing rails app as a new caboose app:"
#puts "  caboose init [<app_path>]\n\n"
#exit
  
global_opts = Trollop::options do
  banner <<-EOS
--------------------------------------------------------------------------------  
Caboose CMS
A content management system built on top of Ruby on Rails.
--------------------------------------------------------------------------------
Usage:
caboose new <path>
caboose init [--force] [<path>]
--------------------------------------------------------------------------------
EOS
  version "Caboose CMS Version #{Caboose::VERSION}\n\n"
  stop_on ['version', 'new', 'init']
end

cmd = ARGV.shift
case cmd

when 'new'
  
  path = ARGV.shift
  if (path.nil?)
    puts "Error: path for new app is required.\n\n"
    global_opts.help
    exit
  end
  
  puts "Creating the new rails app..."
  `rails new #{path} -d=mysql`  
  helper = CabooseHelper.new(path)  
  helper.init_all
  
when 'init'
  
  opts = Trollop::options do
    opt :force, 'Force re-installation of all caboose files.', :default => false
  end
  
  path = ARGV.shift
  path = Dir.pwd if path.nil?  
  is_rails_app = File.exists?(File.join(path, 'config', 'environment.rb'))  
  if (!is_rails_app)
    puts "Error: Not a rails app.\n\n"
    global_opts.help
    exit
  end
  
  helper = CabooseHelper.new(path, opts.force)
  helper.init_all
  
else
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
caboose-cms-0.1.78 bin/caboose