Skip to content

Commit

Permalink
added find variables
Browse files Browse the repository at this point in the history
  • Loading branch information
fsrc committed Apr 15, 2011
1 parent c502dbc commit fbf1a98
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 1 deletion.
18 changes: 18 additions & 0 deletions Commands/Find configuration.tmCommand
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
<string>ruby "$TM_BUNDLE_SUPPORT/find_variables.rb"</string>
<key>input</key>
<string>none</string>
<key>name</key>
<string>Find configuration</string>
<key>output</key>
<string>openAsNewDocument</string>
<key>uuid</key>
<string>FCD569D0-21F7-4302-A577-8C669FA583C2</string>
</dict>
</plist>
10 changes: 10 additions & 0 deletions Support/build_titanium.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

# Traverse the directory tree to find the root of the project
def find_project_root(dir)
return nil if dir == nil

f = File.join(dir, "tiapp.xml")

return dir if File.exist?(f)
Expand All @@ -25,6 +27,14 @@ def find_project_root(dir)
# Find out project dir root
proj_dir = find_project_root(ENV["TM_PROJECT_DIRECTORY"])

if proj_dir == nil then

puts "<p><b>Error finding tiapp.xml</b> - You must open your TextMate project folder from within a Titanium project path.</p>"
puts "<p>Preferably the root of the project or the Resources folder.</p>"

exit()
end

# Read project tiapp.xml
tiapp_xml = File.open(File.join(proj_dir, "tiapp.xml"), 'r') { |f| f.read }

Expand Down
2 changes: 1 addition & 1 deletion Support/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@ios_version = "4.3"

# Titanium Mobile version
@tim_version = "1.6.1"
@tim_version = "1.5.1"

# Titanium Desktop version
@tid_version = "1.1.0"
Expand Down
13 changes: 13 additions & 0 deletions Support/find_variables.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
result = %x{ps Ax}

regex = /^\s+\d+\s+[\?|\w|\d]+\s+\w+\s+\d+:\d+\.\d+\s+python\s+([\/|\w|\s]+Titanium)[^\d]+([\d\.]+).*"([\d\.]+)"/

matches = result.scan(regex)

if matches != nil then
puts %{@titanium_path = "#{matches[0][0]}"}
puts %{@tim_version = "#{matches[0][1]}"}
puts %{@ios_version = "#{matches[0][2]}"}
else
puts %{You don't have any build/run process running.}
end
1 change: 1 addition & 0 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<string>73C3F17F-F39C-423B-B120-F7CE3D16B107</string>
<string>E51F3990-7399-4B67-A9D1-020F4782DC4D</string>
<string>4B1E72AA-955F-42F1-B505-6A8BF0C10DA2</string>
<string>FCD569D0-21F7-4302-A577-8C669FA583C2</string>
</array>
<key>uuid</key>
<string>091BCD49-B987-4749-BACE-04C4F5077ED1</string>
Expand Down

0 comments on commit fbf1a98

Please sign in to comment.