lib/airake/project.rb in airake-0.2.1 vs lib/airake/project.rb in airake-0.2.2
- old
+ new
@@ -2,11 +2,10 @@
module Airake
# Project settings for AIR app
class Project
- attr_reader :project_name
attr_reader :base_dir, :bin_dir, :src_dir, :lib_dir, :test_dir
attr_reader :mxml_path, :appxml_path, :air_path, :swf_path
attr_reader :debug
attr_reader :options
attr_reader :assets
@@ -19,22 +18,23 @@
#
# base_dir:: Base (project) directory
# mxml_path: Path to the project.mxml (relative)
# options:: Override default paths, commands, extra opts, etc; See Options class var
def initialize(base_dir, mxml_path, options = {})
+ raise ArgumentError, "Invalid MXML path: #{mxml_path}" if mxml_path.blank?
+
+ mxml_dir = File.expand_path(File.dirname(mxml_path))
+ project_name = File.basename(mxml_path, ".mxml")
+
@base_dir = base_dir
- @mxml_path = mxml_path
+ @mxml_path = File.join(mxml_dir, "#{project_name}.mxml")
@options = options
- raise ArgumentError, "Invalid MXML path: #{mxml_path}" if mxml_path.blank?
-
@bin_dir = options[:bin_dir] || File.join(base_dir, "bin")
@src_dir = options[:src_dir] || File.join(base_dir, "src")
@lib_dir = options[:lib_dir] || File.join(base_dir, "lib")
- @test_dir = options[:test_dir] || File.join(base_dir, "test")
+ @test_dir = options[:test_dir] || File.join(base_dir, "test")
- @project_name = File.basename(@mxml_path, ".mxml")
- mxml_dir = File.expand_path(File.dirname(@mxml_path))
@appxml_path = options[:appxml_path] || File.join(mxml_dir, "#{project_name}-app.xml")
# Dest package files
@air_path = options[:air_path] || File.join(@bin_dir, "#{project_name}.air")
@swf_path = options[:swf_path] || File.join(@bin_dir, "#{project_name}.swf")
\ No newline at end of file