From ee2e64431dc8ca0b679ef20ce4b507d55f22aa84 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Tue, 4 Nov 2014 17:14:43 -0500 Subject: Added binstubs to ease dummy application use. --- bin/rails | 5 +++++ bin/refinerycms | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100755 bin/rails create mode 100755 bin/refinerycms diff --git a/bin/rails b/bin/rails new file mode 100755 index 0000000..0bf61b1 --- /dev/null +++ b/bin/rails @@ -0,0 +1,5 @@ +#!/usr/bin/env ruby +# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. + +ENGINE_PATH = File.expand_path('../..', __FILE__) +load File.expand_path('../../spec/dummy/bin/rails', __FILE__) diff --git a/bin/refinerycms b/bin/refinerycms new file mode 100755 index 0000000..263f699 --- /dev/null +++ b/bin/refinerycms @@ -0,0 +1,62 @@ +#!/usr/bin/env ruby +gem 'railties' +require 'rails/generators' +require 'rails/generators/rails/app/app_generator' +template_path = File.expand_path('../../templates/refinery/installer.rb', __FILE__) + +def show_help_message + puts "Usage:" + puts " refinerycms APP_NAME [options]" + puts "" + puts "Options:" + # Support when running locally + relative_path = File.expand_path('../../core/lib/generators/refinery/cms/cms_generator.rb', __FILE__) + if File.exist?(relative_path) + require relative_path + else + gem 'refinerycms-core' + require 'generators/refinery/cms/cms_generator' + end + Refinery::CmsGenerator.class_options.each do |raw, option| + dasherized = "--#{option.name.to_s.gsub('_', '-')}" + dasherized = [option.aliases, "[#{dasherized}]"].flatten.join(', ') if option.aliases.any? + puts " #{dasherized}".ljust(28) << "# #{option.description}" + end +end + +if ARGV.empty? + show_help_message + exit 0 +end + +case ARGV.first + when "-h", "--help" + show_help_message + exit 0 + when "-v", "--version" + puts "Refinery CMS #{Gem.loaded_specs['refinerycms'].version}" + exit 0 +end + +application_name = ARGV.shift + +result = Rails::Generators::AppGenerator.start [application_name, '-m', template_path, '--skip-test-unit'] | ARGV + +if result && result.include?('Gemfile') + note = ["\n=== ACTION REQUIRED ==="] + note << "Now you can launch your webserver using:" + note << "\ncd #{application_name}" + note << "rails server" + note << "\nThis will launch the built-in webserver at port 3000." + note << "You can now see Refinery running in your browser at http://localhost:3000/refinery" + + if ARGV.include?('--heroku') + note << "\nIf you want files and images to work on Heroku, you will need to setup S3:" + note << "heroku config:add S3_BUCKET=XXXXXXXXX S3_KEY=XXXXXXXXX S3_SECRET=XXXXXXXXXX S3_REGION=XXXXXXXXXX" + end + + note << "\nThanks for installing Refinery CMS, we hope you enjoy crafting your application!" + note << "---------\n\n" + + puts note +end -- cgit v1.2.3