I have been searching the WHOLE internet for a guide "How to develop plugin" for rails web application? but there was NONE???? I''m trying to do develop this kind of plugins, I hope someone out there can point me on the right direction :) http://www.ruby-forum.com/topic/102607 Thanks for your help :D -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
good place to start for the basics http://wiki.rubyonrails.com/rails/pages/HowTosPlugins On 3/26/07, Jamal Soueidan <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I have been searching the WHOLE internet for a guide "How to develop > plugin" for rails web application? but there was NONE???? > > I''m trying to do develop this kind of plugins, I hope someone out there > can point me on the right direction :) > > http://www.ruby-forum.com/topic/102607 > > Thanks for your help :D > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Chris Hall wrote:> good place to start for the basics > > http://wiki.rubyonrails.com/rails/pages/HowTosPluginsI have already been in there, nothing valuable to start with? Did you take a look at the topic I made, I don''t know if this can be called plugin ? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
perhaps a rake task would be what you want then? On 3/26/07, Jamal Soueidan <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Chris Hall wrote: > > good place to start for the basics > > > > http://wiki.rubyonrails.com/rails/pages/HowTosPlugins > > I have already been in there, nothing valuable to start with? > > Did you take a look at the topic I made, I don''t know if this can be > called plugin ? > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Chris Hall wrote:> perhaps a rake task would be what you want then?I''m unfamiliar with that but it sound cool:P ...after doing some googling I see that the rake task is something like: desc "Configure Subversion for Rails" task :configure_for_svn do system "svn remove log/*" system "svn commit -m ''removing all log files from subversion''" system ''svn propset svn:ignore "*.log" log/'' system "svn update log/" system "svn commit -m ''Ignoring all files in /log/ ending in .log''" end In this case I will face some problem, to update the roube.rb file without replacing it, to add some map.connect to it? Can I store the files somewhere on the internet also :D that would be cool Thanks for your replies :D -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Then Rails::Generator::NamedBase has a method to do this. I found it while making a generator to generate generators. I have yet to use this fun resource but here is the code. m.route_resources(*resources) #from the command.rb def route_resources(*resources) resource_list = resources.map { |r| r.to_sym.inspect }.join('', '') sentinel = ''ActionController::Routing::Routes.draw do |map|'' logger.route "map.resources #{resource_list}" unless options[:pretend] gsub_file ''config/routes.rb'', /(#{Regexp.escape(sentinel)})/mi do |match| "#{match}\n map.resources #{resource_list}\n" end end end Hope this is useful. Stephen Becker IV On 3/26/07, Jamal Soueidan <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Chris Hall wrote: > > perhaps a rake task would be what you want then? > > I''m unfamiliar with that but it sound cool:P > > ...after doing some googling I see that the rake task is something like: > > desc "Configure Subversion for Rails" > task :configure_for_svn do > system "svn remove log/*" > system "svn commit -m ''removing all log files from subversion''" > system ''svn propset svn:ignore "*.log" log/'' > system "svn update log/" > system "svn commit -m ''Ignoring all files in /log/ ending in .log''" > end > > In this case I will face some problem, to update the roube.rb file > without replacing it, to add some map.connect to it? > > Can I store the files somewhere on the internet also :D that would be > cool > > Thanks for your replies :D > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
ruby lang wrote:> Then Rails::Generator::NamedBase has a method to do this. I found it > while> Hope this is useful. > > Stephen Becker IVWhat does this code do exactly? and how do you run it? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I believe it creates the route.rb file with the resources that are passed in, and tries to add it to the current routes. This is a method from the generator base class. When you create a generator its one of the methods you have access to. I did not notice before the gsub_file is another method. I am using a frozen version of rails, but the file I found these in are in the vender/railites/lib/rails_generator/command.rb I was under the impression that you wanted to update the routes file and I believe that this is what this code does. As for using it. I have not. The only place I have seen this used is here http://canofcode.com/rails/repository/6069/trunk/railties/lib/rails_generator/generators/components/resource/resource_generator.rb Looks like they just pass the name of the resource to it. You might have to tweak the out put to the routes file. def gsub_file(relative_destination, regexp, *args, &block) path = destination_path(relative_destination) content = File.read(path).gsub(regexp, *args, &block) File.open(path, ''wb'') { |file| file.write(content) } end Stephen Becker IV On 3/26/07, Jamal Soueidan <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > ruby lang wrote: > > Then Rails::Generator::NamedBase has a method to do this. I found it > > while > > > Hope this is useful. > > > > Stephen Becker IV > > What does this code do exactly? and how do you run it? > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
ruby lang wrote:> I believe it creates the route.rb file with the resources that are > passed > in, and tries to add it to the current routes. This is a method from the> Stephen Becker IVThis seems so complicated, I really thought it should be much easier. Does this mean I cannot reuse my previous code easily in RoR? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 3/26/07, Jamal Soueidan <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > ruby lang wrote: > > I believe it creates the route.rb file with the resources that are > > passed > > in, and tries to add it to the current routes. This is a method from the > > > Stephen Becker IV > > This seems so complicated, I really thought it should be much easier. > > Does this mean I cannot reuse my previous code easily in RoR? > > -- > Posted via http://www.ruby-forum.com/. > > > >You can you reuse your code in RoR applications. Looking at the http://www.ruby-forum.com/topic/102607 post you can make a plugin (which I have not) or a generator. For a generator you can make template of files and then run ruby script/generate that_thing_you_made with_some options_too How complicated are your files? Do they need to dynamic? SVN externals could work too. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
ruby lang wrote:> On 3/26/07, Jamal Soueidan <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> Does this mean I cannot reuse my previous code easily in RoR? >> >> -- >> Posted via http://www.ruby-forum.com/. >> >> > >> > You can you reuse your code in RoR applications. Looking at the > http://www.ruby-forum.com/topic/102607 post you can make a plugin (which > I > have not) or a generator. For a generator you can make template of files > and > then run ruby script/generate that_thing_you_made with_some options_too > > How complicated are your files? Do they need to dynamic? SVN externals > could > work too.Thanks for your reply :) my files is simple.. app/models/user.rb app/controllers/user.rb app/controllers/application.rb (few methods here) but they can be inside /lib/ if this would not make it complicated. app/views/user/ and /config/route.rb (also few routing) last /db/migrate/001_create_users.rb/ (for creating the table) This should be my plugin or what ever it can be called :D Hope someone can help me through this... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---