Class: Nsweb::AppGenerator

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

Constant Summary collapse

BACKENDS =
%w(eft)
AUTH_SCHEMES =
%w(eft_account eft_username)

Instance Method Summary collapse

Methods inherited from Rails::Generators::AppBase

exit_on_failure?

Instance Method Details

#run!Object



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/nsweb/generators/nsweb/app/app_generator.rb', line 138

def run!
  self.destination_root = app_path
  puts "destination_root: #{self.destination_root}"

  validate_options!

  generate_rails

  init_nsweb
  init_database
  bundle_command 'exec capify .'
  gsub_file 'Capfile', /^# (load 'deploy\/assets.*)/, '\1'
  init_git

  notes = ["\nNew Nsweb app created at '#{app_path}'.\n"]
  if options.skip_git? or options.skip_db?
    notes << '*******************************'
    notes << '*** FURTHER ACTION REQUIRED ***'
    notes << '*******************************'
    notes << "  * NOTE: All actions need to be performed in the new app directory. *\n"

    if options.skip_git?
      notes << "= GIT initialization\n"
      notes << 'You chose to skip git initialization.'
      notes << "In order to get proper git functionality, the following steps need to be performed:\n"
      notes << '  1. Add a .gitignore file to prevent unwanted files from sneaking into the repository.'
      notes << '  2. Initialize the local git repository:'
      notes << '     $ git init .'
      notes << "\n"
      notes << "  3. Add all the remote repositories to git's configuration:"
      notes << "     $ git remote add origin [email protected]:#{app_name}.git"
      notes << "     $ git remote add iloathing [email protected]:#{app_name}.git"
      notes << "     $ git remote add eastwood [email protected]:#{app_name}.git"
      notes << "     $ git remote add all [email protected]:#{app_name}.git"
      notes << "     $ git remote set-url --add all [email protected]:#{app_name}.git"
      notes << "\n"
      notes << "  4. Add the current codebase to the repo:"
      notes << "     $ git add ."
      notes << "\n"
      notes << "  5. Commit the current codebase:"
      notes << "     $ git commit -a -m 'Initial Commit'"
      notes << "\n"
    end

    if options.skip_db?
      notes << "= Database initialization\n"
      notes << "You chose to skip database initialization."
      notes << "You will not be able to test/run the generated application until the development"
      notes << "database is created, migrated and seeded."
      notes << "  $ bundle exec rake db:create"
      notes << "  $ bundle exec rake db:migrate"
      notes << "  $ bundle exec rake db:seed"
      notes << "\n"
    end
  end

  say notes.join("\n")
end