Class: Airake::Project
Direct Known Subclasses
Instance Attribute Summary collapse
-
#base_dir ⇒ Object
readonly
Returns the value of attribute base_dir.
-
#debug ⇒ Object
readonly
Returns the value of attribute debug.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#lib_dir ⇒ Object
readonly
Returns the value of attribute lib_dir.
-
#src_dirs ⇒ Object
readonly
Returns the value of attribute src_dirs.
-
#swf_path ⇒ Object
readonly
Returns the value of attribute swf_path.
Instance Method Summary collapse
-
#asdoc ⇒ Object
AS docs.
-
#clean ⇒ Object
Remove files.
-
#initialize(env = nil, base_dir = nil, options = nil) ⇒ Project
constructor
Create project.
-
#load(options = {}) ⇒ Object
Load options.
Constructor Details
#initialize(env = nil, base_dir = nil, options = nil) ⇒ Project
Create project.
Options:
env
: Environment, such as development, test, production. Defaults to ENV. base_dir
: Base (project) directory. Defaults to ENV options
: If nil, options are loaded from airake.yml in root. (All paths relative to base directory)
-
src_dirs
: Paths to source -
lib_dir
: Path to lib directory -
swf_path
: Path to SWF file -
debug
: “true” or “false”
More options:
-
mxmlc_path
-
asdoc_path
-
mxmlc_extra_opts
-
asdoc_extra_opts
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/airake/project.rb', line 24 def initialize(env = nil, base_dir = nil, = nil) @env = env @env = ENV["AIRAKE_ENV"] if @env.nil? base_dir = ENV["AIRAKE_ROOT"] if base_dir.nil? raise "Need to specify an AIRAKE_ROOT (project root)" if base_dir.blank? @base_dir = base_dir if .nil? conf_path = File.join(base_dir, "airake.yml") unless File.exist?(conf_path) raise <<-EOS You are missing your #{conf_path} configuration file. For existing projects, please regenerate an airake project and look at Rakefile and airake.yml for an example. EOS end = YAML.load_file(File.join(@base_dir, "airake.yml")) = [@env] = .merge() if .symbolize_keys! end load() ensure_exists([ *@src_dirs ]) end |
Instance Attribute Details
#base_dir ⇒ Object (readonly)
Returns the value of attribute base_dir.
5 6 7 |
# File 'lib/airake/project.rb', line 5 def base_dir @base_dir end |
#debug ⇒ Object (readonly)
Returns the value of attribute debug.
5 6 7 |
# File 'lib/airake/project.rb', line 5 def debug @debug end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
5 6 7 |
# File 'lib/airake/project.rb', line 5 def env @env end |
#lib_dir ⇒ Object (readonly)
Returns the value of attribute lib_dir.
5 6 7 |
# File 'lib/airake/project.rb', line 5 def lib_dir @lib_dir end |
#src_dirs ⇒ Object (readonly)
Returns the value of attribute src_dirs.
5 6 7 |
# File 'lib/airake/project.rb', line 5 def src_dirs @src_dirs end |
#swf_path ⇒ Object (readonly)
Returns the value of attribute swf_path.
5 6 7 |
# File 'lib/airake/project.rb', line 5 def swf_path @swf_path end |
Instance Method Details
#asdoc ⇒ Object
AS docs
67 68 69 70 71 |
# File 'lib/airake/project.rb', line 67 def asdoc = { :lib_dir => @lib_dir, :src_dirs => @src_dirs, :asdoc_extra_opts => @asdoc_extra_opts, :asdoc_path => @asdoc_path } Airake::Commands::Asdoc.new() end |
#clean ⇒ Object
Remove files
74 75 76 |
# File 'lib/airake/project.rb', line 74 def clean FileUtils.rm(@swf_path, :verbose => true) if File.exist?(@swf_path) end |
#load(options = {}) ⇒ Object
Load options
56 57 58 59 60 61 62 63 64 |
# File 'lib/airake/project.rb', line 56 def load( = {}) @src_dirs = [] @src_dirs = [:src_dirs].collect { |src_dir| File.join(base_dir, src_dir) } if [:src_dirs] @lib_dir = File.join(base_dir, [:lib_dir]) if [:lib_dir] @swf_path = File.join(base_dir, [:swf_path]) ([ :debug ], ) end |