Sha256: 4dbf5436d49fafc3e6103d2c46f062436138870b8890eb2ce5f500587ef8ce02

Contents?: true

Size: 1.85 KB

Versions: 25

Compression:

Stored size: 1.85 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, true)
  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

when 'pg_restore'
  
  puts "\nTo what database do you want to restore?"
  db = gets.chomp
  puts "\nWhere's the dump file?"
  dump_file = gets.chomp
  puts "\nRunning pg_restore...\n"
  `pg_restore --verbose --clean --no-acl --no-owner -h localhost -d #{db} #{dump_file}`
  
else
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
caboose-cms-0.2.82 bin/caboose
caboose-cms-0.2.81 bin/caboose
caboose-cms-0.2.80 bin/caboose
caboose-cms-0.2.79 bin/caboose
caboose-cms-0.2.78 bin/caboose