Google App Engine Rails Template

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

Google App Engine Rails Template

by joshmoore-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I just finished posting a rails template that creates an app ready to deploy on the Google App Engine.  Check out the blog post http://www.codingforrent.com/posts/8001 and the template at http://github.com/joshsmoore/gaej_rails_template/tree/master.  It is still a bit of work in progress.  But, it should take care of the basics of getting a Rails app set up for deployment on the Google App Engine.  Please tell me what you think.

Josh

Re: Google App Engine Rails Template

by Chris Collins-10 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Josh.

This is a helpful tool for creating a skeleton app. It starts from the opposite end of the process than I have been using - creating my Rails app and then warbling it and making those tweaks listed in your script. But with your script it seems the idea is to create the app elsewhere perhaps and then copy the Rails code into the app directory once the skeleton has been created with your script.

The biggest problem, which you alluded to in your blog post, still seems to be the need to restart the dev server between code changes. I believe this has to do with the fact that the Jetty server, which normally allows hot deploy for native Java projects, does not allow hot deploy when a scripting language like Ruby, Groovy or Python is running on top of Java. A potential solution to this is to use jetty-rails. As of yet I have not figured whether it is possible to get it to work with an App Engine Rails project: http://fabiokung.com/2008/05/14/jetty-rails-gem-simple-jruby-on-rails-development-with-servlet-containers/

The other adjustment with Rails development on App Engine has to do with the ORM but is still related to the hot deploy problem with Jetty. Datamapper and Ola Bini's Bumble seem to be the best solutions at the moment. But because of the need to restart the dev server between code changes, it seems to be more efficient to develop a Rails app first outside of the Eclipse/App Engine IDE using a real database and ORM and then later modify the app to work with Datamapper/Bumble. At least that's the approach I have decided to take at the moment. The Eclipse/App Engine environment slows me down too much to allow my development to proceed at a productive pace. I would be curious whether you have discovered any useful tips for the process of converting a regular app from ActiveRecord+Sqlite/Mysql to Datamapper/Bumble+Google Datastore.

Regards,
Chris

On Sat, Jun 13, 2009 at 6:42 AM, Josh Moore <joshsmoore@...> wrote:
Hi,

I just finished posting a rails template that creates an app ready to deploy on the Google App Engine.  Check out the blog post http://www.codingforrent.com/posts/8001 and the template at http://github.com/joshsmoore/gaej_rails_template/tree/master.  It is still a bit of work in progress.  But, it should take care of the basics of getting a Rails app set up for deployment on the Google App Engine.  Please tell me what you think.

Josh


Re: Google App Engine Rails Template

by joshmoore-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Chris,

I think that it is possible to develop ruby apps without the need to restart (http://dev.massivebraingames.com/past/2009/4/15/writing_sinatra_apps_for_google/). I will be honest I have not looked into this much.  However, I think the problem with rails is that development mode seems to be incompatible with App Engine (I think it has something to do with the rails app trying to access the file system).  I think if rails can be configured to not cache the app files it might work like it does for sinatra. I am looking into that now, if you have any insites please let me know.

About your last question I have personally not had any experience with converting an existing rails app to work with App Engine.  So far I have worked completely with building new onces. 

Josh

On Sun, Jun 14, 2009 at 5:05 AM, Chris Collins <xoptop@...> wrote:
Hi Josh.

This is a helpful tool for creating a skeleton app. It starts from the opposite end of the process than I have been using - creating my Rails app and then warbling it and making those tweaks listed in your script. But with your script it seems the idea is to create the app elsewhere perhaps and then copy the Rails code into the app directory once the skeleton has been created with your script.

The biggest problem, which you alluded to in your blog post, still seems to be the need to restart the dev server between code changes. I believe this has to do with the fact that the Jetty server, which normally allows hot deploy for native Java projects, does not allow hot deploy when a scripting language like Ruby, Groovy or Python is running on top of Java. A potential solution to this is to use jetty-rails. As of yet I have not figured whether it is possible to get it to work with an App Engine Rails project: http://fabiokung.com/2008/05/14/jetty-rails-gem-simple-jruby-on-rails-development-with-servlet-containers/

The other adjustment with Rails development on App Engine has to do with the ORM but is still related to the hot deploy problem with Jetty. Datamapper and Ola Bini's Bumble seem to be the best solutions at the moment. But because of the need to restart the dev server between code changes, it seems to be more efficient to develop a Rails app first outside of the Eclipse/App Engine IDE using a real database and ORM and then later modify the app to work with Datamapper/Bumble. At least that's the approach I have decided to take at the moment. The Eclipse/App Engine environment slows me down too much to allow my development to proceed at a productive pace. I would be curious whether you have discovered any useful tips for the process of converting a regular app from ActiveRecord+Sqlite/Mysql to Datamapper/Bumble+Google Datastore.

Regards,
Chris


On Sat, Jun 13, 2009 at 6:42 AM, Josh Moore <joshsmoore@...> wrote:
Hi,

I just finished posting a rails template that creates an app ready to deploy on the Google App Engine.  Check out the blog post http://www.codingforrent.com/posts/8001 and the template at http://github.com/joshsmoore/gaej_rails_template/tree/master.  It is still a bit of work in progress.  But, it should take care of the basics of getting a Rails app set up for deployment on the Google App Engine.  Please tell me what you think.

Josh



Re: Google App Engine Rails Template

by Christian Seiler-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

My workaround in development mode so far: Simply using Webrick as usual
plus setting up the datastore in the controller (application_controller.rb).

  if Rails.env=='development'
    before_filter :setup_datastore
    after_filter  :teardown_datastore
  end
 
  protected

    if Rails.env=='development'
      import com.google.apphosting.api.ApiProxy
      import com.google.appengine.api.datastore.dev.LocalDatastoreService
      import com.google.appengine.tools.development.ApiProxyLocalImpl
     
      class DevEnvironment
        include ApiProxy::Environment
        def app_id
          'Dev Environment'
        end
      end
     
      def setup_datastore
        ApiProxy.environment_for_current_thread = DevEnvironment.new
        ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new
java.io.File.new('.')
        #ApiProxy.delegate.set_property
LocalDatastoreService::NO_STORAGE_PROPERTY, 'true'
      end
     
      def teardown_datastore
        #ApiProxy.delegate.get_service('datastore_v3').clear_profiles
        ApiProxy.delegate = nil
        ApiProxy.environment_for_current_thread = nil
      end
    end


Josh Moore wrote:

> Hi Chris,
>
> I think that it is possible to develop ruby apps without the need to
> restart
> (http://dev.massivebraingames.com/past/2009/4/15/writing_sinatra_apps_for_google/).
> I will be honest I have not looked into this much.  However, I think
> the problem with rails is that development mode seems to be
> incompatible with App Engine (I think it has something to do with the
> rails app trying to access the file system).  I think if rails can be
> configured to not cache the app files it might work like it does for
> sinatra. I am looking into that now, if you have any insites please
> let me know.
>
> About your last question I have personally not had any experience with
> converting an existing rails app to work with App Engine.  So far I
> have worked completely with building new onces.
>
> Josh
>
> On Sun, Jun 14, 2009 at 5:05 AM, Chris Collins <xoptop@...
> <mailto:xoptop@...>> wrote:
>
>     Hi Josh.
>
>     This is a helpful tool for creating a skeleton app. It starts from
>     the opposite end of the process than I have been using - creating
>     my Rails app and then warbling it and making those tweaks listed
>     in your script. But with your script it seems the idea is to
>     create the app elsewhere perhaps and then copy the Rails code into
>     the app directory once the skeleton has been created with your script.
>
>     The biggest problem, which you alluded to in your blog post, still
>     seems to be the need to restart the dev server between code
>     changes. I believe this has to do with the fact that the Jetty
>     server, which normally allows hot deploy for native Java projects,
>     does not allow hot deploy when a scripting language like Ruby,
>     Groovy or Python is running on top of Java. A potential solution
>     to this is to use jetty-rails. As of yet I have not figured
>     whether it is possible to get it to work with an App Engine Rails
>     project:
>     http://fabiokung.com/2008/05/14/jetty-rails-gem-simple-jruby-on-rails-development-with-servlet-containers/
>
>     The other adjustment with Rails development on App Engine has to
>     do with the ORM but is still related to the hot deploy problem
>     with Jetty. Datamapper and Ola Bini's Bumble seem to be the best
>     solutions at the moment. But because of the need to restart the
>     dev server between code changes, it seems to be more efficient to
>     develop a Rails app first outside of the Eclipse/App Engine IDE
>     using a real database and ORM and then later modify the app to
>     work with Datamapper/Bumble. At least that's the approach I have
>     decided to take at the moment. The Eclipse/App Engine environment
>     slows me down too much to allow my development to proceed at a
>     productive pace. I would be curious whether you have discovered
>     any useful tips for the process of converting a regular app from
>     ActiveRecord+Sqlite/Mysql to Datamapper/Bumble+Google Datastore.
>
>     Regards,
>     Chris
>
>
>     On Sat, Jun 13, 2009 at 6:42 AM, Josh Moore <joshsmoore@...
>     <mailto:joshsmoore@...>> wrote:
>
>         Hi,
>
>         I just finished posting a rails template that creates an app
>         ready to deploy on the Google App Engine.  Check out the blog
>         post http://www.codingforrent.com/posts/8001 and the template
>         at http://github.com/joshsmoore/gaej_rails_template/tree/master.
>          It is still a bit of work in progress.  But, it should take
>         care of the basics of getting a Rails app set up for
>         deployment on the Google App Engine.  Please tell me what you
>         think.
>
>         Josh
>
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Parent Message unknown Google App Engine Rails Template

by Carson Welsh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi Christian

Thanks for the code sample.

I am very eager to use a standard Ruby development environment for App Engine without restarts as you have described.

I have spent several hours trying to use your code sample to configure a Rails project with GAE but so far have been unsuccessful.

Have you made any other significant changes to your Rails app besides what you mentioned?

Thanks,
Carson



 
From: Christian Seiler <chr.seiler@...>
Date: Mon, Jun 15, 2009 at 5:37 AM
To: user@...


My workaround in development mode so far: Simply using Webrick as usual
plus setting up the datastore in the controller (application_controller.rb).

 if Rails.env=='development'
   before_filter :setup_datastore
   after_filter  :teardown_datastore
 end

 protected

   if Rails.env=='development'
     import com.google.apphosting.api.ApiProxy
     import com.google.appengine.api.datastore.dev.LocalDatastoreService
     import com.google.appengine.tools.development.ApiProxyLocalImpl

     class DevEnvironment
       include ApiProxy::Environment
       def app_id
         'Dev Environment'
       end
     end

     def setup_datastore
       ApiProxy.environment_for_current_thread = DevEnvironment.new
       ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new
java.io.File.new('.')
       #ApiProxy.delegate.set_property
LocalDatastoreService::NO_STORAGE_PROPERTY, 'true'
     end

     def teardown_datastore
       #ApiProxy.delegate.get_service('datastore_v3').clear_profiles
       ApiProxy.delegate = nil
       ApiProxy.environment_for_current_thread = nil
     end
   end
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email






Re: Google App Engine Rails Template

by Christian Seiler-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I haven't played with it lately so I need to recall..

Well, first of all my dev environment is not a real AppEngine setup,
it's plain JRuby/Rails plus Datastore. That's all I have used so far (no
memcache or mailer). One thing you need to do is require the
appengine-api-1.0-sdk-1.2.1.jar to make the AppEngine stuff available.
I've put the jar in the lib folder and require it in config/development.rb.

I think that's all. By the way, I used this example as project template:
http://github.com/nicksieger/jruby-rack/tree/bb907c03c48eb999e7d099068245b91eeda545bf/examples/rails

I hope this helps!

Carson Welsh wrote:

>
> Hi Christian
>
> Thanks for the code sample.
>
> I am very eager to use a standard Ruby development environment for App
> Engine without restarts as you have described.
>
> I have spent several hours trying to use your code sample to configure
> a Rails project with GAE but so far have been unsuccessful.
>
> Have you made any other significant changes to your Rails app besides
> what you mentioned?
>
> Thanks,
> Carson
>
>
>
>  
>
>     From: *Christian Seiler* <chr.seiler@...
>     <mailto:chr.seiler@...>>
>     Date: Mon, Jun 15, 2009 at 5:37 AM
>     To: user@... <mailto:user@...>
>
>
>     My workaround in development mode so far: Simply using Webrick as
>     usual
>     plus setting up the datastore in the controller
>     (application_controller.rb).
>
>      if Rails.env=='development'
>        before_filter :setup_datastore
>        after_filter  :teardown_datastore
>      end
>
>      protected
>
>        if Rails.env=='development'
>          import com.google.apphosting.api.ApiProxy
>          import
>     com.google.appengine.api.datastore.dev.LocalDatastoreService
>          import com.google.appengine.tools.development.ApiProxyLocalImpl
>
>          class DevEnvironment
>            include ApiProxy::Environment
>            def app_id
>              'Dev Environment'
>            end
>          end
>
>          def setup_datastore
>            ApiProxy.environment_for_current_thread = DevEnvironment.new
>            ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new
>     java.io.File.new('.')
>            #ApiProxy.delegate.set_property
>     LocalDatastoreService::NO_STORAGE_PROPERTY, 'true'
>          end
>
>          def teardown_datastore
>            #ApiProxy.delegate.get_service('datastore_v3').clear_profiles
>            ApiProxy.delegate = nil
>            ApiProxy.environment_for_current_thread = nil
>          end
>        end
>     ---------------------------------------------------------------------
>     To unsubscribe from this list, please visit:
>
>        http://xircles.codehaus.org/manage_email
>
>
>
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Google App Engine Rails Template

by Carson Welsh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi Christian,

I wonder if you have any idea what might be going wrong here. I downloaded the Nick Sieger template and added your addition to the application_controller.rb, added the appengine-api-1.0-sdk-1.2.1.jar to the lib folder and require it in config/development.rb. But I get the following error after I start the application:

NameError in SnoopController#index

cannot load Java class com.google.appengine.api.datastore.dev.LocalDatastoreService

RAILS_ROOT: C:/wsp/siegerails/examples/rails

Application Trace | Framework Trace | Full Trace
C:/jr/lib/ruby/site_ruby/1.8/builtin/javasupport/core_ext/object.rb:87:in `get_proxy_or_package_under_package'
C:/jr/lib/ruby/site_ruby/1.8/builtin/javasupport/java.rb:51:in `method_missing'
C:/wsp/siegerails/examples/rails/app/controllers/application_controller.rb:20
C:/wsp/siegerails/examples/rails/app/controllers/application_controller.rb:380:in `load'
C:/wsp/siegerails/examples/rails/app/controllers/snoop_controller.rb:1
C:/wsp/siegerails/examples/rails/app/controllers/snoop_controller.rb:380:in `load'



On Tue, Jun 16, 2009 at 5:12 AM, Christian Seiler <chr.seiler@...> wrote:
I haven't played with it lately so I need to recall..

Well, first of all my dev environment is not a real AppEngine setup,
it's plain JRuby/Rails plus Datastore. That's all I have used so far (no
memcache or mailer). One thing you need to do is require the
appengine-api-1.0-sdk-1.2.1.jar to make the AppEngine stuff available.
I've put the jar in the lib folder and require it in config/development.rb.

I think that's all. By the way, I used this example as project template:
http://github.com/nicksieger/jruby-rack/tree/bb907c03c48eb999e7d099068245b91eeda545bf/examples/rails

I hope this helps!

Carson Welsh wrote:
>
> Hi Christian
>
> Thanks for the code sample.
>
> I am very eager to use a standard Ruby development environment for App
> Engine without restarts as you have described.
>
> I have spent several hours trying to use your code sample to configure
> a Rails project with GAE but so far have been unsuccessful.
>
> Have you made any other significant changes to your Rails app besides
> what you mentioned?
>
> Thanks,
> Carson
>
>
>
>
>
>     From: *Christian Seiler* <chr.seiler@...
>     <mailto:chr.seiler@...>>
>     Date: Mon, Jun 15, 2009 at 5:37 AM
>     To: user@... <mailto:user@...>
>
>
>     My workaround in development mode so far: Simply using Webrick as
>     usual
>     plus setting up the datastore in the controller
>     (application_controller.rb).
>
>      if Rails.env=='development'
>        before_filter :setup_datastore
>        after_filter  :teardown_datastore
>      end
>
>      protected
>
>        if Rails.env=='development'
>          import com.google.apphosting.api.ApiProxy
>          import
>     com.google.appengine.api.datastore.dev.LocalDatastoreService
>          import com.google.appengine.tools.development.ApiProxyLocalImpl
>
>          class DevEnvironment
>            include ApiProxy::Environment
>            def app_id
>              'Dev Environment'
>            end
>          end
>
>          def setup_datastore
>            ApiProxy.environment_for_current_thread = DevEnvironment.new
>            ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new
>     java.io.File.new('.')
>            #ApiProxy.delegate.set_property
>     LocalDatastoreService::NO_STORAGE_PROPERTY, 'true'
>          end
>
>          def teardown_datastore
>            #ApiProxy.delegate.get_service('datastore_v3').clear_profiles
>            ApiProxy.delegate = nil
>            ApiProxy.environment_for_current_thread = nil
>          end
>        end
>     ---------------------------------------------------------------------
>     To unsubscribe from this list, please visit:
>
>        http://xircles.codehaus.org/manage_email
>
>
>
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




Re: Google App Engine Rails Template

by Christian Seiler-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Forgot about two other jar files:

appengine-api-stubs-1.2.1.jar
appengine-local-runtime-1.2.1.jar

But you shouldn't put them into the lib folder, because I think Warbler
would pick them up and include them in the war file. You don't want
these libs on AppEngine.


Carson Welsh wrote:

>
> Hi Christian,
>
> I wonder if you have any idea what might be going wrong here. I
> downloaded the Nick Sieger template and added your addition to the
> application_controller.rb, added the appengine-api-1.0-sdk-1.2.1.jar
> to the lib folder and require it in config/development.rb. But I get
> the following error after I start the application:
>
> NameError in SnoopController#index
>
> cannot load Java class
> com.google.appengine.api.datastore.dev.LocalDatastoreService
>
> RAILS_ROOT: C:/wsp/siegerails/examples/rails
>
> Application Trace | Framework Trace | Full Trace
> C:/jr/lib/ruby/site_ruby/1.8/builtin/javasupport/core_ext/object.rb:87:in
> `get_proxy_or_package_under_package'
> C:/jr/lib/ruby/site_ruby/1.8/builtin/javasupport/java.rb:51:in
> `method_missing'
> C:/wsp/siegerails/examples/rails/app/controllers/application_controller.rb:20
> C:/wsp/siegerails/examples/rails/app/controllers/application_controller.rb:380:in
> `load'
> C:/wsp/siegerails/examples/rails/app/controllers/snoop_controller.rb:1
> C:/wsp/siegerails/examples/rails/app/controllers/snoop_controller.rb:380:in
> `load'
>
>
>
> On Tue, Jun 16, 2009 at 5:12 AM, Christian Seiler
> <chr.seiler@... <mailto:chr.seiler@...>> wrote:
>
>     I haven't played with it lately so I need to recall..
>
>     Well, first of all my dev environment is not a real AppEngine setup,
>     it's plain JRuby/Rails plus Datastore. That's all I have used so
>     far (no
>     memcache or mailer). One thing you need to do is require the
>     appengine-api-1.0-sdk-1.2.1.jar to make the AppEngine stuff available.
>     I've put the jar in the lib folder and require it in
>     config/development.rb.
>
>     I think that's all. By the way, I used this example as project
>     template:
>     http://github.com/nicksieger/jruby-rack/tree/bb907c03c48eb999e7d099068245b91eeda545bf/examples/rails
>
>     I hope this helps!
>
>     Carson Welsh wrote:
>     >
>     > Hi Christian
>     >
>     > Thanks for the code sample.
>     >
>     > I am very eager to use a standard Ruby development environment
>     for App
>     > Engine without restarts as you have described.
>     >
>     > I have spent several hours trying to use your code sample to
>     configure
>     > a Rails project with GAE but so far have been unsuccessful.
>     >
>     > Have you made any other significant changes to your Rails app
>     besides
>     > what you mentioned?
>     >
>     > Thanks,
>     > Carson
>     >
>     >
>     >
>     >
>     >
>     >     From: *Christian Seiler* <chr.seiler@...
>     <mailto:chr.seiler@...>
>     >     <mailto:chr.seiler@... <mailto:chr.seiler@...>>>
>     >     Date: Mon, Jun 15, 2009 at 5:37 AM
>     >     To: user@... <mailto:user@...>
>     <mailto:user@... <mailto:user@...>>
>     >
>     >
>     >     My workaround in development mode so far: Simply using
>     Webrick as
>     >     usual
>     >     plus setting up the datastore in the controller
>     >     (application_controller.rb).
>     >
>     >      if Rails.env=='development'
>     >        before_filter :setup_datastore
>     >        after_filter  :teardown_datastore
>     >      end
>     >
>     >      protected
>     >
>     >        if Rails.env=='development'
>     >          import com.google.apphosting.api.ApiProxy
>     >          import
>     >     com.google.appengine.api.datastore.dev.LocalDatastoreService
>     >          import
>     com.google.appengine.tools.development.ApiProxyLocalImpl
>     >
>     >          class DevEnvironment
>     >            include ApiProxy::Environment
>     >            def app_id
>     >              'Dev Environment'
>     >            end
>     >          end
>     >
>     >          def setup_datastore
>     >            ApiProxy.environment_for_current_thread =
>     DevEnvironment.new
>     >            ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new
>     >     java.io.File.new('.')
>     >            #ApiProxy.delegate.set_property
>     >     LocalDatastoreService::NO_STORAGE_PROPERTY, 'true'
>     >          end
>     >
>     >          def teardown_datastore
>     >          
>      #ApiProxy.delegate.get_service('datastore_v3').clear_profiles
>     >            ApiProxy.delegate = nil
>     >            ApiProxy.environment_for_current_thread = nil
>     >          end
>     >        end
>     >    
>     ---------------------------------------------------------------------
>     >     To unsubscribe from this list, please visit:
>     >
>     >        http://xircles.codehaus.org/manage_email
>     >
>     >
>     >
>     >
>     >
>
>
>     ---------------------------------------------------------------------
>     To unsubscribe from this list, please visit:
>
>        http://xircles.codehaus.org/manage_email
>
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Google App Engine Rails Template

by Carson Welsh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks. Cleared that hurdle.

Now the error I'm getting is inside the code you added to
application_controller.rb:

"wrong # of arguments for constructor" in
application_controller.rb:32:in `setup_datastore'

Looks like the problem is in the second line of the setup_datastore method.

Did you do any customization here?

Also, probably not related to this error I'm getting but, it looks
like maybe you commented out those two lines beginning with
"ApiProxy"? If so, was there a reason?

    def setup_datastore
      ApiProxy.environment_for_current_thread = DevEnvironment.new
      ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new
      java.io.File.new('.')
      #ApiProxy.delegate.set_property
LocalDatastoreService::NO_STORAGE_PROPERTY, 'true'
    end

    def teardown_datastore
      #ApiProxy.delegate.get_service('datastore_v3').clear_profiles
      ApiProxy.delegate = nil
      ApiProxy.environment_for_current_thread = nil
    end



On Tue, Jun 16, 2009 at 2:45 PM, Christian Seiler <chr.seiler@...> wrote:

>
> Forgot about two other jar files:
>
> appengine-api-stubs-1.2.1.jar
> appengine-local-runtime-1.2.1.jar
>
> But you shouldn't put them into the lib folder, because I think Warbler
> would pick them up and include them in the war file. You don't want
> these libs on AppEngine.
>
>
> Carson Welsh wrote:
> >
> > Hi Christian,
> >
> > I wonder if you have any idea what might be going wrong here. I
> > downloaded the Nick Sieger template and added your addition to the
> > application_controller.rb, added the appengine-api-1.0-sdk-1.2.1.jar
> > to the lib folder and require it in config/development.rb. But I get
> > the following error after I start the application:
> >
> > NameError in SnoopController#index
> >
> > cannot load Java class
> > com.google.appengine.api.datastore.dev.LocalDatastoreService
> >
> > RAILS_ROOT: C:/wsp/siegerails/examples/rails
> >
> > Application Trace | Framework Trace | Full Trace
> > C:/jr/lib/ruby/site_ruby/1.8/builtin/javasupport/core_ext/object.rb:87:in
> > `get_proxy_or_package_under_package'
> > C:/jr/lib/ruby/site_ruby/1.8/builtin/javasupport/java.rb:51:in
> > `method_missing'
> > C:/wsp/siegerails/examples/rails/app/controllers/application_controller.rb:20
> > C:/wsp/siegerails/examples/rails/app/controllers/application_controller.rb:380:in
> > `load'
> > C:/wsp/siegerails/examples/rails/app/controllers/snoop_controller.rb:1
> > C:/wsp/siegerails/examples/rails/app/controllers/snoop_controller.rb:380:in
> > `load'
> >
> >
> >
> > On Tue, Jun 16, 2009 at 5:12 AM, Christian Seiler
> > <chr.seiler@... <mailto:chr.seiler@...>> wrote:
> >
> >     I haven't played with it lately so I need to recall..
> >
> >     Well, first of all my dev environment is not a real AppEngine setup,
> >     it's plain JRuby/Rails plus Datastore. That's all I have used so
> >     far (no
> >     memcache or mailer). One thing you need to do is require the
> >     appengine-api-1.0-sdk-1.2.1.jar to make the AppEngine stuff available.
> >     I've put the jar in the lib folder and require it in
> >     config/development.rb.
> >
> >     I think that's all. By the way, I used this example as project
> >     template:
> >     http://github.com/nicksieger/jruby-rack/tree/bb907c03c48eb999e7d099068245b91eeda545bf/examples/rails
> >
> >     I hope this helps!
> >
> >     Carson Welsh wrote:
> >     >
> >     > Hi Christian
> >     >
> >     > Thanks for the code sample.
> >     >
> >     > I am very eager to use a standard Ruby development environment
> >     for App
> >     > Engine without restarts as you have described.
> >     >
> >     > I have spent several hours trying to use your code sample to
> >     configure
> >     > a Rails project with GAE but so far have been unsuccessful.
> >     >
> >     > Have you made any other significant changes to your Rails app
> >     besides
> >     > what you mentioned?
> >     >
> >     > Thanks,
> >     > Carson
> >     >
> >     >
> >     >
> >     >
> >     >
> >     >     From: *Christian Seiler* <chr.seiler@...
> >     <mailto:chr.seiler@...>
> >     >     <mailto:chr.seiler@... <mailto:chr.seiler@...>>>
> >     >     Date: Mon, Jun 15, 2009 at 5:37 AM
> >     >     To: user@... <mailto:user@...>
> >     <mailto:user@... <mailto:user@...>>
> >     >
> >     >
> >     >     My workaround in development mode so far: Simply using
> >     Webrick as
> >     >     usual
> >     >     plus setting up the datastore in the controller
> >     >     (application_controller.rb).
> >     >
> >     >      if Rails.env=='development'
> >     >        before_filter :setup_datastore
> >     >        after_filter  :teardown_datastore
> >     >      end
> >     >
> >     >      protected
> >     >
> >     >        if Rails.env=='development'
> >     >          import com.google.apphosting.api.ApiProxy
> >     >          import
> >     >     com.google.appengine.api.datastore.dev.LocalDatastoreService
> >     >          import
> >     com.google.appengine.tools.development.ApiProxyLocalImpl
> >     >
> >     >          class DevEnvironment
> >     >            include ApiProxy::Environment
> >     >            def app_id
> >     >              'Dev Environment'
> >     >            end
> >     >          end
> >     >
> >     >          def setup_datastore
> >     >            ApiProxy.environment_for_current_thread =
> >     DevEnvironment.new
> >     >            ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new
> >     >     java.io.File.new('.')
> >     >            #ApiProxy.delegate.set_property
> >     >     LocalDatastoreService::NO_STORAGE_PROPERTY, 'true'
> >     >          end
> >     >
> >     >          def teardown_datastore
> >     >
> >      #ApiProxy.delegate.get_service('datastore_v3').clear_profiles
> >     >            ApiProxy.delegate = nil
> >     >            ApiProxy.environment_for_current_thread = nil
> >     >          end
> >     >        end
> >     >
> >     ---------------------------------------------------------------------
> >     >     To unsubscribe from this list, please visit:
> >     >
> >     >        http://xircles.codehaus.org/manage_email
> >     >
> >     >
> >     >
> >     >
> >     >
> >
> >
> >     ---------------------------------------------------------------------
> >     To unsubscribe from this list, please visit:
> >
> >        http://xircles.codehaus.org/manage_email
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Google App Engine Rails Template

by Carson Welsh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ignore my last message. Sorry.

I had a whitespace mistake on this line:

ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new java.io.File.new('.')

But I'm still curious why those two lines are commented out in
setup_datastore and teardown_datastore.



On Tue, Jun 16, 2009 at 3:31 PM, Carson Welsh<carsonwelsh@...> wrote:

> Thanks. Cleared that hurdle.
>
> Now the error I'm getting is inside the code you added to
> application_controller.rb:
>
> "wrong # of arguments for constructor" in
> application_controller.rb:32:in `setup_datastore'
>
> Looks like the problem is in the second line of the setup_datastore method.
>
> Did you do any customization here?
>
> Also, probably not related to this error I'm getting but, it looks
> like maybe you commented out those two lines beginning with
> "ApiProxy"? If so, was there a reason?
>
>    def setup_datastore
>      ApiProxy.environment_for_current_thread = DevEnvironment.new
>      ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new
>      java.io.File.new('.')
>      #ApiProxy.delegate.set_property
> LocalDatastoreService::NO_STORAGE_PROPERTY, 'true'
>    end
>
>    def teardown_datastore
>      #ApiProxy.delegate.get_service('datastore_v3').clear_profiles
>      ApiProxy.delegate = nil
>      ApiProxy.environment_for_current_thread = nil
>    end
>
>
>
> On Tue, Jun 16, 2009 at 2:45 PM, Christian Seiler <chr.seiler@...> wrote:
>>
>> Forgot about two other jar files:
>>
>> appengine-api-stubs-1.2.1.jar
>> appengine-local-runtime-1.2.1.jar
>>
>> But you shouldn't put them into the lib folder, because I think Warbler
>> would pick them up and include them in the war file. You don't want
>> these libs on AppEngine.
>>
>>
>> Carson Welsh wrote:
>> >
>> > Hi Christian,
>> >
>> > I wonder if you have any idea what might be going wrong here. I
>> > downloaded the Nick Sieger template and added your addition to the
>> > application_controller.rb, added the appengine-api-1.0-sdk-1.2.1.jar
>> > to the lib folder and require it in config/development.rb. But I get
>> > the following error after I start the application:
>> >
>> > NameError in SnoopController#index
>> >
>> > cannot load Java class
>> > com.google.appengine.api.datastore.dev.LocalDatastoreService
>> >
>> > RAILS_ROOT: C:/wsp/siegerails/examples/rails
>> >
>> > Application Trace | Framework Trace | Full Trace
>> > C:/jr/lib/ruby/site_ruby/1.8/builtin/javasupport/core_ext/object.rb:87:in
>> > `get_proxy_or_package_under_package'
>> > C:/jr/lib/ruby/site_ruby/1.8/builtin/javasupport/java.rb:51:in
>> > `method_missing'
>> > C:/wsp/siegerails/examples/rails/app/controllers/application_controller.rb:20
>> > C:/wsp/siegerails/examples/rails/app/controllers/application_controller.rb:380:in
>> > `load'
>> > C:/wsp/siegerails/examples/rails/app/controllers/snoop_controller.rb:1
>> > C:/wsp/siegerails/examples/rails/app/controllers/snoop_controller.rb:380:in
>> > `load'
>> >
>> >
>> >
>> > On Tue, Jun 16, 2009 at 5:12 AM, Christian Seiler
>> > <chr.seiler@... <mailto:chr.seiler@...>> wrote:
>> >
>> >     I haven't played with it lately so I need to recall..
>> >
>> >     Well, first of all my dev environment is not a real AppEngine setup,
>> >     it's plain JRuby/Rails plus Datastore. That's all I have used so
>> >     far (no
>> >     memcache or mailer). One thing you need to do is require the
>> >     appengine-api-1.0-sdk-1.2.1.jar to make the AppEngine stuff available.
>> >     I've put the jar in the lib folder and require it in
>> >     config/development.rb.
>> >
>> >     I think that's all. By the way, I used this example as project
>> >     template:
>> >     http://github.com/nicksieger/jruby-rack/tree/bb907c03c48eb999e7d099068245b91eeda545bf/examples/rails
>> >
>> >     I hope this helps!
>> >
>> >     Carson Welsh wrote:
>> >     >
>> >     > Hi Christian
>> >     >
>> >     > Thanks for the code sample.
>> >     >
>> >     > I am very eager to use a standard Ruby development environment
>> >     for App
>> >     > Engine without restarts as you have described.
>> >     >
>> >     > I have spent several hours trying to use your code sample to
>> >     configure
>> >     > a Rails project with GAE but so far have been unsuccessful.
>> >     >
>> >     > Have you made any other significant changes to your Rails app
>> >     besides
>> >     > what you mentioned?
>> >     >
>> >     > Thanks,
>> >     > Carson
>> >     >
>> >     >
>> >     >
>> >     >
>> >     >
>> >     >     From: *Christian Seiler* <chr.seiler@...
>> >     <mailto:chr.seiler@...>
>> >     >     <mailto:chr.seiler@... <mailto:chr.seiler@...>>>
>> >     >     Date: Mon, Jun 15, 2009 at 5:37 AM
>> >     >     To: user@... <mailto:user@...>
>> >     <mailto:user@... <mailto:user@...>>
>> >     >
>> >     >
>> >     >     My workaround in development mode so far: Simply using
>> >     Webrick as
>> >     >     usual
>> >     >     plus setting up the datastore in the controller
>> >     >     (application_controller.rb).
>> >     >
>> >     >      if Rails.env=='development'
>> >     >        before_filter :setup_datastore
>> >     >        after_filter  :teardown_datastore
>> >     >      end
>> >     >
>> >     >      protected
>> >     >
>> >     >        if Rails.env=='development'
>> >     >          import com.google.apphosting.api.ApiProxy
>> >     >          import
>> >     >     com.google.appengine.api.datastore.dev.LocalDatastoreService
>> >     >          import
>> >     com.google.appengine.tools.development.ApiProxyLocalImpl
>> >     >
>> >     >          class DevEnvironment
>> >     >            include ApiProxy::Environment
>> >     >            def app_id
>> >     >              'Dev Environment'
>> >     >            end
>> >     >          end
>> >     >
>> >     >          def setup_datastore
>> >     >            ApiProxy.environment_for_current_thread =
>> >     DevEnvironment.new
>> >     >            ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new
>> >     >     java.io.File.new('.')
>> >     >            #ApiProxy.delegate.set_property
>> >     >     LocalDatastoreService::NO_STORAGE_PROPERTY, 'true'
>> >     >          end
>> >     >
>> >     >          def teardown_datastore
>> >     >
>> >      #ApiProxy.delegate.get_service('datastore_v3').clear_profiles
>> >     >            ApiProxy.delegate = nil
>> >     >            ApiProxy.environment_for_current_thread = nil
>> >     >          end
>> >     >        end
>> >     >
>> >     ---------------------------------------------------------------------
>> >     >     To unsubscribe from this list, please visit:
>> >     >
>> >     >        http://xircles.codehaus.org/manage_email
>> >     >
>> >     >
>> >     >
>> >     >
>> >     >
>> >
>> >
>> >     ---------------------------------------------------------------------
>> >     To unsubscribe from this list, please visit:
>> >
>> >        http://xircles.codehaus.org/manage_email
>> >
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Google App Engine Rails Template

by Ryan Brown-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

First of all, I really recommend doing your development under the App
Engine dev_appserver. There's plenty of ways to get automatic
reloading. It sounds like this template already sets up symbolic links
for you. In that case you probably just need to edit you web.xml to
set your environment to development instead of production. Just make
sure you set it back before deploying to production.

Second, if you want to set up a test datastore I suggest using the
AppEngine::Testing module from the appengine-apis gem. The easiest way
is to require 'appengine-apis/local_boot'.  This will add the
necessary jars to your class path and read  your appengine-web.xml to
set you up with the same on disk datastore that dev_appserver uses.
It does nothing if things were already configured by dev_appserver or
the prod servers, so it should be fine to just add this to your
environment.rb
You can also call AppEngine::Testing::install_test_datastore if you
want an in-memory datastore for unittests.

-- Ryan Brown



On Tue, Jun 16, 2009 at 12:38 PM, Carson Welsh<carsonwelsh@...> wrote:

> Ignore my last message. Sorry.
>
> I had a whitespace mistake on this line:
>
> ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new java.io.File.new('.')
>
> But I'm still curious why those two lines are commented out in
> setup_datastore and teardown_datastore.
>
>
>
> On Tue, Jun 16, 2009 at 3:31 PM, Carson Welsh<carsonwelsh@...> wrote:
>> Thanks. Cleared that hurdle.
>>
>> Now the error I'm getting is inside the code you added to
>> application_controller.rb:
>>
>> "wrong # of arguments for constructor" in
>> application_controller.rb:32:in `setup_datastore'
>>
>> Looks like the problem is in the second line of the setup_datastore method.
>>
>> Did you do any customization here?
>>
>> Also, probably not related to this error I'm getting but, it looks
>> like maybe you commented out those two lines beginning with
>> "ApiProxy"? If so, was there a reason?
>>
>>    def setup_datastore
>>      ApiProxy.environment_for_current_thread = DevEnvironment.new
>>      ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new
>>      java.io.File.new('.')
>>      #ApiProxy.delegate.set_property
>> LocalDatastoreService::NO_STORAGE_PROPERTY, 'true'
>>    end
>>
>>    def teardown_datastore
>>      #ApiProxy.delegate.get_service('datastore_v3').clear_profiles
>>      ApiProxy.delegate = nil
>>      ApiProxy.environment_for_current_thread = nil
>>    end
>>
>>
>>
>> On Tue, Jun 16, 2009 at 2:45 PM, Christian Seiler <chr.seiler@...> wrote:
>>>
>>> Forgot about two other jar files:
>>>
>>> appengine-api-stubs-1.2.1.jar
>>> appengine-local-runtime-1.2.1.jar
>>>
>>> But you shouldn't put them into the lib folder, because I think Warbler
>>> would pick them up and include them in the war file. You don't want
>>> these libs on AppEngine.
>>>
>>>
>>> Carson Welsh wrote:
>>> >
>>> > Hi Christian,
>>> >
>>> > I wonder if you have any idea what might be going wrong here. I
>>> > downloaded the Nick Sieger template and added your addition to the
>>> > application_controller.rb, added the appengine-api-1.0-sdk-1.2.1.jar
>>> > to the lib folder and require it in config/development.rb. But I get
>>> > the following error after I start the application:
>>> >
>>> > NameError in SnoopController#index
>>> >
>>> > cannot load Java class
>>> > com.google.appengine.api.datastore.dev.LocalDatastoreService
>>> >
>>> > RAILS_ROOT: C:/wsp/siegerails/examples/rails
>>> >
>>> > Application Trace | Framework Trace | Full Trace
>>> > C:/jr/lib/ruby/site_ruby/1.8/builtin/javasupport/core_ext/object.rb:87:in
>>> > `get_proxy_or_package_under_package'
>>> > C:/jr/lib/ruby/site_ruby/1.8/builtin/javasupport/java.rb:51:in
>>> > `method_missing'
>>> > C:/wsp/siegerails/examples/rails/app/controllers/application_controller.rb:20
>>> > C:/wsp/siegerails/examples/rails/app/controllers/application_controller.rb:380:in
>>> > `load'
>>> > C:/wsp/siegerails/examples/rails/app/controllers/snoop_controller.rb:1
>>> > C:/wsp/siegerails/examples/rails/app/controllers/snoop_controller.rb:380:in
>>> > `load'
>>> >
>>> >
>>> >
>>> > On Tue, Jun 16, 2009 at 5:12 AM, Christian Seiler
>>> > <chr.seiler@... <mailto:chr.seiler@...>> wrote:
>>> >
>>> >     I haven't played with it lately so I need to recall..
>>> >
>>> >     Well, first of all my dev environment is not a real AppEngine setup,
>>> >     it's plain JRuby/Rails plus Datastore. That's all I have used so
>>> >     far (no
>>> >     memcache or mailer). One thing you need to do is require the
>>> >     appengine-api-1.0-sdk-1.2.1.jar to make the AppEngine stuff available.
>>> >     I've put the jar in the lib folder and require it in
>>> >     config/development.rb.
>>> >
>>> >     I think that's all. By the way, I used this example as project
>>> >     template:
>>> >     http://github.com/nicksieger/jruby-rack/tree/bb907c03c48eb999e7d099068245b91eeda545bf/examples/rails
>>> >
>>> >     I hope this helps!
>>> >
>>> >     Carson Welsh wrote:
>>> >     >
>>> >     > Hi Christian
>>> >     >
>>> >     > Thanks for the code sample.
>>> >     >
>>> >     > I am very eager to use a standard Ruby development environment
>>> >     for App
>>> >     > Engine without restarts as you have described.
>>> >     >
>>> >     > I have spent several hours trying to use your code sample to
>>> >     configure
>>> >     > a Rails project with GAE but so far have been unsuccessful.
>>> >     >
>>> >     > Have you made any other significant changes to your Rails app
>>> >     besides
>>> >     > what you mentioned?
>>> >     >
>>> >     > Thanks,
>>> >     > Carson
>>> >     >
>>> >     >
>>> >     >
>>> >     >
>>> >     >
>>> >     >     From: *Christian Seiler* <chr.seiler@...
>>> >     <mailto:chr.seiler@...>
>>> >     >     <mailto:chr.seiler@... <mailto:chr.seiler@...>>>
>>> >     >     Date: Mon, Jun 15, 2009 at 5:37 AM
>>> >     >     To: user@... <mailto:user@...>
>>> >     <mailto:user@... <mailto:user@...>>
>>> >     >
>>> >     >
>>> >     >     My workaround in development mode so far: Simply using
>>> >     Webrick as
>>> >     >     usual
>>> >     >     plus setting up the datastore in the controller
>>> >     >     (application_controller.rb).
>>> >     >
>>> >     >      if Rails.env=='development'
>>> >     >        before_filter :setup_datastore
>>> >     >        after_filter  :teardown_datastore
>>> >     >      end
>>> >     >
>>> >     >      protected
>>> >     >
>>> >     >        if Rails.env=='development'
>>> >     >          import com.google.apphosting.api.ApiProxy
>>> >     >          import
>>> >     >     com.google.appengine.api.datastore.dev.LocalDatastoreService
>>> >     >          import
>>> >     com.google.appengine.tools.development.ApiProxyLocalImpl
>>> >     >
>>> >     >          class DevEnvironment
>>> >     >            include ApiProxy::Environment
>>> >     >            def app_id
>>> >     >              'Dev Environment'
>>> >     >            end
>>> >     >          end
>>> >     >
>>> >     >          def setup_datastore
>>> >     >            ApiProxy.environment_for_current_thread =
>>> >     DevEnvironment.new
>>> >     >            ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new
>>> >     >     java.io.File.new('.')
>>> >     >            #ApiProxy.delegate.set_property
>>> >     >     LocalDatastoreService::NO_STORAGE_PROPERTY, 'true'
>>> >     >          end
>>> >     >
>>> >     >          def teardown_datastore
>>> >     >
>>> >      #ApiProxy.delegate.get_service('datastore_v3').clear_profiles
>>> >     >            ApiProxy.delegate = nil
>>> >     >            ApiProxy.environment_for_current_thread = nil
>>> >     >          end
>>> >     >        end
>>> >     >
>>> >     ---------------------------------------------------------------------
>>> >     >     To unsubscribe from this list, please visit:
>>> >     >
>>> >     >        http://xircles.codehaus.org/manage_email
>>> >     >
>>> >     >
>>> >     >
>>> >     >
>>> >     >
>>> >
>>> >
>>> >     ---------------------------------------------------------------------
>>> >     To unsubscribe from this list, please visit:
>>> >
>>> >        http://xircles.codehaus.org/manage_email
>>> >
>>> >
>>> >
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>    http://xircles.codehaus.org/manage_email
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Google App Engine Rails Template

by joshmoore-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

HI I agree with Ryan that it is best to develop under the devserver so that there no surprises when you go to deploy.  Unfortunately, I have tried using development mode with the devserver but it does not work.  When Rails tries to reload the ruby files it throws a security exception.  However if you make to changes to the production.rb you can atleast get auto reload of the HTML and CSS files.  Check out http://www.codingforrent.com/posts/7002 for more details.  If you just want a quick answer here is what you need to change:

config.action_controller.perform_caching = false 
config.action_view.cache_template_loading = false

It will not speed up the ruby development, but at least you can use unit tests to help with that.

Josh Moore

On Wed, Jun 17, 2009 at 5:11 AM, Ryan Brown <ribrdb@...> wrote:
First of all, I really recommend doing your development under the App
Engine dev_appserver. There's plenty of ways to get automatic
reloading. It sounds like this template already sets up symbolic links
for you. In that case you probably just need to edit you web.xml to
set your environment to development instead of production. Just make
sure you set it back before deploying to production.

Second, if you want to set up a test datastore I suggest using the
AppEngine::Testing module from the appengine-apis gem. The easiest way
is to require 'appengine-apis/local_boot'.  This will add the
necessary jars to your class path and read  your appengine-web.xml to
set you up with the same on disk datastore that dev_appserver uses.
It does nothing if things were already configured by dev_appserver or
the prod servers, so it should be fine to just add this to your
environment.rb
You can also call AppEngine::Testing::install_test_datastore if you
want an in-memory datastore for unittests.

-- Ryan Brown



On Tue, Jun 16, 2009 at 12:38 PM, Carson Welsh<carsonwelsh@...> wrote:
> Ignore my last message. Sorry.
>
> I had a whitespace mistake on this line:
>
> ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new java.io.File.new('.')
>
> But I'm still curious why those two lines are commented out in
> setup_datastore and teardown_datastore.
>
>
>
> On Tue, Jun 16, 2009 at 3:31 PM, Carson Welsh<carsonwelsh@...> wrote:
>> Thanks. Cleared that hurdle.
>>
>> Now the error I'm getting is inside the code you added to
>> application_controller.rb:
>>
>> "wrong # of arguments for constructor" in
>> application_controller.rb:32:in `setup_datastore'
>>
>> Looks like the problem is in the second line of the setup_datastore method.
>>
>> Did you do any customization here?
>>
>> Also, probably not related to this error I'm getting but, it looks
>> like maybe you commented out those two lines beginning with
>> "ApiProxy"? If so, was there a reason?
>>
>>    def setup_datastore
>>      ApiProxy.environment_for_current_thread = DevEnvironment.new
>>      ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new
>>      java.io.File.new('.')
>>      #ApiProxy.delegate.set_property
>> LocalDatastoreService::NO_STORAGE_PROPERTY, 'true'
>>    end
>>
>>    def teardown_datastore
>>      #ApiProxy.delegate.get_service('datastore_v3').clear_profiles
>>      ApiProxy.delegate = nil
>>      ApiProxy.environment_for_current_thread = nil
>>    end
>>
>>
>>
>> On Tue, Jun 16, 2009 at 2:45 PM, Christian Seiler <chr.seiler@...> wrote:
>>>
>>> Forgot about two other jar files:
>>>
>>> appengine-api-stubs-1.2.1.jar
>>> appengine-local-runtime-1.2.1.jar
>>>
>>> But you shouldn't put them into the lib folder, because I think Warbler
>>> would pick them up and include them in the war file. You don't want
>>> these libs on AppEngine.
>>>
>>>
>>> Carson Welsh wrote:
>>> >
>>> > Hi Christian,
>>> >
>>> > I wonder if you have any idea what might be going wrong here. I
>>> > downloaded the Nick Sieger template and added your addition to the
>>> > application_controller.rb, added the appengine-api-1.0-sdk-1.2.1.jar
>>> > to the lib folder and require it in config/development.rb. But I get
>>> > the following error after I start the application:
>>> >
>>> > NameError in SnoopController#index
>>> >
>>> > cannot load Java class
>>> > com.google.appengine.api.datastore.dev.LocalDatastoreService
>>> >
>>> > RAILS_ROOT: C:/wsp/siegerails/examples/rails
>>> >
>>> > Application Trace | Framework Trace | Full Trace
>>> > C:/jr/lib/ruby/site_ruby/1.8/builtin/javasupport/core_ext/object.rb:87:in
>>> > `get_proxy_or_package_under_package'
>>> > C:/jr/lib/ruby/site_ruby/1.8/builtin/javasupport/java.rb:51:in
>>> > `method_missing'
>>> > C:/wsp/siegerails/examples/rails/app/controllers/application_controller.rb:20
>>> > C:/wsp/siegerails/examples/rails/app/controllers/application_controller.rb:380:in
>>> > `load'
>>> > C:/wsp/siegerails/examples/rails/app/controllers/snoop_controller.rb:1
>>> > C:/wsp/siegerails/examples/rails/app/controllers/snoop_controller.rb:380:in
>>> > `load'
>>> >
>>> >
>>> >
>>> > On Tue, Jun 16, 2009 at 5:12 AM, Christian Seiler
>>> > <chr.seiler@... <mailto:chr.seiler@...>> wrote:
>>> >
>>> >     I haven't played with it lately so I need to recall..
>>> >
>>> >     Well, first of all my dev environment is not a real AppEngine setup,
>>> >     it's plain JRuby/Rails plus Datastore. That's all I have used so
>>> >     far (no
>>> >     memcache or mailer). One thing you need to do is require the
>>> >     appengine-api-1.0-sdk-1.2.1.jar to make the AppEngine stuff available.
>>> >     I've put the jar in the lib folder and require it in
>>> >     config/development.rb.
>>> >
>>> >     I think that's all. By the way, I used this example as project
>>> >     template:
>>> >     http://github.com/nicksieger/jruby-rack/tree/bb907c03c48eb999e7d099068245b91eeda545bf/examples/rails
>>> >
>>> >     I hope this helps!
>>> >
>>> >     Carson Welsh wrote:
>>> >     >
>>> >     > Hi Christian
>>> >     >
>>> >     > Thanks for the code sample.
>>> >     >
>>> >     > I am very eager to use a standard Ruby development environment
>>> >     for App
>>> >     > Engine without restarts as you have described.
>>> >     >
>>> >     > I have spent several hours trying to use your code sample to
>>> >     configure
>>> >     > a Rails project with GAE but so far have been unsuccessful.
>>> >     >
>>> >     > Have you made any other significant changes to your Rails app
>>> >     besides
>>> >     > what you mentioned?
>>> >     >
>>> >     > Thanks,
>>> >     > Carson
>>> >     >
>>> >     >
>>> >     >
>>> >     >
>>> >     >
>>> >     >     From: *Christian Seiler* <chr.seiler@...
>>> >     <mailto:chr.seiler@...>
>>> >     >     <mailto:chr.seiler@... <mailto:chr.seiler@...>>>
>>> >     >     Date: Mon, Jun 15, 2009 at 5:37 AM
>>> >     >     To: user@... <mailto:user@...>
>>> >     <mailto:user@... <mailto:user@...>>
>>> >     >
>>> >     >
>>> >     >     My workaround in development mode so far: Simply using
>>> >     Webrick as
>>> >     >     usual
>>> >     >     plus setting up the datastore in the controller
>>> >     >     (application_controller.rb).
>>> >     >
>>> >     >      if Rails.env=='development'
>>> >     >        before_filter :setup_datastore
>>> >     >        after_filter  :teardown_datastore
>>> >     >      end
>>> >     >
>>> >     >      protected
>>> >     >
>>> >     >        if Rails.env=='development'
>>> >     >          import com.google.apphosting.api.ApiProxy
>>> >     >          import
>>> >     >     com.google.appengine.api.datastore.dev.LocalDatastoreService
>>> >     >          import
>>> >     com.google.appengine.tools.development.ApiProxyLocalImpl
>>> >     >
>>> >     >          class DevEnvironment
>>> >     >            include ApiProxy::Environment
>>> >     >            def app_id
>>> >     >              'Dev Environment'
>>> >     >            end
>>> >     >          end
>>> >     >
>>> >     >          def setup_datastore
>>> >     >            ApiProxy.environment_for_current_thread =
>>> >     DevEnvironment.new
>>> >     >            ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new
>>> >     >     java.io.File.new('.')
>>> >     >            #ApiProxy.delegate.set_property
>>> >     >     LocalDatastoreService::NO_STORAGE_PROPERTY, 'true'
>>> >     >          end
>>> >     >
>>> >     >          def teardown_datastore
>>> >     >
>>> >      #ApiProxy.delegate.get_service('datastore_v3').clear_profiles
>>> >     >            ApiProxy.delegate = nil
>>> >     >            ApiProxy.environment_for_current_thread = nil
>>> >     >          end
>>> >     >        end
>>> >     >
>>> >     ---------------------------------------------------------------------
>>> >     >     To unsubscribe from this list, please visit:
>>> >     >
>>> >     >        http://xircles.codehaus.org/manage_email
>>> >     >
>>> >     >
>>> >     >
>>> >     >
>>> >     >
>>> >
>>> >
>>> >     ---------------------------------------------------------------------
>>> >     To unsubscribe from this list, please visit:
>>> >
>>> >        http://xircles.codehaus.org/manage_email
>>> >
>>> >
>>> >
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>    http://xircles.codehaus.org/manage_email
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




Re: Google App Engine Rails Template

by Ryan Brown-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Jun 16, 2009 at 4:02 PM, Josh Moore<joshsmoore@...> wrote:
> HI I agree with Ryan that it is best to develop under the devserver so that
> there no surprises when you go to deploy.  Unfortunately, I have tried using
> development mode with the devserver but it does not work.  When Rails tries
> to reload the ruby files it throws a security exception.

Hmm. I guess I've only used automatic reloading with merb.  What's the
error you get from rails?

> However if you
> make to changes to the production.rb you can atleast get auto reload of the
> HTML and CSS files.  Check out http://www.codingforrent.com/posts/7002 for
> more details.  If you just want a quick answer here is what you need to
> change:
> config.action_controller.perform_caching = false
> config.action_view.cache_template_loading = false
> It will not speed up the ruby development, but at least you can use unit
> tests to help with that.
> Josh Moore
>
> On Wed, Jun 17, 2009 at 5:11 AM, Ryan Brown <ribrdb@...> wrote:
>>
>> First of all, I really recommend doing your development under the App
>> Engine dev_appserver. There's plenty of ways to get automatic
>> reloading. It sounds like this template already sets up symbolic links
>> for you. In that case you probably just need to edit you web.xml to
>> set your environment to development instead of production. Just make
>> sure you set it back before deploying to production.
>>
>> Second, if you want to set up a test datastore I suggest using the
>> AppEngine::Testing module from the appengine-apis gem. The easiest way
>> is to require 'appengine-apis/local_boot'.  This will add the
>> necessary jars to your class path and read  your appengine-web.xml to
>> set you up with the same on disk datastore that dev_appserver uses.
>> It does nothing if things were already configured by dev_appserver or
>> the prod servers, so it should be fine to just add this to your
>> environment.rb
>> You can also call AppEngine::Testing::install_test_datastore if you
>> want an in-memory datastore for unittests.
>>
>> -- Ryan Brown
>>
>>
>>
>> On Tue, Jun 16, 2009 at 12:38 PM, Carson Welsh<carsonwelsh@...>
>> wrote:
>> > Ignore my last message. Sorry.
>> >
>> > I had a whitespace mistake on this line:
>> >
>> > ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new
>> > java.io.File.new('.')
>> >
>> > But I'm still curious why those two lines are commented out in
>> > setup_datastore and teardown_datastore.
>> >
>> >
>> >
>> > On Tue, Jun 16, 2009 at 3:31 PM, Carson Welsh<carsonwelsh@...>
>> > wrote:
>> >> Thanks. Cleared that hurdle.
>> >>
>> >> Now the error I'm getting is inside the code you added to
>> >> application_controller.rb:
>> >>
>> >> "wrong # of arguments for constructor" in
>> >> application_controller.rb:32:in `setup_datastore'
>> >>
>> >> Looks like the problem is in the second line of the setup_datastore
>> >> method.
>> >>
>> >> Did you do any customization here?
>> >>
>> >> Also, probably not related to this error I'm getting but, it looks
>> >> like maybe you commented out those two lines beginning with
>> >> "ApiProxy"? If so, was there a reason?
>> >>
>> >>    def setup_datastore
>> >>      ApiProxy.environment_for_current_thread = DevEnvironment.new
>> >>      ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new
>> >>      java.io.File.new('.')
>> >>      #ApiProxy.delegate.set_property
>> >> LocalDatastoreService::NO_STORAGE_PROPERTY, 'true'
>> >>    end
>> >>
>> >>    def teardown_datastore
>> >>      #ApiProxy.delegate.get_service('datastore_v3').clear_profiles
>> >>      ApiProxy.delegate = nil
>> >>      ApiProxy.environment_for_current_thread = nil
>> >>    end
>> >>
>> >>
>> >>
>> >> On Tue, Jun 16, 2009 at 2:45 PM, Christian Seiler
>> >> <chr.seiler@...> wrote:
>> >>>
>> >>> Forgot about two other jar files:
>> >>>
>> >>> appengine-api-stubs-1.2.1.jar
>> >>> appengine-local-runtime-1.2.1.jar
>> >>>
>> >>> But you shouldn't put them into the lib folder, because I think
>> >>> Warbler
>> >>> would pick them up and include them in the war file. You don't want
>> >>> these libs on AppEngine.
>> >>>
>> >>>
>> >>> Carson Welsh wrote:
>> >>> >
>> >>> > Hi Christian,
>> >>> >
>> >>> > I wonder if you have any idea what might be going wrong here. I
>> >>> > downloaded the Nick Sieger template and added your addition to the
>> >>> > application_controller.rb, added the appengine-api-1.0-sdk-1.2.1.jar
>> >>> > to the lib folder and require it in config/development.rb. But I get
>> >>> > the following error after I start the application:
>> >>> >
>> >>> > NameError in SnoopController#index
>> >>> >
>> >>> > cannot load Java class
>> >>> > com.google.appengine.api.datastore.dev.LocalDatastoreService
>> >>> >
>> >>> > RAILS_ROOT: C:/wsp/siegerails/examples/rails
>> >>> >
>> >>> > Application Trace | Framework Trace | Full Trace
>> >>> >
>> >>> > C:/jr/lib/ruby/site_ruby/1.8/builtin/javasupport/core_ext/object.rb:87:in
>> >>> > `get_proxy_or_package_under_package'
>> >>> > C:/jr/lib/ruby/site_ruby/1.8/builtin/javasupport/java.rb:51:in
>> >>> > `method_missing'
>> >>> >
>> >>> > C:/wsp/siegerails/examples/rails/app/controllers/application_controller.rb:20
>> >>> >
>> >>> > C:/wsp/siegerails/examples/rails/app/controllers/application_controller.rb:380:in
>> >>> > `load'
>> >>> >
>> >>> > C:/wsp/siegerails/examples/rails/app/controllers/snoop_controller.rb:1
>> >>> >
>> >>> > C:/wsp/siegerails/examples/rails/app/controllers/snoop_controller.rb:380:in
>> >>> > `load'
>> >>> >
>> >>> >
>> >>> >
>> >>> > On Tue, Jun 16, 2009 at 5:12 AM, Christian Seiler
>> >>> > <chr.seiler@... <mailto:chr.seiler@...>> wrote:
>> >>> >
>> >>> >     I haven't played with it lately so I need to recall..
>> >>> >
>> >>> >     Well, first of all my dev environment is not a real AppEngine
>> >>> > setup,
>> >>> >     it's plain JRuby/Rails plus Datastore. That's all I have used so
>> >>> >     far (no
>> >>> >     memcache or mailer). One thing you need to do is require the
>> >>> >     appengine-api-1.0-sdk-1.2.1.jar to make the AppEngine stuff
>> >>> > available.
>> >>> >     I've put the jar in the lib folder and require it in
>> >>> >     config/development.rb.
>> >>> >
>> >>> >     I think that's all. By the way, I used this example as project
>> >>> >     template:
>> >>> >
>> >>> > http://github.com/nicksieger/jruby-rack/tree/bb907c03c48eb999e7d099068245b91eeda545bf/examples/rails
>> >>> >
>> >>> >     I hope this helps!
>> >>> >
>> >>> >     Carson Welsh wrote:
>> >>> >     >
>> >>> >     > Hi Christian
>> >>> >     >
>> >>> >     > Thanks for the code sample.
>> >>> >     >
>> >>> >     > I am very eager to use a standard Ruby development environment
>> >>> >     for App
>> >>> >     > Engine without restarts as you have described.
>> >>> >     >
>> >>> >     > I have spent several hours trying to use your code sample to
>> >>> >     configure
>> >>> >     > a Rails project with GAE but so far have been unsuccessful.
>> >>> >     >
>> >>> >     > Have you made any other significant changes to your Rails app
>> >>> >     besides
>> >>> >     > what you mentioned?
>> >>> >     >
>> >>> >     > Thanks,
>> >>> >     > Carson
>> >>> >     >
>> >>> >     >
>> >>> >     >
>> >>> >     >
>> >>> >     >
>> >>> >     >     From: *Christian Seiler* <chr.seiler@...
>> >>> >     <mailto:chr.seiler@...>
>> >>> >     >     <mailto:chr.seiler@...
>> >>> > <mailto:chr.seiler@...>>>
>> >>> >     >     Date: Mon, Jun 15, 2009 at 5:37 AM
>> >>> >     >     To: user@...
>> >>> > <mailto:user@...>
>> >>> >     <mailto:user@...
>> >>> > <mailto:user@...>>
>> >>> >     >
>> >>> >     >
>> >>> >     >     My workaround in development mode so far: Simply using
>> >>> >     Webrick as
>> >>> >     >     usual
>> >>> >     >     plus setting up the datastore in the controller
>> >>> >     >     (application_controller.rb).
>> >>> >     >
>> >>> >     >      if Rails.env=='development'
>> >>> >     >        before_filter :setup_datastore
>> >>> >     >        after_filter  :teardown_datastore
>> >>> >     >      end
>> >>> >     >
>> >>> >     >      protected
>> >>> >     >
>> >>> >     >        if Rails.env=='development'
>> >>> >     >          import com.google.apphosting.api.ApiProxy
>> >>> >     >          import
>> >>> >     >
>> >>> > com.google.appengine.api.datastore.dev.LocalDatastoreService
>> >>> >     >          import
>> >>> >     com.google.appengine.tools.development.ApiProxyLocalImpl
>> >>> >     >
>> >>> >     >          class DevEnvironment
>> >>> >     >            include ApiProxy::Environment
>> >>> >     >            def app_id
>> >>> >     >              'Dev Environment'
>> >>> >     >            end
>> >>> >     >          end
>> >>> >     >
>> >>> >     >          def setup_datastore
>> >>> >     >            ApiProxy.environment_for_current_thread =
>> >>> >     DevEnvironment.new
>> >>> >     >            ApiProxy.delegate =
>> >>> > Class.new(ApiProxyLocalImpl).new
>> >>> >     >     java.io.File.new('.')
>> >>> >     >            #ApiProxy.delegate.set_property
>> >>> >     >     LocalDatastoreService::NO_STORAGE_PROPERTY, 'true'
>> >>> >     >          end
>> >>> >     >
>> >>> >     >          def teardown_datastore
>> >>> >     >
>> >>> >      #ApiProxy.delegate.get_service('datastore_v3').clear_profiles
>> >>> >     >            ApiProxy.delegate = nil
>> >>> >     >            ApiProxy.environment_for_current_thread = nil
>> >>> >     >          end
>> >>> >     >        end
>> >>> >     >
>> >>> >
>> >>> > ---------------------------------------------------------------------
>> >>> >     >     To unsubscribe from this list, please visit:
>> >>> >     >
>> >>> >     >        http://xircles.codehaus.org/manage_email
>> >>> >     >
>> >>> >     >
>> >>> >     >
>> >>> >     >
>> >>> >     >
>> >>> >
>> >>> >
>> >>> >
>> >>> > ---------------------------------------------------------------------
>> >>> >     To unsubscribe from this list, please visit:
>> >>> >
>> >>> >        http://xircles.codehaus.org/manage_email
>> >>> >
>> >>> >
>> >>> >
>> >>>
>> >>>
>> >>> ---------------------------------------------------------------------
>> >>> To unsubscribe from this list, please visit:
>> >>>
>> >>>    http://xircles.codehaus.org/manage_email
>> >>>
>> >>>
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe from this list, please visit:
>> >
>> >    http://xircles.codehaus.org/manage_email
>> >
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Google App Engine Rails Template

by Chris Collins-10 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Josh,

I just tried Ryan's suggestion with Ola's yarbl sample and automatic reloading seems to be working now. Wish I'd tried this sooner! All I did was change "production" to "development" in web.xml.

The line from development.rb that seems to achieve this is this one:

config.cache_classes = false

Just in case you need the rest of Ola's development.rb for reference, it's here:

http://github.com/olabini/yarbl/tree/master

Thanks, Ryan.

Chris


On Tue, Jun 16, 2009 at 7:02 PM, Josh Moore <joshsmoore@...> wrote:
HI I agree with Ryan that it is best to develop under the devserver so that there no surprises when you go to deploy.  Unfortunately, I have tried using development mode with the devserver but it does not work.  When Rails tries to reload the ruby files it throws a security exception.  However if you make to changes to the production.rb you can atleast get auto reload of the HTML and CSS files.  Check out http://www.codingforrent.com/posts/7002 for more details.  If you just want a quick answer here is what you need to change:

config.action_controller.perform_caching = false 
config.action_view.cache_template_loading = false

It will not speed up the ruby development, but at least you can use unit tests to help with that.

Josh Moore

On Wed, Jun 17, 2009 at 5:11 AM, Ryan Brown <ribrdb@...> wrote:
First of all, I really recommend doing your development under the App
Engine dev_appserver. There's plenty of ways to get automatic
reloading. It sounds like this template already sets up symbolic links
for you. In that case you probably just need to edit you web.xml to
set your environment to development instead of production. Just make
sure you set it back before deploying to production.

Second, if you want to set up a test datastore I suggest using the
AppEngine::Testing module from the appengine-apis gem. The easiest way
is to require 'appengine-apis/local_boot'.  This will add the
necessary jars to your class path and read  your appengine-web.xml to
set you up with the same on disk datastore that dev_appserver uses.
It does nothing if things were already configured by dev_appserver or
the prod servers, so it should be fine to just add this to your
environment.rb
You can also call AppEngine::Testing::install_test_datastore if you
want an in-memory datastore for unittests.

-- Ryan Brown



On Tue, Jun 16, 2009 at 12:38 PM, Carson Welsh<carsonwelsh@...> wrote:
> Ignore my last message. Sorry.
>
> I had a whitespace mistake on this line:
>
> ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new java.io.File.new('.')
>
> But I'm still curious why those two lines are commented out in
> setup_datastore and teardown_datastore.
>
>
>
> On Tue, Jun 16, 2009 at 3:31 PM, Carson Welsh<carsonwelsh@...> wrote:
>> Thanks. Cleared that hurdle.
>>
>> Now the error I'm getting is inside the code you added to
>> application_controller.rb:
>>
>> "wrong # of arguments for constructor" in
>> application_controller.rb:32:in `setup_datastore'
>>
>> Looks like the problem is in the second line of the setup_datastore method.
>>
>> Did you do any customization here?
>>
>> Also, probably not related to this error I'm getting but, it looks
>> like maybe you commented out those two lines beginning with
>> "ApiProxy"? If so, was there a reason?
>>
>>    def setup_datastore
>>      ApiProxy.environment_for_current_thread = DevEnvironment.new
>>      ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new
>>      java.io.File.new('.')
>>      #ApiProxy.delegate.set_property
>> LocalDatastoreService::NO_STORAGE_PROPERTY, 'true'
>>    end
>>
>>    def teardown_datastore
>>      #ApiProxy.delegate.get_service('datastore_v3').clear_profiles
>>      ApiProxy.delegate = nil
>>      ApiProxy.environment_for_current_thread = nil
>>    end
>>
>>
>>
>> On Tue, Jun 16, 2009 at 2:45 PM, Christian Seiler <chr.seiler@...> wrote:
>>>
>>> Forgot about two other jar files:
>>>
>>> appengine-api-stubs-1.2.1.jar
>>> appengine-local-runtime-1.2.1.jar
>>>
>>> But you shouldn't put them into the lib folder, because I think Warbler
>>> would pick them up and include them in the war file. You don't want
>>> these libs on AppEngine.
>>>
>>>
>>> Carson Welsh wrote:
>>> >
>>> > Hi Christian,
>>> >
>>> > I wonder if you have any idea what might be going wrong here. I
>>> > downloaded the Nick Sieger template and added your addition to the
>>> > application_controller.rb, added the appengine-api-1.0-sdk-1.2.1.jar
>>> > to the lib folder and require it in config/development.rb. But I get
>>> > the following error after I start the application:
>>> >
>>> > NameError in SnoopController#index
>>> >
>>> > cannot load Java class
>>> > com.google.appengine.api.datastore.dev.LocalDatastoreService
>>> >
>>> > RAILS_ROOT: C:/wsp/siegerails/examples/rails
>>> >
>>> > Application Trace | Framework Trace | Full Trace
>>> > C:/jr/lib/ruby/site_ruby/1.8/builtin/javasupport/core_ext/object.rb:87:in
>>> > `get_proxy_or_package_under_package'
>>> > C:/jr/lib/ruby/site_ruby/1.8/builtin/javasupport/java.rb:51:in
>>> > `method_missing'
>>> > C:/wsp/siegerails/examples/rails/app/controllers/application_controller.rb:20
>>> > C:/wsp/siegerails/examples/rails/app/controllers/application_controller.rb:380:in
>>> > `load'
>>> > C:/wsp/siegerails/examples/rails/app/controllers/snoop_controller.rb:1
>>> > C:/wsp/siegerails/examples/rails/app/controllers/snoop_controller.rb:380:in
>>> > `load'
>>> >
>>> >
>>> >
>>> > On Tue, Jun 16, 2009 at 5:12 AM, Christian Seiler
>>> > <chr.seiler@... <mailto:chr.seiler@...>> wrote:
>>> >
>>> >     I haven't played with it lately so I need to recall..
>>> >
>>> >     Well, first of all my dev environment is not a real AppEngine setup,
>>> >     it's plain JRuby/Rails plus Datastore. That's all I have used so
>>> >     far (no
>>> >     memcache or mailer). One thing you need to do is require the
>>> >     appengine-api-1.0-sdk-1.2.1.jar to make the AppEngine stuff available.
>>> >     I've put the jar in the lib folder and require it in
>>> >     config/development.rb.
>>> >
>>> >     I think that's all. By the way, I used this example as project
>>> >     template:
>>> >     http://github.com/nicksieger/jruby-rack/tree/bb907c03c48eb999e7d099068245b91eeda545bf/examples/rails
>>> >
>>> >     I hope this helps!
>>> >
>>> >     Carson Welsh wrote:
>>> >     >
>>> >     > Hi Christian
>>> >     >
>>> >     > Thanks for the code sample.
>>> >     >
>>> >     > I am very eager to use a standard Ruby development environment
>>> >     for App
>>> >     > Engine without restarts as you have described.
>>> >     >
>>> >     > I have spent several hours trying to use your code sample to
>>> >     configure
>>> >     > a Rails project with GAE but so far have been unsuccessful.
>>> >     >
>>> >     > Have you made any other significant changes to your Rails app
>>> >     besides
>>> >     > what you mentioned?
>>> >     >
>>> >     > Thanks,
>>> >     > Carson
>>> >     >
>>> >     >
>>> >     >
>>> >     >
>>> >     >
>>> >     >     From: *Christian Seiler* <chr.seiler@...
>>> >     <mailto:chr.seiler@...>
>>> >     >     <mailto:chr.seiler@... <mailto:chr.seiler@...>>>
>>> >     >     Date: Mon, Jun 15, 2009 at 5:37 AM
>>> >     >     To: user@... <mailto:user@...>
>>> >     <mailto:user@... <mailto:user@...>>
>>> >     >
>>> >     >
>>> >     >     My workaround in development mode so far: Simply using
>>> >     Webrick as
>>> >     >     usual
>>> >     >     plus setting up the datastore in the controller
>>> >     >     (application_controller.rb).
>>> >     >
>>> >     >      if Rails.env=='development'
>>> >     >        before_filter :setup_datastore
>>> >     >        after_filter  :teardown_datastore
>>> >     >      end
>>> >     >
>>> >     >      protected
>>> >     >
>>> >     >        if Rails.env=='development'
>>> >     >          import com.google.apphosting.api.ApiProxy
>>> >     >          import
>>> >     >     com.google.appengine.api.datastore.dev.LocalDatastoreService
>>> >     >          import
>>> >     com.google.appengine.tools.development.ApiProxyLocalImpl
>>> >     >
>>> >     >          class DevEnvironment
>>> >     >            include ApiProxy::Environment
>>> >     >            def app_id
>>> >     >              'Dev Environment'
>>> >     >            end
>>> >     >          end
>>> >     >
>>> >     >          def setup_datastore
>>> >     >            ApiProxy.environment_for_current_thread =
>>> >     DevEnvironment.new
>>> >     >            ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new
>>> >     >     java.io.File.new('.')
>>> >     >            #ApiProxy.delegate.set_property
>>> >     >     LocalDatastoreService::NO_STORAGE_PROPERTY, 'true'
>>> >     >          end
>>> >     >
>>> >     >          def teardown_datastore
>>> >     >
>>> >      #ApiProxy.delegate.get_service('datastore_v3').clear_profiles
>>> >     >            ApiProxy.delegate = nil
>>> >     >            ApiProxy.environment_for_current_thread = nil
>>> >     >          end
>>> >     >        end
>>> >     >
>>> >     ---------------------------------------------------------------------
>>> >     >     To unsubscribe from this list, please visit:
>>> >     >
>>> >     >        http://xircles.codehaus.org/manage_email
>>> >     >
>>> >     >
>>> >     >
>>> >     >
>>> >     >
>>> >
>>> >
>>> >     ---------------------------------------------------------------------
>>> >     To unsubscribe from this list, please visit:
>>> >
>>> >        http://xircles.codehaus.org/manage_email
>>> >
>>> >
>>> >
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>    http://xircles.codehaus.org/manage_email
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





Re: Google App Engine Rails Template

by Christian Seiler-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Carson Welsh wrote:

> Thanks. Cleared that hurdle.
>
> Now the error I'm getting is inside the code you added to
> application_controller.rb:
>
> "wrong # of arguments for constructor" in
> application_controller.rb:32:in `setup_datastore'
>
> Looks like the problem is in the second line of the setup_datastore method.
>
> Did you do any customization here?
>
> Also, probably not related to this error I'm getting but, it looks
> like maybe you commented out those two lines beginning with
> "ApiProxy"? If so, was there a reason?
>  
http://code.google.com/appengine/docs/java/howto/unittesting.html#Writing_Datastore_Tests

-> describes how to write datastore tests. I took the code and adapted
it to not destroy the data every time (something you want to have in
tests but not in dev mode of course)

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Google App Engine Rails Template

by joshmoore-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Chris,

When I tried that I got this exception:

SEVERE: [1245197971854000] javax.servlet.ServletContext log: Exception caught
java.security.AccessControlException: access denied (java.io.FilePermission /Users/joshmoore/code/rails_turbine/app/views/layouts/** read)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:122)
at java.lang.SecurityManager.checkRead(SecurityManager.java:871)
at java.io.File.isDirectory(File.java:752)
at org.jruby.util.Dir.glob_helper(Dir.java:641)

It seems like the security manager is not allowing the reloading of the classes.  I would be interested in learning how you got around this exception.

Josh

On Wed, Jun 17, 2009 at 7:42 AM, Chris Collins <xoptop@...> wrote:
Josh,

I just tried Ryan's suggestion with Ola's yarbl sample and automatic reloading seems to be working now. Wish I'd tried this sooner! All I did was change "production" to "development" in web.xml.

The line from development.rb that seems to achieve this is this one:

config.cache_classes = false

Just in case you need the rest of Ola's development.rb for reference, it's here:

http://github.com/olabini/yarbl/tree/master

Thanks, Ryan.

Chris


On Tue, Jun 16, 2009 at 7:02 PM, Josh Moore <joshsmoore@...> wrote:
HI I agree with Ryan that it is best to develop under the devserver so that there no surprises when you go to deploy.  Unfortunately, I have tried using development mode with the devserver but it does not work.  When Rails tries to reload the ruby files it throws a security exception.  However if you make to changes to the production.rb you can atleast get auto reload of the HTML and CSS files.  Check out http://www.codingforrent.com/posts/7002 for more details.  If you just want a quick answer here is what you need to change:

config.action_controller.perform_caching = false 
config.action_view.cache_template_loading = false

It will not speed up the ruby development, but at least you can use unit tests to help with that.

Josh Moore

On Wed, Jun 17, 2009 at 5:11 AM, Ryan Brown <ribrdb@...> wrote:
First of all, I really recommend doing your development under the App
Engine dev_appserver. There's plenty of ways to get automatic
reloading. It sounds like this template already sets up symbolic links
for you. In that case you probably just need to edit you web.xml to
set your environment to development instead of production. Just make
sure you set it back before deploying to production.

Second, if you want to set up a test datastore I suggest using the
AppEngine::Testing module from the appengine-apis gem. The easiest way
is to require 'appengine-apis/local_boot'.  This will add the
necessary jars to your class path and read  your appengine-web.xml to
set you up with the same on disk datastore that dev_appserver uses.
It does nothing if things were already configured by dev_appserver or
the prod servers, so it should be fine to just add this to your
environment.rb
You can also call AppEngine::Testing::install_test_datastore if you
want an in-memory datastore for unittests.

-- Ryan Brown



On Tue, Jun 16, 2009 at 12:38 PM, Carson Welsh<carsonwelsh@...> wrote:
> Ignore my last message. Sorry.
>
> I had a whitespace mistake on this line:
>
> ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new java.io.File.new('.')
>
> But I'm still curious why those two lines are commented out in
> setup_datastore and teardown_datastore.
>
>
>
> On Tue, Jun 16, 2009 at 3:31 PM, Carson Welsh<carsonwelsh@...> wrote:
>> Thanks. Cleared that hurdle.
>>
>> Now the error I'm getting is inside the code you added to
>> application_controller.rb:
>>
>> "wrong # of arguments for constructor" in
>> application_controller.rb:32:in `setup_datastore'
>>
>> Looks like the problem is in the second line of the setup_datastore method.
>>
>> Did you do any customization here?
>>
>> Also, probably not related to this error I'm getting but, it looks
>> like maybe you commented out those two lines beginning with
>> "ApiProxy"? If so, was there a reason?
>>
>>    def setup_datastore
>>      ApiProxy.environment_for_current_thread = DevEnvironment.new
>>      ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new
>>      java.io.File.new('.')
>>      #ApiProxy.delegate.set_property
>> LocalDatastoreService::NO_STORAGE_PROPERTY, 'true'
>>    end
>>
>>    def teardown_datastore
>>      #ApiProxy.delegate.get_service('datastore_v3').clear_profiles
>>      ApiProxy.delegate = nil
>>      ApiProxy.environment_for_current_thread = nil
>>    end
>>
>>
>>
>> On Tue, Jun 16, 2009 at 2:45 PM, Christian Seiler <chr.seiler@...> wrote:
>>>
>>> Forgot about two other jar files:
>>>
>>> appengine-api-stubs-1.2.1.jar
>>> appengine-local-runtime-1.2.1.jar
>>>
>>> But you shouldn't put them into the lib folder, because I think Warbler
>>> would pick them up and include them in the war file. You don't want
>>> these libs on AppEngine.
>>>
>>>
>>> Carson Welsh wrote:
>>> >
>>> > Hi Christian,
>>> >
>>> > I wonder if you have any idea what might be going wrong here. I
>>> > downloaded the Nick Sieger template and added your addition to the
>>> > application_controller.rb, added the appengine-api-1.0-sdk-1.2.1.jar
>>> > to the lib folder and require it in config/development.rb. But I get
>>> > the following error after I start the application:
>>> >
>>> > NameError in SnoopController#index
>>> >
>>> > cannot load Java class
>>> > com.google.appengine.api.datastore.dev.LocalDatastoreService
>>> >
>>> > RAILS_ROOT: C:/wsp/siegerails/examples/rails
>>> >
>>> > Application Trace | Framework Trace | Full Trace
>>> > C:/jr/lib/ruby/site_ruby/1.8/builtin/javasupport/core_ext/object.rb:87:in
>>> > `get_proxy_or_package_under_package'
>>> > C:/jr/lib/ruby/site_ruby/1.8/builtin/javasupport/java.rb:51:in
>>> > `method_missing'
>>> > C:/wsp/siegerails/examples/rails/app/controllers/application_controller.rb:20
>>> > C:/wsp/siegerails/examples/rails/app/controllers/application_controller.rb:380:in
>>> > `load'
>>> > C:/wsp/siegerails/examples/rails/app/controllers/snoop_controller.rb:1
>>> > C:/wsp/siegerails/examples/rails/app/controllers/snoop_controller.rb:380:in
>>> > `load'
>>> >
>>> >
>>> >
>>> > On Tue, Jun 16, 2009 at 5:12 AM, Christian Seiler
>>> > <chr.seiler@... <mailto:chr.seiler@...>> wrote:
>>> >
>>> >     I haven't played with it lately so I need to recall..
>>> >
>>> >     Well, first of all my dev environment is not a real AppEngine setup,
>>> >     it's plain JRuby/Rails plus Datastore. That's all I have used so
>>> >     far (no
>>> >     memcache or mailer). One thing you need to do is require the
>>> >     appengine-api-1.0-sdk-1.2.1.jar to make the AppEngine stuff available.
>>> >     I've put the jar in the lib folder and require it in
>>> >     config/development.rb.
>>> >
>>> >     I think that's all. By the way, I used this example as project
>>> >     template:
>>> >     http://github.com/nicksieger/jruby-rack/tree/bb907c03c48eb999e7d099068245b91eeda545bf/examples/rails
>>> >
>>> >     I hope this helps!
>>> >
>>> >     Carson Welsh wrote:
>>> >     >
>>> >     > Hi Christian
>>> >     >
>>> >     > Thanks for the code sample.
>>> >     >
>>> >     > I am very eager to use a standard Ruby development environment
>>> >     for App
>>> >     > Engine without restarts as you have described.
>>> >     >
>>> >     > I have spent several hours trying to use your code sample to
>>> >     configure
>>> >     > a Rails project with GAE but so far have been unsuccessful.
>>> >     >
>>> >     > Have you made any other significant changes to your Rails app
>>> >     besides
>>> >     > what you mentioned?
>>> >     >
>>> >     > Thanks,
>>> >     > Carson
>>> >     >
>>> >     >
>>> >     >
>>> >     >
>>> >     >
>>> >     >     From: *Christian Seiler* <chr.seiler@...
>>> >     <mailto:chr.seiler@...>
>>> >     >     <mailto:chr.seiler@... <mailto:chr.seiler@...>>>
>>> >     >     Date: Mon, Jun 15, 2009 at 5:37 AM
>>> >     >     To: user@... <mailto:user@...>
>>> >     <mailto:user@... <mailto:user@...>>
>>> >     >
>>> >     >
>>> >     >     My workaround in development mode so far: Simply using
>>> >     Webrick as
>>> >     >     usual
>>> >     >     plus setting up the datastore in the controller
>>> >     >     (application_controller.rb).
>>> >     >
>>> >     >      if Rails.env=='development'
>>> >     >        before_filter :setup_datastore
>>> >     >        after_filter  :teardown_datastore
>>> >     >      end
>>> >     >
>>> >     >      protected
>>> >     >
>>> >     >        if Rails.env=='development'
>>> >     >          import com.google.apphosting.api.ApiProxy
>>> >     >          import
>>> >     >     com.google.appengine.api.datastore.dev.LocalDatastoreService
>>> >     >          import
>>> >     com.google.appengine.tools.development.ApiProxyLocalImpl
>>> >     >
>>> >     >          class DevEnvironment
>>> >     >            include ApiProxy::Environment
>>> >     >            def app_id
>>> >     >              'Dev Environment'
>>> >     >            end
>>> >     >          end
>>> >     >
>>> >     >          def setup_datastore
>>> >     >            ApiProxy.environment_for_current_thread =
>>> >     DevEnvironment.new
>>> >     >            ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new
>>> >     >     java.io.File.new('.')
>>> >     >            #ApiProxy.delegate.set_property
>>> >     >     LocalDatastoreService::NO_STORAGE_PROPERTY, 'true'
>>> >     >          end
>>> >     >
>>> >     >          def teardown_datastore
>>> >     >
>>> >      #ApiProxy.delegate.get_service('datastore_v3').clear_profiles
>>> >     >            ApiProxy.delegate = nil
>>> >     >            ApiProxy.environment_for_current_thread = nil
>>> >     >          end
>>> >     >        end
>>> >     >
>>> >     ---------------------------------------------------------------------
>>> >     >     To unsubscribe from this list, please visit:
>>> >     >
>>> >     >        http://xircles.codehaus.org/manage_email
>>> >     >
>>> >     >
>>> >     >
>>> >     >
>>> >     >
>>> >
>>> >
>>> >     ---------------------------------------------------------------------
>>> >     To unsubscribe from this list, please visit:
>>> >
>>> >        http://xircles.codehaus.org/manage_email
>>> >
>>> >
>>> >
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>    http://xircles.codehaus.org/manage_email
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email






Re: Google App Engine Rails Template

by Chris Collins-10 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Josh,

Without seeing your code I'm not sure why you're getting that. I can send you a zip file of my local version of yarbl, which I know is working, and you can compare it against your app if you like. I'll send it to you in a moment.

Chris


On Tue, Jun 16, 2009 at 8:22 PM, Josh Moore <joshsmoore@...> wrote:
Chris,

When I tried that I got this exception:

SEVERE: [1245197971854000] javax.servlet.ServletContext log: Exception caught
java.security.AccessControlException: access denied (java.io.FilePermission /Users/joshmoore/code/rails_turbine/app/views/layouts/** read)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:122)
at java.lang.SecurityManager.checkRead(SecurityManager.java:871)
at java.io.File.isDirectory(File.java:752)
at org.jruby.util.Dir.glob_helper(Dir.java:641)

It seems like the security manager is not allowing the reloading of the classes.  I would be interested in learning how you got around this exception.

Josh

On Wed, Jun 17, 2009 at 7:42 AM, Chris Collins <xoptop@...> wrote:
Josh,

I just tried Ryan's suggestion with Ola's yarbl sample and automatic reloading seems to be working now. Wish I'd tried this sooner! All I did was change "production" to "development" in web.xml.

The line from development.rb that seems to achieve this is this one:

config.cache_classes = false

Just in case you need the rest of Ola's development.rb for reference, it's here:

http://github.com/olabini/yarbl/tree/master

Thanks, Ryan.

Chris


On Tue, Jun 16, 2009 at 7:02 PM, Josh Moore <joshsmoore@...> wrote:
HI I agree with Ryan that it is best to develop under the devserver so that there no surprises when you go to deploy.  Unfortunately, I have tried using development mode with the devserver but it does not work.  When Rails tries to reload the ruby files it throws a security exception.  However if you make to changes to the production.rb you can atleast get auto reload of the HTML and CSS files.  Check out http://www.codingforrent.com/posts/7002 for more details.  If you just want a quick answer here is what you need to change:

config.action_controller.perform_caching = false 
config.action_view.cache_template_loading = false

It will not speed up the ruby development, but at least you can use unit tests to help with that.

Josh Moore

On Wed, Jun 17, 2009 at 5:11 AM, Ryan Brown <ribrdb@...> wrote:
First of all, I really recommend doing your development under the App
Engine dev_appserver. There's plenty of ways to get automatic
reloading. It sounds like this template already sets up symbolic links
for you. In that case you probably just need to edit you web.xml to
set your environment to development instead of production. Just make
sure you set it back before deploying to production.

Second, if you want to set up a test datastore I suggest using the
AppEngine::Testing module from the appengine-apis gem. The easiest way
is to require 'appengine-apis/local_boot'.  This will add the
necessary jars to your class path and read  your appengine-web.xml to
set you up with the same on disk datastore that dev_appserver uses.
It does nothing if things were already configured by dev_appserver or
the prod servers, so it should be fine to just add this to your
environment.rb
You can also call AppEngine::Testing::install_test_datastore if you
want an in-memory datastore for unittests.

-- Ryan Brown



On Tue, Jun 16, 2009 at 12:38 PM, Carson Welsh<carsonwelsh@...> wrote:
> Ignore my last message. Sorry.
>
> I had a whitespace mistake on this line:
>
> ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new java.io.File.new('.')
>
> But I'm still curious why those two lines are commented out in
> setup_datastore and teardown_datastore.
>
>
>
> On Tue, Jun 16, 2009 at 3:31 PM, Carson Welsh<carsonwelsh@...> wrote:
>> Thanks. Cleared that hurdle.
>>
>> Now the error I'm getting is inside the code you added to
>> application_controller.rb:
>>
>> "wrong # of arguments for constructor" in
>> application_controller.rb:32:in `setup_datastore'
>>
>> Looks like the problem is in the second line of the setup_datastore method.
>>
>> Did you do any customization here?
>>
>> Also, probably not related to this error I'm getting but, it looks
>> like maybe you commented out those two lines beginning with
>> "ApiProxy"? If so, was there a reason?
>>
>>    def setup_datastore
>>      ApiProxy.environment_for_current_thread = DevEnvironment.new
>>      ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new
>>      java.io.File.new('.')
>>      #ApiProxy.delegate.set_property
>> LocalDatastoreService::NO_STORAGE_PROPERTY, 'true'
>>    end
>>
>>    def teardown_datastore
>>      #ApiProxy.delegate.get_service('datastore_v3').clear_profiles
>>      ApiProxy.delegate = nil
>>      ApiProxy.environment_for_current_thread = nil
>>    end
>>
>>
>>
>> On Tue, Jun 16, 2009 at 2:45 PM, Christian Seiler <chr.seiler@...> wrote:
>>>
>>> Forgot about two other jar files:
>>>
>>> appengine-api-stubs-1.2.1.jar
>>> appengine-local-runtime-1.2.1.jar
>>>
>>> But you shouldn't put them into the lib folder, because I think Warbler
>>> would pick them up and include them in the war file. You don't want
>>> these libs on AppEngine.
>>>
>>>
>>> Carson Welsh wrote:
>>> >
>>> > Hi Christian,
>>> >
>>> > I wonder if you have any idea what might be going wrong here. I
>>> > downloaded the Nick Sieger template and added your addition to the
>>> > application_controller.rb, added the appengine-api-1.0-sdk-1.2.1.jar
>>> > to the lib folder and require it in config/development.rb. But I get
>>> > the following error after I start the application:
>>> >
>>> > NameError in SnoopController#index
>>> >
>>> > cannot load Java class
>>> > com.google.appengine.api.datastore.dev.LocalDatastoreService
>>> >
>>> > RAILS_ROOT: C:/wsp/siegerails/examples/rails
>>> >
>>> > Application Trace | Framework Trace | Full Trace
>>> > C:/jr/lib/ruby/site_ruby/1.8/builtin/javasupport/core_ext/object.rb:87:in
>>> > `get_proxy_or_package_under_package'
>>> > C:/jr/lib/ruby/site_ruby/1.8/builtin/javasupport/java.rb:51:in
>>> > `method_missing'
>>> > C:/wsp/siegerails/examples/rails/app/controllers/application_controller.rb:20
>>> > C:/wsp/siegerails/examples/rails/app/controllers/application_controller.rb:380:in
>>> > `load'
>>> > C:/wsp/siegerails/examples/rails/app/controllers/snoop_controller.rb:1
>>> > C:/wsp/siegerails/examples/rails/app/controllers/snoop_controller.rb:380:in
>>> > `load'
>>> >
>>> >
>>> >
>>> > On Tue, Jun 16, 2009 at 5:12 AM, Christian Seiler
>>> > <chr.seiler@... <mailto:chr.seiler@...>> wrote:
>>> >
>>> >     I haven't played with it lately so I need to recall..
>>> >
>>> >     Well, first of all my dev environment is not a real AppEngine setup,
>>> >     it's plain JRuby/Rails plus Datastore. That's all I have used so
>>> >     far (no
>>> >     memcache or mailer). One thing you need to do is require the
>>> >     appengine-api-1.0-sdk-1.2.1.jar to make the AppEngine stuff available.
>>> >     I've put the jar in the lib folder and require it in
>>> >     config/development.rb.
>>> >
>>> >     I think that's all. By the way, I used this example as project
>>> >     template:
>>> >     http://github.com/nicksieger/jruby-rack/tree/bb907c03c48eb999e7d099068245b91eeda545bf/examples/rails
>>> >
>>> >     I hope this helps!
>>> >
>>> >     Carson Welsh wrote:
>>> >     >
>>> >     > Hi Christian
>>> >     >
>>> >     > Thanks for the code sample.
>>> >     >
>>> >     > I am very eager to use a standard Ruby development environment
>>> >     for App
>>> >     > Engine without restarts as you have described.
>>> >     >
>>> >     > I have spent several hours trying to use your code sample to
>>> >     configure
>>> >     > a Rails project with GAE but so far have been unsuccessful.
>>> >     >
>>> >     > Have you made any other significant changes to your Rails app
>>> >     besides
>>> >     > what you mentioned?
>>> >     >
>>> >     > Thanks,
>>> >     > Carson
>>> >     >
>>> >     >
>>> >     >
>>> >     >
>>> >     >
>>> >     >     From: *Christian Seiler* <chr.seiler@...
>>> >     <mailto:chr.seiler@...>
>>> >     >     <mailto:chr.seiler@... <mailto:chr.seiler@...>>>
>>> >     >     Date: Mon, Jun 15, 2009 at 5:37 AM
>>> >     >     To: user@... <mailto:user@...>
>>> >     <mailto:user@... <mailto:user@...>>
>>> >     >
>>> >     >
>>> >     >     My workaround in development mode so far: Simply using
>>> >     Webrick as
>>> >     >     usual
>>> >     >     plus setting up the datastore in the controller
>>> >     >     (application_controller.rb).
>>> >     >
>>> >     >      if Rails.env=='development'
>>> >     >        before_filter :setup_datastore
>>> >     >        after_filter  :teardown_datastore
>>> >     >      end
>>> >     >
>>> >     >      protected
>>> >     >
>>> >     >        if Rails.env=='development'
>>> >     >          import com.google.apphosting.api.ApiProxy
>>> >     >          import
>>> >     >     com.google.appengine.api.datastore.dev.LocalDatastoreService
>>> >     >          import
>>> >     com.google.appengine.tools.development.ApiProxyLocalImpl
>>> >     >
>>> >     >          class DevEnvironment
>>> >     >            include ApiProxy::Environment
>>> >     >            def app_id
>>> >     >              'Dev Environment'
>>> >     >            end
>>> >     >          end
>>> >     >
>>> >     >          def setup_datastore
>>> >     >            ApiProxy.environment_for_current_thread =
>>> >     DevEnvironment.new
>>> >     >            ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new
>>> >     >     java.io.File.new('.')
>>> >     >            #ApiProxy.delegate.set_property
>>> >     >     LocalDatastoreService::NO_STORAGE_PROPERTY, 'true'
>>> >     >          end
>>> >     >
>>> >     >          def teardown_datastore
>>> >     >
>>> >      #ApiProxy.delegate.get_service('datastore_v3').clear_profiles
>>> >     >            ApiProxy.delegate = nil
>>> >     >            ApiProxy.environment_for_current_thread = nil
>>> >     >          end
>>> >     >        end
>>> >     >
>>> >     ---------------------------------------------------------------------
>>> >     >     To unsubscribe from this list, please visit:
>>> >     >
>>> >     >        http://xircles.codehaus.org/manage_email
>>> >     >
>>> >     >
>>> >     >
>>> >     >
>>> >     >
>>> >
>>> >
>>> >     ---------------------------------------------------------------------
>>> >     To unsubscribe from this list, please visit:
>>> >
>>> >        http://xircles.codehaus.org/manage_email
>>> >
>>> >
>>> >
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>    http://xircles.codehaus.org/manage_email
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email







Re: Google App Engine Rails Template

by Carson Welsh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Thanks for the link, Christian.


> Also, probably not related to this error I'm getting but, it looks
> like maybe you commented out those two lines beginning with
> "ApiProxy"? If so, was there a reason?
>
http://code.google.com/appengine/docs/java/howto/unittesting.html#Writing_Datastore_Tests

-> describes how to write datastore tests. I took the code and adapted
it to not destroy the data every time (something you want to have in
tests but not in dev mode of course)

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




Parent Message unknown Google App Engine Rails Template

by Matt Brady-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Josh,

Which version of JRuby did you use for jruby-core.jar and ruby-stdlib.jar?

Did you copy Ola's older versions or have you built new jars from the latest release of JRuby?


Hi,

I just finished posting a rails template that creates an app ready to deploy on the Google App Engine.  Check out the blog post http://www.codingforrent.com/posts/8001 and the template at http://github.com/joshsmoore/gaej_rails_template/tree/master.  It is still a bit of work in progress.  But, it should take care of the basics of getting a Rails app set up for deployment on the Google App Engine.  Please tell me what you think.

Josh


Re: Google App Engine Rails Template

by joshmoore-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Matt,

I am using JRuby 1.3.0.  I think I figured out the problem.  I actually think it has something to do with the links.  When I remove then and just use plan folders my original setup works fine.  I am going to post a question on the app engine user group and see if this is expected behavior or a bug.

Josh

On Sat, Jun 20, 2009 at 12:50 AM, Matt Brady <mttbrd01@...> wrote:
Josh,

Which version of JRuby did you use for jruby-core.jar and ruby-stdlib.jar?

Did you copy Ola's older versions or have you built new jars from the latest release of JRuby?



Hi,

I just finished posting a rails template that creates an app ready to deploy on the Google App Engine.  Check out the blog post http://www.codingforrent.com/posts/8001 and the template at http://github.com/joshsmoore/gaej_rails_template/tree/master.  It is still a bit of work in progress.  But, it should take care of the basics of getting a Rails app set up for deployment on the Google App Engine.  Please tell me what you think.

Josh


< Prev | 1 - 2 | Next >