- Revision
- 189
- Author
- mward
- Date
- 2007-06-27 07:52:20 -0500 (Wed, 27 Jun 2007)
Log Message
no longer expecting ruby files to be under a ruby directory, updated jruby example accordingly
Modified Paths
- trunk/core/src/main/ruby/org/codehaus/waffle/waffle.rb
- trunk/core/src/test/specs/org/codehaus/waffle/servlet/waffle_spec.rb
- trunk/examples/jruby-example/resources/person.rhtml
- trunk/examples/jruby-example/src/main/webapp/WEB-INF/web.xml
- trunk/examples/jruby-example/src/test/ruby/foobar_spec.rb
Added Paths
- trunk/examples/jruby-example/src/main/ruby/foo_bar.rb
- trunk/examples/jruby-example/src/main/ruby/hello.rb
- trunk/examples/jruby-example/src/main/ruby/person.rb
Removed Paths
Diff
Modified: trunk/core/src/main/ruby/org/codehaus/waffle/waffle.rb (188 => 189)
--- trunk/core/src/main/ruby/org/codehaus/waffle/waffle.rb 2007-06-26 03:11:01 UTC (rev 188) +++ trunk/core/src/main/ruby/org/codehaus/waffle/waffle.rb 2007-06-27 12:52:20 UTC (rev 189) @@ -17,7 +17,7 @@ ScriptLoader.load_from_file_system else servlet_context.getResourcePaths(prefix).each do |path| # this would be for production!! - require(path.gsub(Regexp.new("^#{prefix}\/"), 'ruby/')) + require(path.gsub(Regexp.new("^#{prefix}\/"), '')) end end end
Modified: trunk/core/src/test/specs/org/codehaus/waffle/servlet/waffle_spec.rb (188 => 189)
--- trunk/core/src/test/specs/org/codehaus/waffle/servlet/waffle_spec.rb 2007-06-26 03:11:01 UTC (rev 188) +++ trunk/core/src/test/specs/org/codehaus/waffle/servlet/waffle_spec.rb 2007-06-27 12:52:20 UTC (rev 189) @@ -19,8 +19,8 @@ servlet_context = mock('servlet_context') servlet_context.should_receive(:getResourcePaths).with('fake/dir/path').and_return(paths) - Waffle::ScriptLoader.should_receive(:require).with('ruby/one') - Waffle::ScriptLoader.should_receive(:require).with('ruby/two') + Waffle::ScriptLoader.should_receive(:require).with('one') + Waffle::ScriptLoader.should_receive(:require).with('two') Waffle::ScriptLoader.load_all('fake/dir/path', servlet_context) Waffle::ScriptLoader.instance_variable_get(:@__servlet_context).should == servlet_context
Modified: trunk/examples/jruby-example/resources/person.rhtml (188 => 189)
--- trunk/examples/jruby-example/resources/person.rhtml 2007-06-26 03:11:01 UTC (rev 188) +++ trunk/examples/jruby-example/resources/person.rhtml 2007-06-27 12:52:20 UTC (rev 189) @@ -1,4 +1,4 @@ -<html xmlns="http://www.w3.org/1999/xhtml"> +<html> <head> <title>Persons rhtml listing</title> @@ -15,7 +15,7 @@ <body> <form action="" method="post"> - <h3>Waffle/JRuby rhtml example</h3> + <h3>Waffle/JRuby rhtml example (RHTML)</h3> <table> <tr> @@ -25,7 +25,7 @@ <th>Email</th> <th>Date of Birth</th> </tr> - <% @persons.each_with_index do |person, index| %> + <% @persons.each_with_index do |person, index| %> <tr class="<%= index % 2 == 0 ? 'even' : 'odd' %>"> <td><%= person.id %></td> <!-- TODO: Override object_id --> <td><%= person.firstName %></td>
Added: trunk/examples/jruby-example/src/main/ruby/foo_bar.rb (0 => 189)
--- trunk/examples/jruby-example/src/main/ruby/foo_bar.rb (rev 0) +++ trunk/examples/jruby-example/src/main/ruby/foo_bar.rb 2007-06-27 12:52:20 UTC (rev 189) @@ -0,0 +1,61 @@ +class FooBar + + def index + @var1 = "is cool and fast" + render("foobar.jspx") + end + + def hola + errors # automatically resolves from params => req.attr => session.attr => application.attr + end + + def ajax + "<h1>Hello</h1>" + end + + def index_two + request[:foo] = 'bar' + session[:bar] = 'foo' + session[:baz] = 'foo' + p session + + %{ + HELLO WORLD from the index method + look up from pico: #{find_chicago} + parameters: #{parameters} + request: #{request} + session: #{session} + servlet_context: #{servlet_context} + #{session['waffle.session.container']} + + #{session.getServletContext().getRealPath('/WEB-INF/')} + + auto resolve #{foo} + + component: #{locate(java.util.List)} + component: #{locate(org.codehaus.waffle.example.jruby.dao.PersonDAO)} + + #{cls = Java::JavaClass.for_name('java.util.Vector')} + #{locate(Java::JavaClass.for_name('java.util.List'))} + } + + end + + def bar + "HELLO WORLD #{request.local_name} #{request.local_port}" + end + + def view_jspx + p "CALLED!" + @var1 = "this is my variables value from jruby!!!!!!!!" + view = render("foobar.jspx") + p "DONE" + return view + end + + def redirect_to_jspx + @var1 = "this is my variables value from jruby xxx" + return redirect_to("index.html") + end + +end \ No newline at end of file
Added: trunk/examples/jruby-example/src/main/ruby/hello.rb (0 => 189)
--- trunk/examples/jruby-example/src/main/ruby/hello.rb (rev 0) +++ trunk/examples/jruby-example/src/main/ruby/hello.rb 2007-06-27 12:52:20 UTC (rev 189) @@ -0,0 +1,13 @@ +class HelloController + + def index + @my_instance_var = "Testing instance vars..." + render("hello.rhtml") + end + + def test_method + @value = "Other Value" + render "other.rhtml" + end + +end \ No newline at end of file
Added: trunk/examples/jruby-example/src/main/ruby/person.rb (0 => 189)
--- trunk/examples/jruby-example/src/main/ruby/person.rb (rev 0) +++ trunk/examples/jruby-example/src/main/ruby/person.rb 2007-06-27 12:52:20 UTC (rev 189) @@ -0,0 +1,44 @@ +include_class 'org.codehaus.waffle.example.jruby.model.Person' + +class PersonController + + def index + @person_dao = locate(org.codehaus.waffle.example.jruby.dao.PersonDAO) + + @persons = @person_dao.findAll + #render 'person.jspx' + render 'person.rhtml' + end + + def remove(uid) + @person_dao.delete(uid.to_i) + + return nil + end + + def select(uid) + @person = @person_dao.findById(uid.to_i) + + return nil + end + + def save + p "SAVING [EMAIL PROTECTED]" + @person_dao.save(@person) + + return nil + end + + def create + @person = Person.new + + return nil # stay on page + end + + def cancel + @person = nil + + return nil + end + +end \ No newline at end of file
Deleted: trunk/examples/jruby-example/src/main/ruby/ruby/foo_bar.rb (188 => 189)
--- trunk/examples/jruby-example/src/main/ruby/ruby/foo_bar.rb 2007-06-26 03:11:01 UTC (rev 188) +++ trunk/examples/jruby-example/src/main/ruby/ruby/foo_bar.rb 2007-06-27 12:52:20 UTC (rev 189) @@ -1,61 +0,0 @@ -class FooBar - - def index - @var1 = "is cool and fast" - render("foobar.jspx") - end - - def hola - errors # automatically resolves from params => req.attr => session.attr => application.attr - end - - def ajax - "<h1>Hello</h1>" - end - - def index_two - request[:foo] = 'bar' - session[:bar] = 'foo' - session[:baz] = 'foo' - p session - - %{ - HELLO WORLD from the index method - look up from pico: #{find_chicago} - parameters: #{parameters} - request: #{request} - session: #{session} - servlet_context: #{servlet_context} - #{session['waffle.session.container']} - - #{session.getServletContext().getRealPath('/WEB-INF/')} - - auto resolve #{foo} - - component: #{locate(java.util.List)} - component: #{locate(org.codehaus.waffle.example.jruby.dao.PersonDAO)} - - #{cls = Java::JavaClass.for_name('java.util.Vector')} - #{locate(Java::JavaClass.for_name('java.util.List'))} - } - - end - - def bar - "HELLO WORLD #{request.local_name} #{request.local_port}" - end - - def view_jspx - p "CALLED!" - @var1 = "this is my variables value from jruby!!!!!!!!" - view = render("foobar.jspx") - p "DONE" - return view - end - - def redirect_to_jspx - @var1 = "this is my variables value from jruby xxx" - return redirect_to("index.html") - end - -end \ No newline at end of file
Deleted: trunk/examples/jruby-example/src/main/ruby/ruby/hello.rb (188 => 189)
--- trunk/examples/jruby-example/src/main/ruby/ruby/hello.rb 2007-06-26 03:11:01 UTC (rev 188) +++ trunk/examples/jruby-example/src/main/ruby/ruby/hello.rb 2007-06-27 12:52:20 UTC (rev 189) @@ -1,13 +0,0 @@ -class HelloController - - def index - @my_instance_var = "Testing instance vars..." - render("hello.rhtml") - end - - def test_method - @value = "Other Value" - render "other.rhtml" - end - -end \ No newline at end of file
Deleted: trunk/examples/jruby-example/src/main/ruby/ruby/person.rb (188 => 189)
--- trunk/examples/jruby-example/src/main/ruby/ruby/person.rb 2007-06-26 03:11:01 UTC (rev 188) +++ trunk/examples/jruby-example/src/main/ruby/ruby/person.rb 2007-06-27 12:52:20 UTC (rev 189) @@ -1,43 +0,0 @@ -include_class 'org.codehaus.waffle.example.jruby.model.Person' - -class PersonController - - def index - @person_dao = locate(org.codehaus.waffle.example.jruby.dao.PersonDAO) - - @persons = @person_dao.findAll - render 'person.jspx' - #render 'person.rhtml' - end - - def remove(uid) - @person_dao.delete(uid.to_i) - - return nil - end - - def select(uid) - @person = @person_dao.findById(uid.to_i) - - return nil - end - - def save - @person_dao.save(@person) - - return nil - end - - def create - @person = Person.new - - return nil # stay on page - end - - def cancel - @person = nil - - return nil - end - -end \ No newline at end of file
Modified: trunk/examples/jruby-example/src/main/webapp/WEB-INF/web.xml (188 => 189)
--- trunk/examples/jruby-example/src/main/webapp/WEB-INF/web.xml 2007-06-26 03:11:01 UTC (rev 188) +++ trunk/examples/jruby-example/src/main/webapp/WEB-INF/web.xml 2007-06-27 12:52:20 UTC (rev 189) @@ -30,7 +30,7 @@ <!-- Define a relative path to the ruby script directory (for development) --> <context-param> <param-name>org.codehaus.waffle.ruby.path</param-name> - <param-value>dir:../src/main/ruby/ruby/</param-value><!-- this needs to be more forgiving --> + <param-value>dir:../src/main/ruby/</param-value><!-- this needs to be more forgiving --> </context-param> <listener>
Modified: trunk/examples/jruby-example/src/test/ruby/foobar_spec.rb (188 => 189)
--- trunk/examples/jruby-example/src/test/ruby/foobar_spec.rb 2007-06-26 03:11:01 UTC (rev 188) +++ trunk/examples/jruby-example/src/test/ruby/foobar_spec.rb 2007-06-27 12:52:20 UTC (rev 189) @@ -1,5 +1,5 @@ import org.codehaus.waffle.servlet.WaffleServlet -require 'ruby/person' +require 'person' describe 'stuff' do
To unsubscribe from this list please visit:
