pindah 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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) installed with bin/ on your
20
- $PATH. If your gem and rake are not from from JRuby, prefix the gem
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
@@ -12,10 +12,11 @@ end
12
12
  require "mirah"
13
13
 
14
14
  module Pindah
15
- VERSION = '0.1.0'
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 -d logcat #{@spec[:log_filter]}"
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 " +
@@ -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="Start")
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
- activity_location = File.join(src_dir, "#{activity_name}.mirah")
42
- activity_template = File.read(File.join(File.dirname(__FILE__),
43
- '..', 'templates',
44
- 'initial_activity.mirah'))
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
- File.open(activity_location, 'w') do |f|
47
- f.puts activity_template.gsub(/INITIAL_ACTIVITY/, activity_name)
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">
@@ -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
- <!-- TODO: mirahc task doesn't infer package correctly.
24
- <mirahc src="${src}" destdir="${classes}"
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 />
@@ -1,7 +1,10 @@
1
+ package <%= package %>
2
+
1
3
  import android.app.Activity
2
4
 
3
5
  class INITIAL_ACTIVITY < Activity
4
6
  def onCreate(state)
5
7
  super state
8
+ setContentView R.layout.main
6
9
  end
7
10
  end
@@ -3,5 +3,6 @@ import android.app.Activity
3
3
  class HelloWorld < Activity
4
4
  def onCreate(state)
5
5
  super state
6
+ setContentView R.layout.main
6
7
  end
7
8
  end
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
- version: 0.1.0
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 1
10
+ version: 0.1.1
6
11
  platform: ruby
7
12
  authors:
8
- - Phil Hagelberg
13
+ - Phil Hagelberg
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2011-02-08 00:00:00 -08:00
18
+ date: 2011-04-02 00:00:00 -07:00
14
19
  default_executable:
15
20
  dependencies:
16
- - !ruby/object:Gem::Dependency
17
- name: mirah
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
20
- none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
24
- version: 0.0.5
25
- type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: hoe
29
- prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
31
- none: false
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
35
- version: 2.8.0
36
- type: :development
37
- version_requirements: *id002
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
- - technomancy@gmail.com
55
+ - technomancy@gmail.com
41
56
  executables:
42
- - pindah
57
+ - pindah
43
58
  extensions: []
44
59
 
45
60
  extra_rdoc_files:
46
- - History.txt
47
- - Manifest.txt
61
+ - History.txt
62
+ - Manifest.txt
48
63
  files:
49
- - History.txt
50
- - Manifest.txt
51
- - README.md
52
- - Rakefile
53
- - bin/pindah
54
- - lib/pindah.rb
55
- - lib/pindah_cli.rb
56
- - templates/AndroidManifest.xml
57
- - templates/build.xml
58
- - templates/main.xml
59
- - templates/strings.xml
60
- - templates/Rakefile
61
- - templates/initial_activity.mirah
62
- - templates/.gitignore
63
- - templates/res/drawable-mdpi/ic_launcher.png
64
- - templates/res/drawable-hdpi/ic_launcher.png
65
- - templates/res/drawable-ldpi/ic_launcher.png
66
- - test/fixtures/HelloWorld.mirah
67
- - test/pindah_cli_test.rb
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
- - --main
75
- - README.md
89
+ - --main
90
+ - README.md
76
91
  require_paths:
77
- - lib
92
+ - lib
78
93
  required_ruby_version: !ruby/object:Gem::Requirement
79
94
  none: false
80
95
  requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: "0"
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
- - !ruby/object:Gem::Version
89
- version: "0"
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.5.0
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