lib/generators/cadenero/install_generator.rb in cadenero-0.0.2.b4 vs lib/generators/cadenero/install_generator.rb in cadenero-0.0.2.b5
- old
+ new
@@ -1,11 +1,11 @@
require 'rails/generators'
module Cadenero
# Bootstrap Cadenero in a new Rails App
module Generators
# Cadenero generator to be used as `rails-api g cadenero:install`
- class InstallGenerator < Rails::Generators::Base
+ class InstallGenerator < Rails::Generators::Base
class_option "user-class", :type => :string
class_option "default-account-name", :type => :string
class_option "default-account-subdomain", :type => :string
class_option "default-user-email", :type => :string
class_option "default-user-password", :type => :string
@@ -72,11 +72,11 @@
ask("What will be the email for the default user owner of the default account? [testy@example.com]").presence ||
'testy@example.com'
end
# Define which will be the password for the root owner for the defaul accout Multitnant Rails App.
- def determine_default_user_password
+ def determine_default_user_password
Cadenero.default_user_password = options["default-user-password"].presence ||
ask("What will be the password for the default user owner of the default account? [change-me]").presence ||
'change-me'
end
@@ -104,11 +104,11 @@
def seed_database
puts "default_account_name: #{Cadenero.default_account_name}"
puts "default_account_subdomain: #{Cadenero.default_account_subdomain}"
puts "default_user_email: #{Cadenero.default_user_email}"
puts "default_user_password: #{Cadenero.default_user_password}"
-
+
load "#{Rails.root}/config/initializers/cadenero.rb"
unless options["no-migrate"]
puts "Creating default cadenero account and owner"
Cadenero::Engine.load_seed
end
@@ -170,14 +170,9 @@
# @return the user_class
def user_class
@user_class
end
- # keep track of the migration numbers
- def next_migration_number
- last_migration = Dir[Rails.root + "db/migrate/*.rb"].sort.last.split("/").last
- current_migration_number = /^(\d+)_/.match(last_migration)[1]
- current_migration_number.to_i + 1
- end
+
end
end
end
\ No newline at end of file