pindah 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +11 -3
- data/bin/pindah +1 -1
- data/lib/pindah.rb +4 -3
- data/lib/pindah_cli.rb +13 -8
- data/templates/AndroidManifest.xml +1 -1
- data/templates/build.xml +2 -8
- data/templates/initial_activity.mirah +3 -0
- data/test/fixtures/HelloWorld.mirah +1 -0
- metadata +79 -58
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
A tool for writing Android applications in [Mirah](http://mirah.org).
|
4
4
|
|
5
|
+
<img src="https://github.com/mirah/pindah/raw/master/pindah.png" alt="Pindah logo" align="right" />
|
6
|
+
|
5
7
|
## Requirements
|
6
8
|
|
7
9
|
You must have the [Android SDK](http://d.android.com/sdk/) installed
|
@@ -16,9 +18,9 @@ and is a reasonable target for new applications. Once the platform
|
|
16
18
|
tools are installed, place the SDK's <tt>platform-tools/</tt>
|
17
19
|
directory on your $PATH as well.
|
18
20
|
|
19
|
-
You'll also need [JRuby](http://jruby.org)
|
20
|
-
$PATH. If your gem and rake are not from
|
21
|
-
and rake commands with jruby -S:
|
21
|
+
You'll also need [JRuby](http://jruby.org) version 1.6 or higher
|
22
|
+
installed with bin/ on your $PATH. If your gem and rake are not from
|
23
|
+
from JRuby, prefix the gem and rake commands with jruby -S:
|
22
24
|
|
23
25
|
$ gem install pindah
|
24
26
|
|
@@ -96,6 +98,12 @@ your application.
|
|
96
98
|
See [Garrett](http://github.com/technomancy/Garrett) for an example of
|
97
99
|
a basic project.
|
98
100
|
|
101
|
+
## Community
|
102
|
+
|
103
|
+
Problems? Suggestions? Bring them up on the
|
104
|
+
[Mirah mailing list](http://groups.google.com/group/mirah/) or the #mirah
|
105
|
+
IRC channel on freenode.
|
106
|
+
|
99
107
|
## See Also
|
100
108
|
|
101
109
|
If Mirah is just too low-level and you need something more dynamic,
|
data/bin/pindah
CHANGED
@@ -4,6 +4,6 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'pindah_
|
|
4
4
|
|
5
5
|
begin
|
6
6
|
PindahCLI.send *ARGV
|
7
|
-
rescue ArgumentError
|
7
|
+
rescue ArgumentError, NoMethodError
|
8
8
|
abort "Usage: #{File.basename($0)} create org.example.hello [/path/to/hello_world] [HelloActivity]"
|
9
9
|
end
|
data/lib/pindah.rb
CHANGED
@@ -12,10 +12,11 @@ end
|
|
12
12
|
require "mirah"
|
13
13
|
|
14
14
|
module Pindah
|
15
|
-
VERSION = '0.1.
|
15
|
+
VERSION = '0.1.1'
|
16
16
|
|
17
17
|
def self.infer_sdk_location(path)
|
18
18
|
tools = path.split(":").detect {|p| File.exists? "#{p}/android" }
|
19
|
+
abort "\"android\" executable not found on $PATH" if tools.nil?
|
19
20
|
File.expand_path("#{tools}/..")
|
20
21
|
end
|
21
22
|
|
@@ -35,7 +36,7 @@ module Pindah
|
|
35
36
|
|
36
37
|
desc "Tail logs from a device or a device or emulator"
|
37
38
|
task :logcat do
|
38
|
-
system "adb
|
39
|
+
system "adb logcat #{@spec[:log_spec]}"
|
39
40
|
end
|
40
41
|
|
41
42
|
desc "Print the project spec"
|
@@ -53,7 +54,7 @@ module Pindah
|
|
53
54
|
|
54
55
|
@spec[:root] = File.expand_path "."
|
55
56
|
@spec[:target] ||= TARGETS[@spec[:target_version].to_s.sub(/android-/, '')]
|
56
|
-
@spec[:classes] ||= "#{@spec[:output]}/classes"
|
57
|
+
@spec[:classes] ||= "#{@spec[:output]}/classes/"
|
57
58
|
@spec[:classpath] << @spec[:classes]
|
58
59
|
@spec[:classpath] << "#{@spec[:sdk]}/platforms/android-#{@spec[:target]}/android.jar"
|
59
60
|
@spec[:log_spec] ||= "ActivityManager:I #{@spec[:name]}:D " +
|
data/lib/pindah_cli.rb
CHANGED
@@ -4,12 +4,13 @@ require 'erb'
|
|
4
4
|
module PindahCLI
|
5
5
|
DEFAULT_TARGET_VERSION = '2.1'
|
6
6
|
|
7
|
-
def self.create(package, location=nil, activity_name=
|
7
|
+
def self.create(package, location=nil, activity_name=nil)
|
8
8
|
segments = package.split('.')
|
9
9
|
location ||= segments.last
|
10
10
|
src_dir = File.join(location, 'src', *segments)
|
11
11
|
|
12
12
|
mkdir location, File.join('src', *segments)
|
13
|
+
mkdir location, 'bin'
|
13
14
|
mkdir location, 'libs'
|
14
15
|
mkdir location, 'res'
|
15
16
|
mkdir location, 'res/drawable-hdpi'
|
@@ -38,18 +39,22 @@ module PindahCLI
|
|
38
39
|
|
39
40
|
log "Created project in #{location}."
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
if activity_name
|
43
|
+
activity_location = File.join(src_dir, "#{activity_name}.mirah")
|
44
|
+
activity_template = File.read(File.join(File.dirname(__FILE__),
|
45
|
+
'..', 'templates',
|
46
|
+
'initial_activity.mirah'))
|
45
47
|
|
46
|
-
|
47
|
-
|
48
|
+
File.open(activity_location, 'w') do |f|
|
49
|
+
template_with_classname = activity_template.gsub(/INITIAL_ACTIVITY/, activity_name)
|
50
|
+
f.puts ERB.new(template_with_classname).result(binding)
|
51
|
+
end
|
52
|
+
log "Created Activity '#{activity_name}' in '#{activity_location}'."
|
48
53
|
end
|
49
|
-
log "Created Activity '#{activity_name}' in '#{activity_location}'."
|
50
54
|
end
|
51
55
|
|
52
56
|
private
|
57
|
+
|
53
58
|
def self.log(msg)
|
54
59
|
STDERR.puts msg
|
55
60
|
end
|
@@ -5,7 +5,7 @@
|
|
5
5
|
android:versionName="1.0">
|
6
6
|
<application android:label="@string/app_name"
|
7
7
|
android:debuggable="true"
|
8
|
-
android:icon="@drawable/ic_launcher"
|
8
|
+
android:icon="@drawable/ic_launcher">
|
9
9
|
<% if activity_name %>
|
10
10
|
<activity android:name="<%= activity_name %>"
|
11
11
|
android:label="@string/app_name">
|
data/templates/build.xml
CHANGED
@@ -20,14 +20,8 @@
|
|
20
20
|
|
21
21
|
<target name="compile" depends="-resource-src, -aidl, javac"
|
22
22
|
description="Compiles project's .mirah files into .class files">
|
23
|
-
|
24
|
-
|
25
|
-
classpath="${classpath}" /> -->
|
26
|
-
<exec executable="mirahc" dir="src" failonerror="true">
|
27
|
-
<arg line="-c ${classpath}" />
|
28
|
-
<arg line="-d ${classes}" />
|
29
|
-
<arg value="." />
|
30
|
-
</exec>
|
23
|
+
<mirahc src="${src}" destdir="${classes}"
|
24
|
+
classpath="${classpath}" />
|
31
25
|
</target>
|
32
26
|
|
33
27
|
<setup />
|
metadata
CHANGED
@@ -1,96 +1,117 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pindah
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 25
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
|
-
|
13
|
+
- Phil Hagelberg
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date: 2011-02
|
18
|
+
date: 2011-04-02 00:00:00 -07:00
|
14
19
|
default_executable:
|
15
20
|
dependencies:
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: mirah
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 21
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 0
|
33
|
+
- 5
|
34
|
+
version: 0.0.5
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: hoe
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 47
|
46
|
+
segments:
|
47
|
+
- 2
|
48
|
+
- 8
|
49
|
+
- 0
|
50
|
+
version: 2.8.0
|
51
|
+
type: :development
|
52
|
+
version_requirements: *id002
|
38
53
|
description: ""
|
39
54
|
email:
|
40
|
-
|
55
|
+
- technomancy@gmail.com
|
41
56
|
executables:
|
42
|
-
|
57
|
+
- pindah
|
43
58
|
extensions: []
|
44
59
|
|
45
60
|
extra_rdoc_files:
|
46
|
-
|
47
|
-
|
61
|
+
- History.txt
|
62
|
+
- Manifest.txt
|
48
63
|
files:
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
64
|
+
- History.txt
|
65
|
+
- Manifest.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- bin/pindah
|
69
|
+
- lib/pindah.rb
|
70
|
+
- lib/pindah_cli.rb
|
71
|
+
- templates/AndroidManifest.xml
|
72
|
+
- templates/build.xml
|
73
|
+
- templates/main.xml
|
74
|
+
- templates/strings.xml
|
75
|
+
- templates/Rakefile
|
76
|
+
- templates/initial_activity.mirah
|
77
|
+
- templates/.gitignore
|
78
|
+
- templates/res/drawable-mdpi/ic_launcher.png
|
79
|
+
- templates/res/drawable-hdpi/ic_launcher.png
|
80
|
+
- templates/res/drawable-ldpi/ic_launcher.png
|
81
|
+
- test/fixtures/HelloWorld.mirah
|
82
|
+
- test/pindah_cli_test.rb
|
68
83
|
has_rdoc: true
|
69
84
|
homepage: http://github.com/mirah/pindah
|
70
85
|
licenses: []
|
71
86
|
|
72
87
|
post_install_message:
|
73
88
|
rdoc_options:
|
74
|
-
|
75
|
-
|
89
|
+
- --main
|
90
|
+
- README.md
|
76
91
|
require_paths:
|
77
|
-
|
92
|
+
- lib
|
78
93
|
required_ruby_version: !ruby/object:Gem::Requirement
|
79
94
|
none: false
|
80
95
|
requirements:
|
81
|
-
|
82
|
-
|
83
|
-
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
hash: 3
|
99
|
+
segments:
|
100
|
+
- 0
|
101
|
+
version: "0"
|
84
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
103
|
none: false
|
86
104
|
requirements:
|
87
|
-
|
88
|
-
|
89
|
-
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
hash: 3
|
108
|
+
segments:
|
109
|
+
- 0
|
110
|
+
version: "0"
|
90
111
|
requirements: []
|
91
112
|
|
92
113
|
rubyforge_project: pindah
|
93
|
-
rubygems_version: 1.
|
114
|
+
rubygems_version: 1.3.7
|
94
115
|
signing_key:
|
95
116
|
specification_version: 3
|
96
117
|
summary: A tool for writing Android applications in Mirah
|