titanium_cli 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +37 -0
- data/Rakefile +22 -0
- data/bin/titanium +15 -0
- data/lib/titanium_cli/base.rb +102 -0
- data/lib/titanium_cli/version.rb +3 -0
- data/lib/titanium_cli.rb +4 -0
- metadata +67 -0
data/README.markdown
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Titanium CLI
|
2
|
+
|
3
|
+
This gem allows you to create and run Titanium Mobile projects via the
|
4
|
+
command line.
|
5
|
+
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
Creating projects:
|
10
|
+
Create iPhone project:
|
11
|
+
titanium create --platform=iphone --name=FooMobile --id=com.foo.mobile
|
12
|
+
|
13
|
+
Create Android project
|
14
|
+
titanium create --platform=android --name=FooMobile \
|
15
|
+
--id=com.foo.mobile --android=/opt/android-sdk
|
16
|
+
|
17
|
+
Create iPhone and Android project
|
18
|
+
titanium create --platform=iphone,android --name=FooMobile \
|
19
|
+
--id=com.foo.mobile --android=/opt/android-sdk
|
20
|
+
|
21
|
+
Running projects:
|
22
|
+
Run iPhone project:
|
23
|
+
titanium run --platform=iphone
|
24
|
+
|
25
|
+
Run iPhone project:
|
26
|
+
titanium run --platform=android
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
## TODO
|
31
|
+
|
32
|
+
* Linux/Windows Support
|
33
|
+
|
34
|
+
|
35
|
+
## License
|
36
|
+
|
37
|
+
MIT License. See LICENSE in this repo.
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
$:.unshift 'lib'
|
2
|
+
|
3
|
+
desc "Open an irb session preloaded with this library"
|
4
|
+
task :console do
|
5
|
+
sh "irb -rubygems -r ./lib/titanium_cli.rb -I ./lib"
|
6
|
+
end
|
7
|
+
|
8
|
+
require 'sdoc_helpers'
|
9
|
+
desc "Push a new version to Gemcutter"
|
10
|
+
task :publish do
|
11
|
+
require 'titanium_cli/version'
|
12
|
+
|
13
|
+
ver = TitaniumCli::Version
|
14
|
+
|
15
|
+
sh "gem build titanium_cli.gemspec"
|
16
|
+
sh "gem push titanium_cli-#{ver}.gem"
|
17
|
+
sh "git tag -a -m 'TitaniumCLI v#{ver}' v#{ver}"
|
18
|
+
sh "git push origin v#{ver}"
|
19
|
+
sh "git push origin master"
|
20
|
+
sh "git clean -fd"
|
21
|
+
sh "rake pages"
|
22
|
+
end
|
data/bin/titanium
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'titanium_cli/base'
|
5
|
+
rescue LoadError
|
6
|
+
$:.unshift File.expand_path(File.join(File.dirname(__FILE__), '/../lib'))
|
7
|
+
begin
|
8
|
+
require 'titanium_cli/base'
|
9
|
+
rescue LoadError
|
10
|
+
warn "Can't find titanium_cli/base"
|
11
|
+
exit -1
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
TitaniumCLI::Base.run(ARGV)
|
@@ -0,0 +1,102 @@
|
|
1
|
+
module TitaniumCLI
|
2
|
+
module Base
|
3
|
+
extend self
|
4
|
+
|
5
|
+
attr_accessor :log, :sdk_root, :sdk_version
|
6
|
+
|
7
|
+
# Copy Titanium logs to this file
|
8
|
+
def log
|
9
|
+
@log ||= ENV['LOG'] || 'log/development.log'
|
10
|
+
end
|
11
|
+
|
12
|
+
# Titanium SDK version
|
13
|
+
def sdk_version
|
14
|
+
@sdk_version ||= ENV['SDK_VERSION'] || '1.4.2'
|
15
|
+
end
|
16
|
+
|
17
|
+
# Titanium SDK root
|
18
|
+
def sdk_root
|
19
|
+
return @sdk_root if @sdk_root
|
20
|
+
case RUBY_PLATFORM
|
21
|
+
when /darwin/
|
22
|
+
system_root = "/Library/Application Support/Titanium/mobilesdk/osx/#{sdk_version}"
|
23
|
+
local_root = "#{ENV['HOME']}#{system_root}"
|
24
|
+
|
25
|
+
if File.exists?(local_root)
|
26
|
+
@sdk_root = local_root
|
27
|
+
elsif File.exists?(system_root)
|
28
|
+
@sdk_root = system_root
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
unless @sdk_root
|
33
|
+
raise "Can't find Titanium SDK root"
|
34
|
+
end
|
35
|
+
@sdk_root
|
36
|
+
end
|
37
|
+
|
38
|
+
# Run titanium.py command
|
39
|
+
def run(argv)
|
40
|
+
if action = argv.shift
|
41
|
+
case action.to_sym
|
42
|
+
when :create
|
43
|
+
create_project(argv) and return
|
44
|
+
when :run
|
45
|
+
run_project(argv) and return
|
46
|
+
else
|
47
|
+
raise "Invalid action #{action}" and return
|
48
|
+
end
|
49
|
+
end
|
50
|
+
puts usage.gsub(/^ /, '')
|
51
|
+
end
|
52
|
+
|
53
|
+
# Print usage for this script
|
54
|
+
def usage; <<-USAGE
|
55
|
+
Creating projects:
|
56
|
+
Create iPhone project:
|
57
|
+
titanium create --platform=iphone --name=FooMobile --id=com.foo.mobile
|
58
|
+
|
59
|
+
Create Android project
|
60
|
+
titanium create --platform=android --name=FooMobile \\
|
61
|
+
--id=com.foo.mobile --android=/opt/android-sdk
|
62
|
+
|
63
|
+
Create iPhone and Android project
|
64
|
+
titanium create --platform=iphone,android --name=FooMobile \\
|
65
|
+
--id=com.foo.mobile --android=/opt/android-sdk
|
66
|
+
|
67
|
+
Running projects:
|
68
|
+
Run iPhone project:
|
69
|
+
titanium run --platform=iphone
|
70
|
+
|
71
|
+
Run iPhone project:
|
72
|
+
titanium run --platform=android
|
73
|
+
|
74
|
+
USAGE
|
75
|
+
end
|
76
|
+
|
77
|
+
# Create project
|
78
|
+
# (directory optional)
|
79
|
+
#
|
80
|
+
# python /Library/Application\ Support/Titanium/mobilesdk/osx/1.4.2/titanium.py create --platform=iphone --name=FooBar --id=com.foobar.baz --directory=.
|
81
|
+
# python /Library/Application\ Support/Titanium/mobilesdk/osx/1.4.2/titanium.py create --platform=iphone,android --name=FooBar --id=com.foobar.baz --android=/opt/android-sdk
|
82
|
+
def create_project(args)
|
83
|
+
bin "create #{args.join(' ')}"
|
84
|
+
end
|
85
|
+
|
86
|
+
# Run project
|
87
|
+
#
|
88
|
+
# python /Library/Application\ Support/Titanium/mobilesdk/osx/1.4.2/titanium.py run --platform=iphone
|
89
|
+
# python /Library/Application\ Support/Titanium/mobilesdk/osx/1.4.2/titanium.py run --platform=android
|
90
|
+
def run_project(args)
|
91
|
+
bin "run #{args.join(' ')} 2>&1 | tee -a #{log}"
|
92
|
+
end
|
93
|
+
|
94
|
+
private
|
95
|
+
|
96
|
+
# Runs the titanium.py command
|
97
|
+
def bin(command)
|
98
|
+
system %{"#{sdk_root}/titanium.py" #{command}}
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
102
|
+
end
|
data/lib/titanium_cli.rb
ADDED
metadata
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: titanium_cli
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Joshua Priddle
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-12-29 00:00:00 -05:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: " Titanium CLI: Create/run Titanium Mobile projects from the command line\n"
|
22
|
+
email: jpriddle@nevercraft.net
|
23
|
+
executables:
|
24
|
+
- titanium
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files:
|
28
|
+
- README.markdown
|
29
|
+
files:
|
30
|
+
- Rakefile
|
31
|
+
- README.markdown
|
32
|
+
- bin/titanium
|
33
|
+
- lib/titanium_cli/base.rb
|
34
|
+
- lib/titanium_cli/version.rb
|
35
|
+
- lib/titanium_cli.rb
|
36
|
+
has_rdoc: true
|
37
|
+
homepage: http://github.com/itspriddle/titanium_cli
|
38
|
+
licenses: []
|
39
|
+
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options:
|
42
|
+
- --charset=UTF-8
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
segments:
|
50
|
+
- 0
|
51
|
+
version: "0"
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
version: "0"
|
59
|
+
requirements: []
|
60
|
+
|
61
|
+
rubyforge_project:
|
62
|
+
rubygems_version: 1.3.6
|
63
|
+
signing_key:
|
64
|
+
specification_version: 3
|
65
|
+
summary: "Titanium CLI: Create/run Titanium Mobile projects from the command line"
|
66
|
+
test_files: []
|
67
|
+
|