robomake 0.1.0

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.
Files changed (6) hide show
  1. data/Manifest +4 -0
  2. data/README.rdoc +12 -0
  3. data/Rakefile +14 -0
  4. data/bin/robomake +79 -0
  5. data/robomake.gemspec +32 -0
  6. metadata +78 -0
@@ -0,0 +1,4 @@
1
+ Manifest
2
+ README.rdoc
3
+ Rakefile
4
+ bin/robomake
@@ -0,0 +1,12 @@
1
+ = robomake
2
+
3
+ From your Android NDK directory, execute robomake
4
+
5
+ robomake <app-name>
6
+
7
+ It will rebuild your app when a source file change is detected.
8
+
9
+ TODO
10
+
11
+ * Parameterize the file extensions to watch
12
+ * Currently does a build for each source file that changes; need to batch those and build only once.
@@ -0,0 +1,14 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'echoe'
4
+
5
+ Echoe.new('robomake', '0.1.0') do |p|
6
+ p.description = "Automatically build an Android NDK application"
7
+ p.url = "http://github.com/fmedlin/robomake"
8
+ p.author = "Fred Medlin"
9
+ p.email = "fred@medl.in"
10
+ p.ignore_pattern = ["tmp/*", "script/*"]
11
+ p.development_dependencies = []
12
+ end
13
+
14
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
@@ -0,0 +1,79 @@
1
+ #! /usr/bin/ruby
2
+
3
+ require 'rubygems'
4
+ require 'growl'
5
+
6
+ include Growl
7
+
8
+ extensions = ["mk", "cpp", "h"]
9
+
10
+ if ARGV.size < 1
11
+ puts "Usage: robomake.rb <app>"
12
+ exit 1
13
+ end
14
+
15
+ def build(command)
16
+ green_robot = File.dirname(__FILE__) + '/green_robot.png'
17
+ red_robot = File.dirname(__FILE__) + '/red_robot.png'
18
+
19
+ if system(command)
20
+ notify 'NDK build succeeded', :title => 'robomake', :icon => green_robot
21
+ else
22
+ notify 'NDK build failed', :title => 'robomake', :icon => red_robot
23
+ end
24
+ print_separator
25
+ end
26
+
27
+ def print_separator
28
+ puts "============================================="
29
+ end
30
+
31
+ interrupted = false
32
+ trap("INT") { interrupted = true }
33
+
34
+ app = ARGV.shift
35
+ application_mk = "apps/#{app}/Application.mk"
36
+ command = "make APP=#{app}"
37
+
38
+ unless File.exists?(application_mk)
39
+ puts "#{application_mk} does not exist"
40
+ exit 1
41
+ end
42
+
43
+ jni_path = ""
44
+ File.open(application_mk) do |file|
45
+ while (line = file.gets)
46
+ split = line.split(':=')
47
+ if "#{split[0].rstrip}" == "APP_PROJECT_PATH"
48
+ jni_path = split[1].strip << "/jni/**"
49
+ break
50
+ end
51
+ end
52
+ file.close
53
+ end
54
+
55
+ files = {}
56
+ extensions.each { |ext|
57
+ Dir[jni_path + "/*.#{ext}"].each { |file|
58
+ files[file] = File.mtime(file)
59
+ }
60
+ }
61
+
62
+ build(command)
63
+ loop do
64
+ sleep 1
65
+
66
+ if interrupted
67
+ exit
68
+ end
69
+
70
+ changed_file, last_changed = files.find { |file, last_changed|
71
+ File.mtime(file) > last_changed
72
+ }
73
+
74
+ if changed_file
75
+ files[changed_file] = File.mtime(changed_file)
76
+ puts "=> #{changed_file} changed, running #{command}"
77
+ build(command)
78
+ end
79
+ end
@@ -0,0 +1,32 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{robomake}
5
+ s.version = "0.1.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Fred Medlin"]
9
+ s.date = %q{2010-06-03}
10
+ s.default_executable = %q{robomake}
11
+ s.description = %q{Automatically build an Android NDK application}
12
+ s.email = %q{fred@medl.in}
13
+ s.executables = ["robomake"]
14
+ s.extra_rdoc_files = ["README.rdoc", "bin/robomake"]
15
+ s.files = ["Manifest", "README.rdoc", "Rakefile", "bin/robomake", "robomake.gemspec"]
16
+ s.homepage = %q{http://github.com/fmedlin/robomake}
17
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Robomake", "--main", "README.rdoc"]
18
+ s.require_paths = ["lib"]
19
+ s.rubyforge_project = %q{robomake}
20
+ s.rubygems_version = %q{1.3.7}
21
+ s.summary = %q{Automatically build an Android NDK application}
22
+
23
+ if s.respond_to? :specification_version then
24
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
25
+ s.specification_version = 3
26
+
27
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
28
+ else
29
+ end
30
+ else
31
+ end
32
+ end
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: robomake
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Fred Medlin
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-06-03 00:00:00 -04:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: Automatically build an Android NDK application
23
+ email: fred@medl.in
24
+ executables:
25
+ - robomake
26
+ extensions: []
27
+
28
+ extra_rdoc_files:
29
+ - README.rdoc
30
+ - bin/robomake
31
+ files:
32
+ - Manifest
33
+ - README.rdoc
34
+ - Rakefile
35
+ - bin/robomake
36
+ - robomake.gemspec
37
+ has_rdoc: true
38
+ homepage: http://github.com/fmedlin/robomake
39
+ licenses: []
40
+
41
+ post_install_message:
42
+ rdoc_options:
43
+ - --line-numbers
44
+ - --inline-source
45
+ - --title
46
+ - Robomake
47
+ - --main
48
+ - README.rdoc
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ hash: 3
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ hash: 11
66
+ segments:
67
+ - 1
68
+ - 2
69
+ version: "1.2"
70
+ requirements: []
71
+
72
+ rubyforge_project: robomake
73
+ rubygems_version: 1.3.7
74
+ signing_key:
75
+ specification_version: 3
76
+ summary: Automatically build an Android NDK application
77
+ test_files: []
78
+