Class: Refinery::AppGenerator

Inherits:
Rails::Generators::AppBase show all
Defined in:
core/lib/generators/refinery/app/app_generator.rb

Constant Summary

TARGET_MAJOR_VERSION =
3
TARGET_MINOR_VERSION =
1

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Rails::Generators::AppBase

exit_on_failure?

Class Method Details

+ (Object) reserved_app_names



46
47
48
49
50
51
52
53
54
# File 'core/lib/generators/refinery/app/app_generator.rb', line 46

def reserved_app_names
  @reserved_app_names ||= [
    'refinery',
    'refinerycms',
    'test',
    'testing',
    'rails'
  ]
end

Instance Method Details

- (Object) run!



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'core/lib/generators/refinery/app/app_generator.rb', line 57

def run!
  self.destination_root = app_path

  validate_options!
  generate_rails!
  prepare_gemfile!
  run_bundle

  create_database!

  Refinery::CmsGenerator.start %w[--fresh-installation], :destination_root => app_path

  rake("railties:install:migrations db:migrate#{' --trace' if options[:trace]}")

  puts "\n---------"
  puts "Refinery successfully installed in '#{app_pathname}'!\n\n"

  heroku_deploy! if options[:heroku]

  note = ["\n=== ACTION REQUIRED ==="]
  if options[:skip_db]
    note << "Because you elected to skip database creation and migration in the installer"
    note << "you will need to run the following tasks manually to maintain correct operation:"
    note << "\ncd #{app_pathname}"
    note << "bundle exec rake db:create"
    note << "bundle exec rails generate refinery:cms"
    note << "bundle exec rake db:migrate"
    note << "\n---------\n"
  end
  note << "Now you can launch your webserver using:"
  note << "\ncd #{app_pathname}"
  note << "rails server"
  note << "\nThis will launch the built-in webserver at port 3000."
  note << "You can now see your site running in your browser at http://localhost:3000"

  if options[:heroku]
    note << "\nIf you want files and images to work on heroku, you will need setup S3:"
    note << "heroku config:add S3_BUCKET=XXXXXXXXX S3_KEY=XXXXXXXXX S3_SECRET=XXXXXXXXXX S3_REGION=XXXXXXXXXX"
  end

  note << "\nThanks for installing Refinery, enjoy creating your new application!"
  note << "---------\n\n"

  puts note.join("\n")
end