Class: Appboost::ForemanExportGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/appboost/foreman_export_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.default_app_nameObject



19
20
21
# File 'lib/generators/appboost/foreman_export_generator.rb', line 19

def self.default_app_name
  Dir.pwd.split('/').last
end

.default_directoryObject



15
16
17
# File 'lib/generators/appboost/foreman_export_generator.rb', line 15

def self.default_directory
  Rails.root.to_s
end

.default_logObject



11
12
13
# File 'lib/generators/appboost/foreman_export_generator.rb', line 11

def self.default_log
  Rails.root.join('log/foreman').to_s
end

.default_procfileObject



6
7
8
9
# File 'lib/generators/appboost/foreman_export_generator.rb', line 6

def self.default_procfile
  e = Rails.env == 'development' ? nil : Rails.env
  ['Procfile', e].compact.join('.')
end

Instance Method Details

#exportObject



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/generators/appboost/foreman_export_generator.rb', line 55

def export
  args = ["#{options[:format]} #{options[:location]}"]
  args << "-f #{options[:procfile]}"
  args << "-a #{options[:app]}"
  args << "-u #{options[:user]}"
  args << "-d #{options[:directory]}"
  args << "-l #{options[:log]}"
  args << "-c #{options[:concurrency]}" if options[:concurrency]

  system "bundle exec foreman export #{args.join(' ')}"
end