Skip to content

Commit

Permalink
• Project settings can now be queried to establish if the user is com…
Browse files Browse the repository at this point in the history
…piling an Air app.

This is done by inspecting the source directory/file specs for an air descriptor file.
  • Loading branch information
simongregory committed Mar 19, 2010
1 parent 137b827 commit d5dc5c4
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 2 deletions.
53 changes: 51 additions & 2 deletions Support/lib/fm/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,25 @@ def is_swc
return false
end

# Locate and return the air descriptor file associated with the current
# project.
#
def air_descriptor
fs = file_specs || ''
unless fs.empty?
ad = fs.sub(/\.(as|mxml)$/,'')
return "#{ad}-app.xml"
end
return nil
end

# Boolean to indicate if we are compiling an air application.
#
def is_air
return true if File.exist? air_descriptor rescue return false
return false
end

# A list of classes found in the project.
#
def list_classes
Expand Down Expand Up @@ -312,8 +331,35 @@ def test_is_swc

assert_equal(false, s.is_swc)

end

def test_is_air

clear_tm_env

s = FlexMate::Settings.new

end
ENV['TM_PROJECT_DIRECTORY'] = cases_dir + '/a'

assert_equal(false, s.is_air)

ENV['TM_PROJECT_DIRECTORY'] = cases_dir + '/b'

assert_equal(false, s.is_air)

ENV['TM_PROJECT_DIRECTORY'] = cases_dir + '/c'

assert_equal(false, s.is_air)

ENV['TM_PROJECT_DIRECTORY'] = cases_dir + '/d'

assert_equal(false, s.is_air)

ENV['TM_PROJECT_DIRECTORY'] = cases_dir + '/e'

assert_equal(true, s.is_air)

end

def test_source_path

Expand All @@ -339,7 +385,10 @@ def test_source_path

ENV['TM_PROJECT_DIRECTORY'] = cases_dir + '/c'

assert_equal(cases_dir, s.source_path)
#We intentionally don't consider the root of the project as a src dir.
#TODO: Decide if we want it to be? Could be achieved by scanning root for
# .as or .mxml files.
assert_equal(nil, s.source_path)

end

Expand Down
5 changes: 5 additions & 0 deletions Test/project/e/src/App-app.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<application xmlns="http://ns.adobe.com/air/application/1.0.M6">
<id>org.HelloWorld</id>
<version>2.0</version>
</application>
Empty file added Test/project/e/src/App.as
Empty file.

0 comments on commit d5dc5c4

Please sign in to comment.