glimmer 0.8.2 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +116 -95
  4. data/VERSION +1 -1
  5. data/lib/glimmer.rb +0 -20
  6. data/lib/glimmer/config.rb +0 -13
  7. data/lib/glimmer/dsl/engine.rb +25 -18
  8. data/lib/glimmer/dsl/expression.rb +0 -7
  9. data/lib/glimmer/dsl/static_expression.rb +2 -2
  10. metadata +47 -177
  11. data/RUBY_VERSION +0 -1
  12. data/bin/girb +0 -10
  13. data/bin/girb_runner.rb +0 -13
  14. data/bin/glimmer +0 -5
  15. data/icons/scaffold_app.icns +0 -0
  16. data/lib/glimmer/css/rule.rb +0 -25
  17. data/lib/glimmer/css/style_sheet.rb +0 -19
  18. data/lib/glimmer/data_binding/list_selection_binding.rb +0 -52
  19. data/lib/glimmer/data_binding/model_binding.rb +0 -248
  20. data/lib/glimmer/data_binding/observable.rb +0 -21
  21. data/lib/glimmer/data_binding/observable_array.rb +0 -107
  22. data/lib/glimmer/data_binding/observable_model.rb +0 -108
  23. data/lib/glimmer/data_binding/observable_widget.rb +0 -17
  24. data/lib/glimmer/data_binding/observer.rb +0 -124
  25. data/lib/glimmer/data_binding/shine.rb +0 -23
  26. data/lib/glimmer/data_binding/table_items_binding.rb +0 -56
  27. data/lib/glimmer/data_binding/tree_items_binding.rb +0 -71
  28. data/lib/glimmer/data_binding/widget_binding.rb +0 -33
  29. data/lib/glimmer/dsl/css/css_expression.rb +0 -21
  30. data/lib/glimmer/dsl/css/dsl.rb +0 -10
  31. data/lib/glimmer/dsl/css/dynamic_property_expression.rb +0 -12
  32. data/lib/glimmer/dsl/css/property_expression.rb +0 -22
  33. data/lib/glimmer/dsl/css/pv_expression.rb +0 -17
  34. data/lib/glimmer/dsl/css/rule_expression.rb +0 -25
  35. data/lib/glimmer/dsl/css/s_expression.rb +0 -26
  36. data/lib/glimmer/dsl/swt/async_exec_expression.rb +0 -14
  37. data/lib/glimmer/dsl/swt/bind_expression.rb +0 -37
  38. data/lib/glimmer/dsl/swt/color_expression.rb +0 -19
  39. data/lib/glimmer/dsl/swt/column_properties_expression.rb +0 -24
  40. data/lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb +0 -42
  41. data/lib/glimmer/dsl/swt/custom_widget_expression.rb +0 -36
  42. data/lib/glimmer/dsl/swt/data_binding_expression.rb +0 -34
  43. data/lib/glimmer/dsl/swt/dialog_expression.rb +0 -26
  44. data/lib/glimmer/dsl/swt/display_expression.rb +0 -19
  45. data/lib/glimmer/dsl/swt/dsl.rb +0 -28
  46. data/lib/glimmer/dsl/swt/exec_expression.rb +0 -28
  47. data/lib/glimmer/dsl/swt/layout_data_expression.rb +0 -25
  48. data/lib/glimmer/dsl/swt/layout_expression.rb +0 -27
  49. data/lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb +0 -44
  50. data/lib/glimmer/dsl/swt/menu_bar_expression.rb +0 -33
  51. data/lib/glimmer/dsl/swt/menu_expression.rb +0 -32
  52. data/lib/glimmer/dsl/swt/message_box_expression.rb +0 -29
  53. data/lib/glimmer/dsl/swt/observe_expression.rb +0 -32
  54. data/lib/glimmer/dsl/swt/property_expression.rb +0 -22
  55. data/lib/glimmer/dsl/swt/rgb_expression.rb +0 -12
  56. data/lib/glimmer/dsl/swt/rgba_expression.rb +0 -12
  57. data/lib/glimmer/dsl/swt/shell_expression.rb +0 -25
  58. data/lib/glimmer/dsl/swt/swt_expression.rb +0 -25
  59. data/lib/glimmer/dsl/swt/sync_exec_expression.rb +0 -15
  60. data/lib/glimmer/dsl/swt/tab_item_expression.rb +0 -33
  61. data/lib/glimmer/dsl/swt/table_items_data_binding_expression.rb +0 -31
  62. data/lib/glimmer/dsl/swt/tree_items_data_binding_expression.rb +0 -31
  63. data/lib/glimmer/dsl/swt/tree_properties_expression.rb +0 -26
  64. data/lib/glimmer/dsl/swt/widget_expression.rb +0 -35
  65. data/lib/glimmer/dsl/swt/widget_listener_expression.rb +0 -32
  66. data/lib/glimmer/dsl/xml/dsl.rb +0 -11
  67. data/lib/glimmer/dsl/xml/html_expression.rb +0 -25
  68. data/lib/glimmer/dsl/xml/meta_expression.rb +0 -23
  69. data/lib/glimmer/dsl/xml/name_space_expression.rb +0 -37
  70. data/lib/glimmer/dsl/xml/node_parent_expression.rb +0 -33
  71. data/lib/glimmer/dsl/xml/tag_expression.rb +0 -29
  72. data/lib/glimmer/dsl/xml/text_expression.rb +0 -22
  73. data/lib/glimmer/dsl/xml/xml_expression.rb +0 -21
  74. data/lib/glimmer/launcher.rb +0 -199
  75. data/lib/glimmer/package.rb +0 -55
  76. data/lib/glimmer/rake_task.rb +0 -58
  77. data/lib/glimmer/scaffold.rb +0 -582
  78. data/lib/glimmer/swt/color_proxy.rb +0 -53
  79. data/lib/glimmer/swt/display_proxy.rb +0 -88
  80. data/lib/glimmer/swt/font_proxy.rb +0 -72
  81. data/lib/glimmer/swt/layout_data_proxy.rb +0 -84
  82. data/lib/glimmer/swt/layout_proxy.rb +0 -82
  83. data/lib/glimmer/swt/menu_proxy.rb +0 -101
  84. data/lib/glimmer/swt/message_box_proxy.rb +0 -48
  85. data/lib/glimmer/swt/packages.rb +0 -13
  86. data/lib/glimmer/swt/shell_proxy.rb +0 -152
  87. data/lib/glimmer/swt/swt_proxy.rb +0 -106
  88. data/lib/glimmer/swt/tab_item_proxy.rb +0 -65
  89. data/lib/glimmer/swt/table_proxy.rb +0 -150
  90. data/lib/glimmer/swt/tree_proxy.rb +0 -120
  91. data/lib/glimmer/swt/widget_listener_proxy.rb +0 -34
  92. data/lib/glimmer/swt/widget_proxy.rb +0 -489
  93. data/lib/glimmer/ui/custom_shell.rb +0 -45
  94. data/lib/glimmer/ui/custom_widget.rb +0 -244
  95. data/lib/glimmer/util/proc_tracker.rb +0 -16
  96. data/lib/glimmer/xml/depth_first_search_iterator.rb +0 -22
  97. data/lib/glimmer/xml/name_space_visitor.rb +0 -21
  98. data/lib/glimmer/xml/node.rb +0 -75
  99. data/lib/glimmer/xml/node_visitor.rb +0 -13
  100. data/lib/glimmer/xml/xml_visitor.rb +0 -65
  101. data/vendor/swt/linux/swt.jar +0 -0
  102. data/vendor/swt/mac/swt.jar +0 -0
  103. data/vendor/swt/windows/swt.jar +0 -0
@@ -1,11 +0,0 @@
1
- require 'glimmer/dsl/engine'
2
- Dir[File.expand_path('../*_expression.rb', __FILE__)].each {|f| require f}
3
-
4
- Glimmer::DSL::Engine.add_dynamic_expressions(
5
- Glimmer::DSL::XML,
6
- %w[
7
- text
8
- tag
9
- xml
10
- ]
11
- )
@@ -1,25 +0,0 @@
1
- require 'glimmer/dsl/xml/node_parent_expression'
2
- require 'glimmer/dsl/xml/xml_expression'
3
- require 'glimmer/dsl/static_expression'
4
- require 'glimmer/dsl/top_level_expression'
5
-
6
- module Glimmer
7
- module DSL
8
- module XML
9
- # This static html expression flips the DSL switch on for
10
- # XML DSL in Glimmer
11
- class HtmlExpression < StaticExpression
12
- include TopLevelExpression
13
- include NodeParentExpression
14
-
15
- def interpret(parent, keyword, *args, &block)
16
- xml_expression.interpret(parent, keyword, *args, &block)
17
- end
18
-
19
- def xml_expression
20
- @xml_expression ||= XmlExpression.new
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,23 +0,0 @@
1
- require 'glimmer/dsl/xml/node_parent_expression'
2
- require 'glimmer/dsl/xml/xml_expression'
3
- require 'glimmer/dsl/static_expression'
4
-
5
- module Glimmer
6
- module DSL
7
- module XML
8
- # This static html expression flips the DSL switch on for
9
- # XML DSL in Glimmer
10
- class MetaExpression < StaticExpression
11
- include NodeParentExpression
12
-
13
- def interpret(parent, keyword, *args, &block)
14
- xml_expression.interpret(parent, keyword, *args, &block)
15
- end
16
-
17
- def xml_expression
18
- @xml_expression ||= XmlExpression.new
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,37 +0,0 @@
1
- require 'glimmer/dsl/static_expression'
2
- require 'glimmer/dsl/top_level_expression'
3
- require 'glimmer/xml/node'
4
- require 'glimmer/xml/depth_first_search_iterator'
5
- require 'glimmer/xml/name_space_visitor'
6
-
7
- module Glimmer
8
- module DSL
9
- module XML
10
- class NameSpaceExpression < StaticExpression
11
- include TopLevelExpression
12
-
13
- def can_interpret?(parent, keyword, *args, &block)
14
- (parent == nil or parent.is_a?(Glimmer::XML::Node)) and
15
- (keyword.to_s == "name_space")
16
- (args.size == 1) and
17
- (args[0].is_a?(Symbol)) and
18
- block
19
- end
20
-
21
- def interpret(parent, keyword, *args, &block)
22
- node = block.call
23
- unless node.is_a?(String)
24
- name_space_visitor = Glimmer::XML::NameSpaceVisitor.new(args[0].to_s)
25
- Glimmer::XML::DepthFirstSearchIterator.new(node, name_space_visitor).iterate
26
- def node.process_block(block)
27
- Glimmer::Config.logger&.debug 'block'
28
- #NOOP
29
- end
30
- end
31
- parent.children << node if parent and !parent.children.include?(node)
32
- node
33
- end
34
- end
35
- end
36
- end
37
- end
@@ -1,33 +0,0 @@
1
- require 'glimmer'
2
- require 'glimmer/dsl/parent_expression'
3
- require 'glimmer/xml/node'
4
-
5
- module Glimmer
6
- module DSL
7
- module XML
8
- module NodeParentExpression
9
- include ParentExpression
10
- include Glimmer
11
-
12
- def add_content(parent, &block)
13
- return_value = block.call(parent)
14
- if !return_value.is_a?(Glimmer::XML::Node) and !parent.children.include?(return_value)
15
- text = return_value.to_s
16
- first_match = text.match(/[#][^{]+[{][^}]+[}]/)
17
- match = first_match
18
- while (match)
19
- instance_eval(parent.text_command(match.pre_match))
20
- tag_text = match.to_s
21
- instance_eval(parent.rubyize(tag_text))
22
- text = tag_text
23
- post_match = match.post_match
24
- match = text.match(/[#]\w+[{]\w+[}]/)
25
- end
26
- instance_eval(parent.text_command(post_match)) if post_match
27
- parent.children << return_value unless first_match
28
- end
29
- end
30
- end
31
- end
32
- end
33
- end
@@ -1,29 +0,0 @@
1
- require 'glimmer/dsl/xml/node_parent_expression'
2
- require 'glimmer/dsl/xml/xml_expression'
3
- require 'glimmer/dsl/static_expression'
4
- require 'glimmer/dsl/top_level_expression'
5
- require 'glimmer/xml/node'
6
-
7
- module Glimmer
8
- module DSL
9
- module XML
10
- class TagExpression < StaticExpression
11
- include TopLevelExpression
12
- include NodeParentExpression
13
-
14
- def can_interpret?(parent, keyword, *args, &block)
15
- (parent == nil or parent.is_a?(Glimmer::XML::Node)) and
16
- (keyword.to_s == "tag") and
17
- args[0].include?(:_name)
18
- end
19
-
20
- def interpret(parent, keyword, *args, &block)
21
- attributes = args[0] if (args.size == 1)
22
- tag_name = attributes[:_name]
23
- attributes.delete(:_name)
24
- Glimmer::XML::Node.new(parent, tag_name, attributes, &block)
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,22 +0,0 @@
1
- require 'glimmer/dsl/static_expression'
2
- require 'glimmer/xml/node'
3
-
4
- module Glimmer
5
- module DSL
6
- module XML
7
- class TextExpression < StaticExpression
8
- def can_interpret?(parent, keyword, *args, &block)
9
- (parent == nil or parent.is_a?(Glimmer::XML::Node)) and
10
- (keyword.to_s == "text") and
11
- (args.size == 1) and
12
- !block
13
- end
14
-
15
- def interpret(parent, keyword, *args, &block)
16
- parent.children << args[0].to_s if parent
17
- args[0].to_s
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,21 +0,0 @@
1
- require 'glimmer/dsl/xml/node_parent_expression'
2
- require 'glimmer/dsl/expression'
3
- require 'glimmer/xml/node'
4
-
5
- module Glimmer
6
- module DSL
7
- module XML
8
- class XmlExpression < Expression
9
- include NodeParentExpression
10
-
11
- def can_interpret?(parent, keyword, *args, &block)
12
- parent.is_a?(Glimmer::XML::Node)
13
- end
14
-
15
- def interpret(parent, keyword, *args, &block)
16
- Glimmer::XML::Node.new(parent, keyword.to_s, args, &block)
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,199 +0,0 @@
1
- require 'os'
2
- require 'rake'
3
-
4
- require_relative 'rake_task'
5
-
6
- module Glimmer
7
- class Launcher
8
- OPERATING_SYSTEMS_SUPPORTED = ["mac", "windows", "linux"]
9
-
10
- TEXT_USAGE_PREFIX = <<~MULTI_LINE_STRING
11
- Usage: glimmer [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
12
-
13
- Runs Glimmer applications/tasks.
14
-
15
- Either a single task or one or more applications may be specified.
16
-
17
- When a task is specified, it runs via rake. Some tasks take arguments in square brackets.
18
-
19
- Available tasks are below (you may also lookup by adding `require 'glimmer/rake_task'` in Rakefile and running rake -T):
20
- MULTI_LINE_STRING
21
-
22
- TEXT_USAGE_SUFFIX = <<~MULTI_LINE_STRING
23
-
24
- When applications are specified, they are run using JRuby,
25
- automatically preloading the glimmer Ruby gem and SWT jar dependency.
26
-
27
- Optionally, extra Glimmer options, JRuby options and environment variables may be passed in.
28
-
29
- Glimmer options:
30
- - "--quiet" : Does not announce file path of Glimmer application being launched
31
- - "--debug" : Displays extra debugging information, passes "--debug" to JRuby, and enables debug logging
32
- - "--log-level=VALUE" : Sets Glimmer's Ruby logger level ("ERROR" / "WARN" / "INFO" / "DEBUG"; default is none)
33
-
34
- Example: glimmer samples/hello_world.rb
35
-
36
- This runs the Glimmer application samples/hello_world.rb
37
- MULTI_LINE_STRING
38
-
39
- GLIMMER_LIB_LOCAL = File.expand_path(File.join(__FILE__, '..', '..', 'glimmer.rb'))
40
- GLIMMER_LIB_GEM = 'glimmer'
41
- GLIMMER_OPTIONS = %w[--log-level --quiet]
42
- GLIMMER_OPTION_ENV_VAR_MAPPING = {
43
- '--log-level' => 'GLIMMER_LOGGER_LEVEL'
44
- }
45
- REGEX_RAKE_TASK_WITH_ARGS = /^([^\[]+)\[?([^\]]*)\]?$/
46
-
47
- @@mutex = Mutex.new
48
-
49
- class << self
50
- def platform_os
51
- OPERATING_SYSTEMS_SUPPORTED.detect {|os| OS.send("#{os}?")}
52
- end
53
-
54
- def swt_jar_file
55
- @swt_jar_file ||= File.expand_path(File.join(__FILE__, '..', '..', '..', 'vendor', 'swt', platform_os, 'swt.jar'))
56
- end
57
-
58
- def jruby_os_specific_options
59
- OS.mac? ? "-J-XstartOnFirstThread" : ""
60
- end
61
-
62
- def jruby_swt_options
63
- "#{jruby_os_specific_options} -J-classpath \"#{swt_jar_file}\""
64
- end
65
-
66
- def glimmer_lib
67
- @@mutex.synchronize do
68
- unless @glimmer_lib
69
- @glimmer_lib = GLIMMER_LIB_GEM
70
- glimmer_gem_listing = `jgem list #{GLIMMER_LIB_GEM}`.split("\n").map {|l| l.split.first}
71
- if !glimmer_gem_listing.include?(GLIMMER_LIB_GEM) && File.exists?(GLIMMER_LIB_LOCAL)
72
- @glimmer_lib = GLIMMER_LIB_LOCAL
73
- puts "[DEVELOPMENT MODE] (detected #{@glimmer_lib})"
74
- end
75
- end
76
- end
77
- @glimmer_lib
78
- end
79
-
80
- def glimmer_option_env_vars(glimmer_options)
81
- GLIMMER_OPTION_ENV_VAR_MAPPING.reduce({}) do |hash, pair|
82
- glimmer_options[pair.first] ? hash.merge(GLIMMER_OPTION_ENV_VAR_MAPPING[pair.first] => glimmer_options[pair.first]) : hash
83
- end
84
- end
85
-
86
- def load_env_vars(env_vars)
87
- env_vars.each do |key, value|
88
- ENV[key] = value
89
- end
90
- end
91
-
92
- def launch(application, jruby_options: [], env_vars: {}, glimmer_options: {})
93
- jruby_options_string = jruby_options.join(' ') + ' ' if jruby_options.any?
94
- env_vars = env_vars.merge(glimmer_option_env_vars(glimmer_options))
95
- env_vars_string = env_vars.map {|k,v| "#{k}=#{v}"}.join(' ')
96
- the_glimmer_lib = glimmer_lib
97
- devmode_require = nil
98
- if the_glimmer_lib == GLIMMER_LIB_LOCAL
99
- devmode_require = '-r puts_debuggerer '
100
- end
101
- rake_tasks = Rake.application.tasks.map(&:to_s).map {|t| t.sub('glimmer:', '')}
102
- potential_rake_task_parts = application.match(REGEX_RAKE_TASK_WITH_ARGS)
103
- application = potential_rake_task_parts[1]
104
- rake_task_args = potential_rake_task_parts[2].split(',')
105
- if rake_tasks.include?(application)
106
- load_env_vars(glimmer_option_env_vars(glimmer_options))
107
- rake_task = "glimmer:#{application}"
108
- puts "Running Glimmer rake task: #{rake_task}" if jruby_options_string.to_s.include?('--debug')
109
- Rake::Task[rake_task].invoke(*rake_task_args)
110
- else
111
- @@mutex.synchronize do
112
- puts "Launching Glimmer Application: #{application}" if jruby_options_string.to_s.include?('--debug') || glimmer_options['--quiet'].to_s.downcase != 'true'
113
- end
114
- command = "#{env_vars_string} jruby #{jruby_options_string}#{jruby_os_specific_options} #{devmode_require}-r #{the_glimmer_lib} -S #{application}"
115
- puts command if jruby_options_string.to_s.include?('--debug')
116
- system command
117
- end
118
- end
119
- end
120
-
121
- attr_reader :application_paths
122
- attr_reader :env_vars
123
- attr_reader :glimmer_options
124
- attr_reader :jruby_options
125
-
126
- def initialize(raw_options)
127
- raw_options << '--quiet' if !caller.join("\n").include?('/bin/glimmer:') && !raw_options.join.include?('--quiet=')
128
- raw_options << '--log-level=DEBUG' if raw_options.join.include?('--debug') && !raw_options.join.include?('--log-level=')
129
- @application_paths = extract_application_paths(raw_options)
130
- @env_vars = extract_env_vars(raw_options)
131
- @glimmer_options = extract_glimmer_options(raw_options)
132
- @jruby_options = raw_options
133
- end
134
-
135
- def launch
136
- if @application_paths.empty?
137
- display_usage
138
- else
139
- launch_application
140
- end
141
- end
142
-
143
- private
144
-
145
- def launch_application
146
- load File.expand_path('./Rakefile') if File.exist?(File.expand_path('./Rakefile')) && caller.join("\n").include?('/bin/glimmer:')
147
- threads = @application_paths.map do |application_path|
148
- Thread.new do
149
- self.class.launch(
150
- application_path,
151
- jruby_options: @jruby_options,
152
- env_vars: @env_vars,
153
- glimmer_options: @glimmer_options
154
- )
155
- end
156
- end
157
- threads.each(&:join)
158
- end
159
-
160
- def display_usage
161
- rake_tasks = `rake -T`.gsub('rake glimmer:', 'glimmer ').split("\n").select {|l| l.start_with?('glimmer ')}
162
- puts TEXT_USAGE_PREFIX
163
- puts rake_tasks.join("\n")
164
- puts TEXT_USAGE_SUFFIX
165
- end
166
-
167
- def extract_application_paths(options)
168
- options.select do |option|
169
- !option.start_with?('-') && !option.include?('=')
170
- end.each do |application_path|
171
- options.delete(application_path)
172
- end
173
- end
174
-
175
- def extract_env_vars(options)
176
- options.select do |option|
177
- !option.start_with?('-') && option.include?('=')
178
- end.each do |env_var|
179
- options.delete(env_var)
180
- end.reduce({}) do |hash, env_var_string|
181
- match = env_var_string.match(/^([^=]+)=(.+)$/)
182
- hash.merge(match[1] => match[2])
183
- end
184
- end
185
-
186
- def extract_glimmer_options(options)
187
- options.select do |option|
188
- GLIMMER_OPTIONS.reduce(false) do |result, glimmer_option|
189
- result || option.include?(glimmer_option)
190
- end
191
- end.each do |glimmer_option|
192
- options.delete(glimmer_option)
193
- end.reduce({}) do |hash, glimmer_option_string|
194
- match = glimmer_option_string.match(/^([^=]+)=?(.+)?$/)
195
- hash.merge(match[1] => (match[2] || 'true'))
196
- end
197
- end
198
- end
199
- end
@@ -1,55 +0,0 @@
1
- module Glimmer
2
- module Package
3
- class << self
4
- attr_accessor :javapackager_extra_args
5
-
6
- def config
7
- project_name = File.basename(File.expand_path('.'))
8
- if !File.exists?('config/warble.rb')
9
- puts 'Generating JAR configuration (config/warble.rb) to use with Warbler...'
10
- system('mkdir -p config')
11
- system('warble config')
12
- new_config = File.read('config/warble.rb').split("\n").inject('') do |output, line|
13
- if line.include?('config.dirs =')
14
- line = line.sub('# ', '').sub(/=[^=\n]+$/, '= %w(app config db lib script bin docs fonts icons images sounds videos)')
15
- end
16
- if line.include?('config.includes =')
17
- line = line.sub('# ', '').sub(/=[^=\n]+$/, "= FileList['LICENSE.txt', 'VERSION']")
18
- end
19
- if line.include?('config.autodeploy_dir =')
20
- line = line.sub('# ', '')
21
- end
22
- output + "\n" + line
23
- end
24
- File.write('config/warble.rb', new_config)
25
- end
26
- end
27
-
28
- def jar
29
- system('mkdir -p dist')
30
- puts "Generating JAR with Warbler..."
31
- system('warble')
32
- end
33
-
34
- def native
35
- require 'facets/string/titlecase'
36
- require 'facets/string/underscore'
37
- project_name = File.basename(File.expand_path('.'))
38
- version_file = File.expand_path('./VERSION')
39
- version = (File.read(version_file).strip if File.exists?(version_file) && File.file?(version_file)) rescue nil
40
- license_file = File.expand_path('./LICENSE.txt')
41
- license = (File.read(license_file).strip if File.exists?(license_file) && File.file?(license_file)) rescue nil
42
- human_name = project_name.underscore.titlecase
43
- command = "javapackager -deploy -native -outdir packages -outfile \"#{project_name}\" -srcfiles \"dist/#{project_name}.jar\" -appclass JarMain -name \"#{human_name}\" -title \"#{human_name}\" -Bmac.CFBundleName=\"#{human_name}\" -Bmac.CFBundleIdentifier=\"org.#{project_name}.application.#{project_name}\" -Bmac.category=\"public.app-category.business\" "
44
- command += " -BjvmOptions=-XstartOnFirstThread " if OS.mac?
45
- command += " -BappVersion=#{version} -Bmac.CFBundleVersion=#{version} " if version
46
- command += " -srcfiles LICENSE.txt -BlicenseFile=LICENSE.txt " if license
47
- command += " #{javapackager_extra_args} " if javapackager_extra_args
48
- command += " #{ENV['JAVAPACKAGER_EXTRA_ARGS']} " if ENV['JAVAPACKAGER_EXTRA_ARGS']
49
- puts "Generating DMG/PKG/APP/JNLP with javapackager..."
50
- puts command
51
- system command
52
- end
53
- end
54
- end
55
- end