Class: Moonwalkair::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/moonwalkair/generator.rb,
lib/moonwalkair/generator/options.rb,
lib/moonwalkair/generator/application.rb

Overview

Generator for creating a moonwalkair-enabled project

Defined Under Namespace

Classes: Application, Options

Constant Summary collapse

APP_DIR =

Folder and template files

"app"
BIN_DIR =
"bin"
SCRIPT_DIR =
"script"
CONFIG_DIR =
"config"
APP_ASSETS_DIR =
File.join(APP_DIR, "assets")
APP_LIB_DIR =
File.join(APP_DIR, "lib")
APP_SCRIPTS_DIR =
File.join(APP_DIR, "scripts")
APP_VIEWS_DIR =
File.join(APP_DIR, "views")

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Generator

Returns a new instance of Generator.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/moonwalkair/generator.rb', line 25

def initialize(options = {})
  self.options = options

  self.project_name = options[:project_name]
  if self.project_name.nil? || self.project_name.squeeze.strip == ""
    raise "Need a project name"
  end

  self.air_sdk = options[:air_sdk] || "air2.0beta"

  self.target_dir = options[:directory] || self.project_name
  self.user_name  = options[:user_name]
  self.user_email = options[:user_email]
end

Instance Attribute Details

#air_sdkObject

Returns the value of attribute air_sdk.



22
23
24
# File 'lib/moonwalkair/generator.rb', line 22

def air_sdk
  @air_sdk
end

#descriptionObject

Returns the value of attribute description.



22
23
24
# File 'lib/moonwalkair/generator.rb', line 22

def description
  @description
end

#optionsObject

Returns the value of attribute options.



22
23
24
# File 'lib/moonwalkair/generator.rb', line 22

def options
  @options
end

#project_nameObject

Returns the value of attribute project_name.



22
23
24
# File 'lib/moonwalkair/generator.rb', line 22

def project_name
  @project_name
end

#target_dirObject

Returns the value of attribute target_dir.



22
23
24
# File 'lib/moonwalkair/generator.rb', line 22

def target_dir
  @target_dir
end

#user_emailObject

Returns the value of attribute user_email.



22
23
24
# File 'lib/moonwalkair/generator.rb', line 22

def user_email
  @user_email
end

#user_nameObject

Returns the value of attribute user_name.



22
23
24
# File 'lib/moonwalkair/generator.rb', line 22

def user_name
  @user_name
end

Instance Method Details

#runObject



40
41
42
43
44
# File 'lib/moonwalkair/generator.rb', line 40

def run
  create_files
  $stdout.puts ""
  $stdout.puts "*** Place your AIR SDK path in #{target_dir}/config/config.yml *** \t"      
end