ropenlaszlo 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/CHANGES +5 -0
- data/doc/README +5 -1
- data/lib/compiler.rb +21 -16
- data/test/compiler_test.rb +1 -1
- metadata +2 -2
data/doc/CHANGES
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
= Change Log
|
2
2
|
|
3
|
+
== Version 0.4.1 (2006/01/25)
|
4
|
+
* bug fix: don't use popen on Windows
|
5
|
+
* bug fix: default LPS_HOME from OPENLASZLO_HOME
|
6
|
+
* added note about OpenLaszlo windows bug
|
7
|
+
|
3
8
|
== Version 0.4.0 (2006/01/19)
|
4
9
|
* new feature: command-line compiler detects compilation warnings
|
5
10
|
* bug fix: command-line compilation in qualified directory places object in same directory
|
data/doc/README
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
ROpenLaszo is a Ruby interface to the OpenLaszlo[openlaszlo.org] compiler. It allows you to compile Open<tt></tt>Laszlo programs from within Ruby, in order to integrate Open<tt></tt>Laszlo development into Rake or Rails applications.
|
4
4
|
|
5
|
-
If you are using Open<tt></tt>Laszlo with Ruby on Rails, you probably want the {OpenLaszlo Rails plugin}[laszlo-plugin.rubyforge.org]
|
5
|
+
If you are using Open<tt></tt>Laszlo with Ruby on Rails, you probably want the {OpenLaszlo Rails plugin}[laszlo-plugin.rubyforge.org] as well.
|
6
6
|
|
7
7
|
OpenLaszlo[openlaszlo.org] programs are written in XML with embedded JavaScript, and compiled into Flash (swf) binary files, or DHTML. (As of this writing, the DHTML target is in pre-beta form.) The APIs in this library make it easy for Ruby code to invoke the Open<tt></tt>Laszlo compiler. For example, if hello.lzx contains the following text:
|
8
8
|
<canvas>
|
@@ -39,6 +39,8 @@ You can turn this into a Rake task that will compile any Open<tt></tt>Laszlo sou
|
|
39
39
|
|
40
40
|
3:: (Optional) Set your +OPENLASZLO_URL+ environment variable to the web location of the Open<tt></tt>Laszlo server; for example, <tt>http</tt><tt>://localhost:8080/lps-3.1</tt>. If you omit this step, the module will use the command line compiler, which is slower but is not limited to compiling files inside of +OPENLASZLO_HOME+.
|
41
41
|
|
42
|
+
<b>Note:</b> The command-line compiler is broken in the Windows version of Open<tt></tt>Laszlo 3.1.1. If you are running Windows, step (3) is required. ({OpenLaszlo bug 1428}[http://www.openlaszlo.org/jira/browse/LPP-1428])
|
43
|
+
|
42
44
|
== Additional Resources
|
43
45
|
|
44
46
|
* The {OpenLaszlo web site}[openlaszlo.org] is a rich source of information about the Open<tt></tt>Laszlo platform. It includes links to the wiki, mailing lists, and forums.
|
@@ -49,6 +51,8 @@ You can turn this into a Rake task that will compile any Open<tt></tt>Laszlo sou
|
|
49
51
|
|
50
52
|
* {This OpenLaszlo Blog entry}[weblog.openlaszlo.org/archives/2006/01/deploying-openlaszlo-applications-with-rake/] has additional information and some examples of using ROpenLaszlo in a Rakefile.
|
51
53
|
|
54
|
+
* The RubyForge project page is here[http://rubyforge.org/projects/ropenlaszlo/].
|
55
|
+
|
52
56
|
== License
|
53
57
|
|
54
58
|
ROpenLaszlo is copyright (c) 2006 Oliver Steele. It is open-source software, and may be redistributed
|
data/lib/compiler.rb
CHANGED
@@ -133,11 +133,10 @@ module OpenLaszlo
|
|
133
133
|
unless @lzc
|
134
134
|
home = options[:openlaszlo_home] || ENV['OPENLASZLO_HOME']
|
135
135
|
raise ":compiler_script or :openlaszlo_home must be specified" unless home
|
136
|
-
search =
|
136
|
+
search = bin_directories.map{|f| File.join(home, f, 'lzc')}
|
137
137
|
found = search.select{|f| File.exists? f}
|
138
|
-
raise "couldn't find bin/lzc in #{
|
138
|
+
raise "couldn't find bin/lzc in #{bin_directories.join(' or ')}" if found.empty?
|
139
139
|
@lzc = found.first
|
140
|
-
# Adjust the name for Windows:
|
141
140
|
@lzc += '.bat' if windows?
|
142
141
|
end
|
143
142
|
end
|
@@ -149,8 +148,6 @@ module OpenLaszlo
|
|
149
148
|
default_output = File.join(File.dirname(source_file),
|
150
149
|
File.basename(source_file, '.lzx') + '.swf')
|
151
150
|
output = options[:output] || default_output
|
152
|
-
# TODO: could handle this case by compiling to a temporary directory and
|
153
|
-
# renaming from there
|
154
151
|
raise "#{source_file} and #{output} do not have the same basename." unless File.basename(source_file, '.lzx') == File.basename(output, '.swf')
|
155
152
|
args = []
|
156
153
|
args << '--runtime=#{options[:runtime]}' if options[:runtime]
|
@@ -158,27 +155,35 @@ module OpenLaszlo
|
|
158
155
|
args << '--profile' if options[:profile]
|
159
156
|
args << "--dir '#{File.dirname output}'" unless File.dirname(source_file) == File.dirname(output)
|
160
157
|
args << source_file
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
158
|
+
command = "\"#{@lzc}\" #{args.join(' ')}"
|
159
|
+
ENV['LPS_HOME'] ||= ENV['OPENLASZLO_HOME']
|
160
|
+
begin
|
161
|
+
#raise NotImplementedError --- for testing Windows
|
162
|
+
require "open3"
|
163
|
+
# The compiler writes errors to stdout, warnings to stderr
|
164
|
+
stdin, stdout, stderr = Open3.popen3(command)
|
165
|
+
errors = stdout.read
|
166
|
+
warnings = stderr.readlines
|
167
|
+
rescue NotImplementedError
|
168
|
+
# Windows doesn't have popen
|
169
|
+
errors = `#{command}`
|
170
|
+
warnings = []
|
171
|
+
end
|
172
|
+
errors.gsub!(/^\d+\s+/, '') # work around a bug in OpenLaszlo 3.1
|
173
|
+
if errors =~ /^Compilation errors occurred:\n/
|
168
174
|
raise CompilationError.new($'.strip)
|
169
|
-
else
|
170
|
-
results[:warnings] = stderr.readlines
|
171
175
|
end
|
176
|
+
results = {:output => output, :warnings => warnings}
|
172
177
|
return results
|
173
178
|
end
|
174
179
|
|
175
180
|
private
|
176
181
|
|
177
182
|
# Locations in which to look for the lzc script, relative to OPENLASZLO_HOME
|
178
|
-
def
|
183
|
+
def bin_directories
|
179
184
|
[# binary distro location
|
180
185
|
'bin',
|
181
|
-
#
|
186
|
+
# source distro location
|
182
187
|
'WEB-INF/lps/server/bin'
|
183
188
|
]
|
184
189
|
end
|
data/test/compiler_test.rb
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: ropenlaszlo
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.4.
|
7
|
-
date: 2006-01-
|
6
|
+
version: 0.4.1
|
7
|
+
date: 2006-01-25 00:00:00 -05:00
|
8
8
|
summary: Ruby interface to OpenLaszlo.
|
9
9
|
require_paths:
|
10
10
|
- lib
|