filament 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 (56) hide show
  1. data/README +7 -0
  2. data/bin/filament +11 -0
  3. data/bin/filament-dbg +3 -0
  4. data/bin/filament-opt +3 -0
  5. data/bin/filament-test +3 -0
  6. data/bin/init +4 -0
  7. data/lib/filament/artifact.rb +49 -0
  8. data/lib/filament/context.rb +46 -0
  9. data/lib/filament/package/svn.rb +123 -0
  10. data/lib/filament/package.rb +326 -0
  11. data/lib/filament/platform.rb +79 -0
  12. data/lib/filament/plugins.rb +32 -0
  13. data/lib/filament/resolver.rb +91 -0
  14. data/lib/filament/target.rb +117 -0
  15. data/lib/filament/util/filelist2.rb +39 -0
  16. data/lib/filament/util/fileutils.rb +51 -0
  17. data/lib/filament/util/lazy_list.rb +74 -0
  18. data/lib/filament/workspace.rb +57 -0
  19. data/lib/filament.rb +199 -0
  20. data/lib/inflector.rb +124 -0
  21. data/lib/svn.rb +78 -0
  22. data/plugins/00util/lib/init.rb +47 -0
  23. data/plugins/01java/lib/filament/java/mixins/java_mixin.rb +19 -0
  24. data/plugins/01java/lib/filament/java/tools/compile.rb +41 -0
  25. data/plugins/01java/lib/filament/java/tools/execute.rb +37 -0
  26. data/plugins/01java/lib/filament/java/tools/jar.rb +59 -0
  27. data/plugins/01java/lib/filament/java/tools.rb +28 -0
  28. data/plugins/01java/lib/init.rb +1 -0
  29. data/plugins/02javame/lib/filament/javame/library.rb +16 -0
  30. data/plugins/02javame/lib/filament/javame/mixins/library_mixin.rb +144 -0
  31. data/plugins/02javame/lib/filament/javame/mixins/suite_mixin.rb +125 -0
  32. data/plugins/02javame/lib/filament/javame/platform.rb +105 -0
  33. data/plugins/02javame/lib/filament/javame/suite.rb +16 -0
  34. data/plugins/02javame/lib/filament/javame/tasks.rb +6 -0
  35. data/plugins/02javame/lib/filament/javame/tools/descriptor.rb +146 -0
  36. data/plugins/02javame/lib/filament/javame/tools/emulator.rb +36 -0
  37. data/plugins/02javame/lib/filament/javame/tools/external/mpp_sdk.rb +39 -0
  38. data/plugins/02javame/lib/filament/javame/tools/external/wtk.rb +60 -0
  39. data/plugins/02javame/lib/filament/javame/tools/preverifier.rb +43 -0
  40. data/plugins/02javame/lib/filament/javame/tools.rb +8 -0
  41. data/plugins/02javame/lib/init.rb +27 -0
  42. data/plugins/05push/lib/bluetooth.rb +66 -0
  43. data/plugins/05push/lib/filament/push/conduits/bluetooth_conduit.rb +25 -0
  44. data/plugins/05push/lib/filament/push/conduits/filter_conduit.rb +20 -0
  45. data/plugins/05push/lib/filament/push/conduits/scp_conduit.rb +35 -0
  46. data/plugins/05push/lib/filament/push.rb +21 -0
  47. data/plugins/05push/lib/init.rb +29 -0
  48. data/tests/build/artifact_name_test.rb +85 -0
  49. data/tests/build/artifact_test.rb +23 -0
  50. data/tests/gen/java/block_test.rb +42 -0
  51. data/tests/gen/java/callable_test.rb +23 -0
  52. data/tests/gen/java/method_test.rb +25 -0
  53. data/tests/gen/java/statement_test.rb +16 -0
  54. data/tests/java/tools_test.rb +8 -0
  55. data/tests/platform_test.rb +25 -0
  56. metadata +135 -0
@@ -0,0 +1,25 @@
1
+ require 'bluetooth'
2
+
3
+ module Filament::Push::Conduits
4
+ class BluetoothConduit < BaseConduit
5
+ def initialize(h = {})
6
+ @bluetooth_device = h[:device]
7
+ @bluetooth_channel = h[:channel]
8
+ end
9
+
10
+ def push_files(files)
11
+ bt = Bluetooth.get_adapter
12
+ files.each do |file|
13
+ bt.push_file(
14
+ :file => file,
15
+ :device => @bluetooth_device,
16
+ :channel => @bluetooth_channel)
17
+ end
18
+ end
19
+ end
20
+ end
21
+
22
+ if __FILE__ == $0
23
+ files = STDIN.readlines.collect {|line| line.strip}
24
+ Build::Push::Conduits::BluetoothConduit.new.push_files(files)
25
+ end
@@ -0,0 +1,20 @@
1
+
2
+ module Filament::Push::Conduits
3
+ class FilterConduit < BaseConduit
4
+ def initialize(filter = nil)
5
+ @filter = filter || ENV['PUSH_FILTER']
6
+
7
+ raise "@filter must be set" if @filter.nil?
8
+ end
9
+
10
+ def push_files(files)
11
+ push_stream = IO.popen(@filter, 'w')
12
+
13
+ files.each do |file|
14
+ push_stream.puts file
15
+ end
16
+
17
+ push_stream.close
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,35 @@
1
+
2
+ module Filament::Push::Conduits
3
+ class ScpConduit < BaseConduit
4
+ def initialize
5
+ @deploy_host = ENV['DEPLOY_HOST']
6
+ @deploy_dir = ENV['DEPLOY_DIR']
7
+
8
+ raise "DEPLOY_HOST must be set" if @deploy_host.nil?
9
+ raise "DEPLOY_DIR must be set" if @deploy_dir.nil?
10
+ end
11
+
12
+ def push_targets(targets)
13
+ targets.each do |target|
14
+ package = target.package
15
+
16
+ package_base_dir = "#{package.path}"
17
+ package_dir = "#{package_base_dir}/#{package.revision}/#{$target_platform}"
18
+ target_dir = "#{@deploy_host}:#{@deploy_dir}/#{package_dir}"
19
+
20
+ puts ">>> Creating directory for #{target.uri} (#{target_dir})"
21
+ unless system("ssh #{@deploy_host} 'cd #{@deploy_dir} && mkdir -p #{package_dir}'")
22
+ raise "error creating directory #{target_dir}"
23
+ end
24
+
25
+ puts ">>> Copying #{target.uri} to #{target_dir} ..."
26
+ target.deployables.each do |deployable|
27
+ system("scp #{deployable} #{target_dir}/")
28
+ end
29
+
30
+ puts ">>> Updating current symlink to #{package_dir}"
31
+ system("ssh #{@deploy_host} 'cd #{@deploy_dir}/#{package_base_dir} && rm -f current && ln -s #{package.revision} current'")
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,21 @@
1
+
2
+ module Filament::Push
3
+ module Conduits
4
+ class BaseConduit
5
+ def push_targets(targets)
6
+ files = []
7
+ targets.each do |target|
8
+ target.deployables.each do |deployable|
9
+ files << deployable
10
+ end
11
+ end
12
+
13
+ push_files(files)
14
+ end
15
+
16
+ def push_files(files)
17
+ raise "push_files must be overridden"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,29 @@
1
+ require 'pathname'
2
+
3
+ module Filament::Push
4
+ HOME = Pathname.new(__FILE__).parent.parent.realpath
5
+ end
6
+
7
+ require 'filament/push'
8
+
9
+ require 'filament/push/conduits/bluetooth_conduit'
10
+ require 'filament/push/conduits/scp_conduit'
11
+ require 'filament/push/conduits/filter_conduit'
12
+
13
+ module Filament::Push::Conduits
14
+ Application::TARGET_ACTIONS[:push] = Proc.new { |targets|
15
+ push_conduit = ENV['PUSH_CONDUIT'] || :Filter
16
+
17
+ targets.each do |target|
18
+ target.build
19
+ end
20
+
21
+ klass = eval(push_conduit.to_s + 'Conduit')
22
+ conduit = klass.new
23
+
24
+ conduit.push_targets(targets)
25
+ }
26
+ end
27
+
28
+
29
+
@@ -0,0 +1,85 @@
1
+ require 'test/unit'
2
+
3
+ require 'build/artifact_lib'
4
+
5
+ class ArtifactNameTest < Test::Unit::TestCase
6
+ def test_parse
7
+ bad_an = [nil,
8
+ '',
9
+ 'blah',
10
+ ':target',
11
+ 'package:target']
12
+
13
+ bad_an.each do |an|
14
+ assert_nil(Build::ArtifactName.parse(an))
15
+ end
16
+
17
+ good_an = [['//package', 'package', 'package'],
18
+ ['//package/sub_package', 'package/sub_package', 'sub_package'],
19
+ ['//package/sub_package:target', 'package/sub_package', 'target'],
20
+ ['//package:target', 'package', 'target'],
21
+ ['//j2me_util', 'j2me_util', 'j2me_util']]
22
+
23
+ good_an.each do |an, pn, tn|
24
+ a = Build::ArtifactName.parse(an)
25
+ assert_not_nil(a, "'#{an}' should not parse to nil")
26
+ assert_equal(pn, a.package)
27
+ assert_equal(tn, a.target)
28
+ end
29
+ end
30
+
31
+ def test_target_name
32
+ bad_tn = [nil,
33
+ '',
34
+ 'blah',
35
+ '//package']
36
+ bad_tn.each do |tn|
37
+ assert_equal(false,
38
+ Build::ArtifactName.target_name?(tn),
39
+ "'#{tn}' should not be a valid target name.")
40
+ end
41
+
42
+ good_tn = [':target']
43
+ good_tn.each do |tn|
44
+ assert(Build::ArtifactName.target_name?(tn),
45
+ "'#{tn}' should be a valid target name.")
46
+ end
47
+ end
48
+
49
+ def test_package_name
50
+ bad_pn = [nil,
51
+ '',
52
+ 'blah',
53
+ ':target',
54
+ '//package:target']
55
+ bad_pn.each do |pn|
56
+ assert_equal(false,
57
+ Build::ArtifactName.package_name?(pn),
58
+ "'#{pn}' should not be a valid package name.")
59
+ end
60
+
61
+ good_pn = ['//package',
62
+ '//package/sub_package']
63
+
64
+ good_pn.each do |pn|
65
+ assert(Build::ArtifactName.package_name?(pn),
66
+ "'#{pn}' should be a valid package name.")
67
+ end
68
+ end
69
+
70
+ def test_strip
71
+ stripped = [['package', '//package'],
72
+ ['package/sub_package', '//package/sub_package'],
73
+ ['target', ':target'],
74
+ ['blah', 'blah'],
75
+ ['//package:target', '//package:target']]
76
+
77
+ stripped.each do |val, arg|
78
+ assert_equal(val, Build::ArtifactName.strip(arg))
79
+ end
80
+ end
81
+
82
+ def test_fetch
83
+ an = Build::ArtifactName.new(:target => 'target', :package => 'package')
84
+ end
85
+ end
@@ -0,0 +1,23 @@
1
+ require 'test/unit'
2
+
3
+ require 'build/artifact'
4
+
5
+ class ArtifactTest < Test::Unit::TestCase
6
+ def test_flatten_deps
7
+ a1 = Build::Artifact.define_artifact(:a1, :p)
8
+ a2 = Build::Artifact.define_artifact(:a2, :p)
9
+ b1 = Build::Artifact.define_artifact(:b1, :p, ['//p:a1'])
10
+ b2 = Build::Artifact.define_artifact(:b2, :p, ['//p:a1', '//p:a2'])
11
+ c = Build::Artifact.define_artifact(:a1, :p, ['//p:b1', '//p:b2'])
12
+
13
+ all_deps = Build::Artifact.flatten_deps(c).collect do |artifact|
14
+ artifact.name.to_s
15
+ end
16
+ all_deps.sort!
17
+
18
+ answer = ['//p:a1', '//p:a2', '//p:b1', '//p:b2']
19
+ answer.sort!
20
+
21
+ assert_equal(answer, all_deps)
22
+ end
23
+ end
@@ -0,0 +1,42 @@
1
+ require 'test/unit'
2
+
3
+ require 'gen/java/block'
4
+
5
+ class JavaBlockTest < Test::Unit::TestCase
6
+ include Gen::Java
7
+
8
+ STATEMENTS = ['int a = 0;',
9
+ 'int b = a + 2;',
10
+ '//start',
11
+ 'System.out.println(b);',
12
+ '//end']
13
+
14
+ def test_append
15
+ jb = JavaBlock.new
16
+ STATEMENTS.each do |s|
17
+ jb << s
18
+ end
19
+
20
+ assert_equal(STATEMENTS,
21
+ jb.statements)
22
+ end
23
+
24
+ def test_parse
25
+ text = ""
26
+ STATEMENTS.each do |s|
27
+ text << s << "\n"
28
+ end
29
+
30
+ assert_equal(STATEMENTS,
31
+ JavaBlock.parse(text).statements)
32
+ end
33
+
34
+ def test_to_s
35
+ j = ['a = b;',
36
+ 'b = c;']
37
+
38
+ s = "{\n a = b;\n b = c;\n }"
39
+ assert_equal(s,
40
+ JavaBlock.new(:statements => j).to_s(1))
41
+ end
42
+ end
@@ -0,0 +1,23 @@
1
+ require 'test/unit'
2
+
3
+ require 'gen/java/variable'
4
+ require 'gen/java/callable'
5
+
6
+ class JavaCallableTest < Test::Unit::TestCase
7
+ include Gen::Java
8
+
9
+ def test_to_s
10
+ jb = JavaBlock.new(:indent => 1,
11
+ :statements => ['a = b;',
12
+ 'b = c;'])
13
+ a = JavaVariable.new(:int, :a)
14
+ b = JavaVariable.new(:String, :b)
15
+
16
+ s = "callable(int a, String b) {\n a = b;\n b = c;\n }"
17
+
18
+ assert_equal(s,
19
+ JavaCallable.new(:name => :callable,
20
+ :params => [a, b],
21
+ :block => jb).to_s(1))
22
+ end
23
+ end
@@ -0,0 +1,25 @@
1
+ require 'test/unit'
2
+
3
+ require 'gen/java/method'
4
+
5
+ class JavaMethodTest < Test::Unit::TestCase
6
+ include Gen::Java
7
+
8
+ def test_to_s
9
+ jb = JavaBlock.new(:indent => 1,
10
+ :statements => ['a = b;',
11
+ 'b = c;'])
12
+ a = JavaVariable.new(:int, :a)
13
+ b = JavaVariable.new(:String, :b)
14
+
15
+ s = "private int callable(int a, String b) {\n a = b;\n b = c;\n}"
16
+
17
+ assert_equal(s,
18
+ JavaMethod.new(:type => :int,
19
+ :visibility => :private,
20
+ :name => :callable,
21
+ :params => [a, b],
22
+ :block => jb).to_s)
23
+
24
+ end
25
+ end
@@ -0,0 +1,16 @@
1
+ require 'test/unit'
2
+
3
+ require 'gen/java/statement'
4
+
5
+ class JavaStatementTest < Test::Unit::TestCase
6
+ include Gen::Java
7
+
8
+ def test_comment?
9
+ js = JavaStatement.new('a = b;')
10
+
11
+ assert(!js.comment?, "#{js.to_s} should not be considered a comment")
12
+
13
+ js = JavaStatement.new('//asdf')
14
+ assert(js.comment?, "#{js.to_s} should be considered a comment")
15
+ end
16
+ end
@@ -0,0 +1,8 @@
1
+ require 'test/unit'
2
+
3
+ require 'java/tools'
4
+
5
+ class JavaTest < Test::Unit::TestCase
6
+ def test_something
7
+ end
8
+ end
@@ -0,0 +1,25 @@
1
+ require 'test/unit'
2
+
3
+ require 'platform'
4
+
5
+ class PlatformTest < Test::Unit::TestCase
6
+ include Platform
7
+
8
+ def test_to_windows_path
9
+ assert_equal('e:/home/adamb/documents/code',
10
+ to_windows_path('/cygdrive/e/home/adamb/documents/code'))
11
+ end
12
+
13
+ # def test_to_paths
14
+ # a = [['e:/a', 'e:/a/b', 'e:/a/b/c/'],
15
+ # ['/cygdrive/e/a', '/cygdrive/e/a/b', '/cygdrive/e/a/b/c/']]
16
+ #
17
+ # a.each do |ans, q|
18
+ # assert_equal(ans, to_windows_path(q))
19
+ # end
20
+ # end
21
+
22
+ def test_join_paths
23
+ assert_nil(join_paths(nil))
24
+ end
25
+ end
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.8.11
3
+ specification_version: 1
4
+ name: filament
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.1.0
7
+ date: 2006-03-14 00:00:00 -05:00
8
+ summary: A flexible dependency-based build platform based on Rake
9
+ require_paths:
10
+ - lib
11
+ email: ajb@rubyforge.org
12
+ homepage: http://filament.rubyforge.org
13
+ rubyforge_project: filament
14
+ description:
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ authors:
29
+ - Adam Bouhenguel
30
+ files:
31
+ - bin/filament
32
+ - bin/filament-dbg
33
+ - bin/filament-opt
34
+ - bin/filament-test
35
+ - bin/init
36
+ - tests/build
37
+ - tests/gen
38
+ - tests/java
39
+ - tests/platform_test.rb
40
+ - tests/root
41
+ - tests/build/artifact_name_test.rb
42
+ - tests/build/artifact_test.rb
43
+ - tests/gen/java
44
+ - tests/gen/java/block_test.rb
45
+ - tests/gen/java/callable_test.rb
46
+ - tests/gen/java/method_test.rb
47
+ - tests/gen/java/statement_test.rb
48
+ - tests/java/tools_test.rb
49
+ - lib/filament
50
+ - lib/filament.rb
51
+ - lib/inflector.rb
52
+ - lib/svn.rb
53
+ - lib/filament/artifact.rb
54
+ - lib/filament/context.rb
55
+ - lib/filament/package
56
+ - lib/filament/package.rb
57
+ - lib/filament/platform.rb
58
+ - lib/filament/plugins.rb
59
+ - lib/filament/resolver.rb
60
+ - lib/filament/target.rb
61
+ - lib/filament/util
62
+ - lib/filament/workspace.rb
63
+ - lib/filament/package/svn.rb
64
+ - lib/filament/util/filelist2.rb
65
+ - lib/filament/util/fileutils.rb
66
+ - lib/filament/util/lazy_list.rb
67
+ - plugins/00util
68
+ - plugins/01java
69
+ - plugins/02javame
70
+ - plugins/05push
71
+ - plugins/00util/lib
72
+ - plugins/00util/lib/init.rb
73
+ - plugins/01java/lib
74
+ - plugins/01java/lib/filament
75
+ - plugins/01java/lib/init.rb
76
+ - plugins/01java/lib/filament/java
77
+ - plugins/01java/lib/filament/java/mixins
78
+ - plugins/01java/lib/filament/java/tools
79
+ - plugins/01java/lib/filament/java/tools.rb
80
+ - plugins/01java/lib/filament/java/mixins/java_mixin.rb
81
+ - plugins/01java/lib/filament/java/tools/compile.rb
82
+ - plugins/01java/lib/filament/java/tools/execute.rb
83
+ - plugins/01java/lib/filament/java/tools/jar.rb
84
+ - plugins/02javame/lib
85
+ - plugins/02javame/lib/filament
86
+ - plugins/02javame/lib/init.rb
87
+ - plugins/02javame/lib/filament/javame
88
+ - plugins/02javame/lib/filament/javame/library.rb
89
+ - plugins/02javame/lib/filament/javame/mixins
90
+ - plugins/02javame/lib/filament/javame/platform.rb
91
+ - plugins/02javame/lib/filament/javame/suite.rb
92
+ - plugins/02javame/lib/filament/javame/tasks.rb
93
+ - plugins/02javame/lib/filament/javame/tools
94
+ - plugins/02javame/lib/filament/javame/tools.rb
95
+ - plugins/02javame/lib/filament/javame/mixins/library_mixin.rb
96
+ - plugins/02javame/lib/filament/javame/mixins/suite_mixin.rb
97
+ - plugins/02javame/lib/filament/javame/tools/descriptor.rb
98
+ - plugins/02javame/lib/filament/javame/tools/emulator.rb
99
+ - plugins/02javame/lib/filament/javame/tools/external
100
+ - plugins/02javame/lib/filament/javame/tools/preverifier.rb
101
+ - plugins/02javame/lib/filament/javame/tools/external/mpp_sdk.rb
102
+ - plugins/02javame/lib/filament/javame/tools/external/wtk.rb
103
+ - plugins/05push/lib
104
+ - plugins/05push/lib/bluetooth.rb
105
+ - plugins/05push/lib/filament
106
+ - plugins/05push/lib/init.rb
107
+ - plugins/05push/lib/filament/push
108
+ - plugins/05push/lib/filament/push.rb
109
+ - plugins/05push/lib/filament/push/conduits
110
+ - plugins/05push/lib/filament/push/conduits/bluetooth_conduit.rb
111
+ - plugins/05push/lib/filament/push/conduits/filter_conduit.rb
112
+ - plugins/05push/lib/filament/push/conduits/scp_conduit.rb
113
+ - README
114
+ test_files: []
115
+
116
+ rdoc_options: []
117
+
118
+ extra_rdoc_files:
119
+ - README
120
+ executables:
121
+ - filament
122
+ extensions: []
123
+
124
+ requirements: []
125
+
126
+ dependencies:
127
+ - !ruby/object:Gem::Dependency
128
+ name: rake
129
+ version_requirement:
130
+ version_requirements: !ruby/object:Gem::Version::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: 0.7.0
135
+ version: