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 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] instead.
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 = lzc_directories.map{|f| File.join(home, f, 'lzc')}
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 #{search.join(' or ')}" if found.empty?
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
- # The compiler writes errors to stdout, warnings to stderr
162
- require "open3"
163
- stdin, stdout, stderr = Open3.popen3("#{@lzc} #{args.join(' ')}")
164
- text = stdout.read
165
- text.gsub!(/^\d+\s+/, '') # work around a bug in OpenLaszlo 3.1
166
- results = {:output => output}
167
- if text =~ /^Compilation errors occurred:\n/
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 lzc_directories
183
+ def bin_directories
179
184
  [# binary distro location
180
185
  'bin',
181
- # binary distro location
186
+ # source distro location
182
187
  'WEB-INF/lps/server/bin'
183
188
  ]
184
189
  end
@@ -69,7 +69,7 @@ class CompileServerTest < Test::Unit::TestCase
69
69
  def setup
70
70
  OpenLaszlo::compiler = nil
71
71
  @test_dir = File.join(ENV['OPENLASZLO_HOME'], 'tmp/ropenlaszlo-tests')
72
- mkdir @test_dir
72
+ mkdir_p @test_dir
73
73
  end
74
74
 
75
75
  def teardown
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.0
7
- date: 2006-01-19 00:00:00 -05:00
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