I''m accustomed to making plugins for Rails 2, and recently updated those for Rails 3 (minor differences in structure). Spent most of this week figuring out how to make most of those gems. One of them I am having trouble with -- this one involves an /app directory with some helpers and some views. It has worked great as a Rails2 and even Rails3 plugin. As a gem, I can''t seem to get Rails to see the files in /app. I''ve been using jeweler. I don''t use git, so I have been manually specifying files like this: Jeweler::Tasks.new do |gem| #.... gem.files.include(''app/**/*.rb'') gem.files.include(''lib/**/*.rb'') #.... end That''s apparently not enough. The code in the gem works until the main app hits something needed from the gem''s /app folder. I''m missing something. Googling and trial & error are failing me. What clue say ye? Thx. -- gw -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Devise ( http://github.com/plataformatec/devise/ ) adds some views, controllers and helpers so you can look at the code. Maybe you are missing the fact that you need Rails::Engine ? http://github.com/plataformatec/devise/blob/master/lib/devise/rails.rb I think that Yehuda Katz has a post about it. Robert Pankowecki -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Robert Pankowecki wrote:> Devise ( http://github.com/plataformatec/devise/ ) adds some views, > controllers and helpers so you can look at the code. Maybe you are > missing the fact that you need Rails::Engine ? > http://github.com/plataformatec/devise/blob/master/lib/devise/rails.rbThanks for the example. Interesting that it doesn''t use the same pattern as all the blog posts I can find use (re: engines.rb file). Hmmm.... -- gw -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Greg, I have a working example that covers a bunch of gem features, it might help you: http://keithschacht.com/creating-a-rails-3-engine-plugin-gem/ On Sep 29, 11:20 pm, Greg Willits <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I''m accustomed to making plugins for Rails 2, and recently updated those > for Rails 3 (minor differences in structure). Spent most of this week > figuring out how to make most of those gems. > > One of them I am having trouble with -- this one involves an /app > directory with some helpers and some views. It has worked great as a > Rails2 and even Rails3 plugin. As a gem, I can''t seem to get Rails to > see the files in /app. > > I''ve been using jeweler. I don''t use git, so I have been manually > specifying files like this: > > Jeweler::Tasks.new do |gem| > #.... > gem.files.include(''app/**/*.rb'') > gem.files.include(''lib/**/*.rb'') > #.... > end > > That''s apparently not enough. The code in the gem works until the main > app hits something needed from the gem''s /app folder. > > I''m missing something. Googling and trial & error are failing me. > > What clue say ye? Thx. > > -- gw > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Keith Schacht wrote:> Greg, I have a working example that covers a bunch of gem features, it > might help you: > http://keithschacht.com/creating-a-rails-3-engine-plugin-gem/OK, so to make use of a /app folder, the gem must be an engine. Keith, I''ve been using your example (thanks) and about a half dozen articles, but still running into problems having the contents in the /app folder get included using this: Jeweler::Tasks.new do |gem| #.... gem.files.include(''app/**/*.rb'') gem.files.include(''lib/**/*.rb'') #.... end I''ve converted almost a dozen of my plugins to gems (so I seem to have that pattern at least emulated well (if not yet fully understood)), and now need two engines. I have one sort of working. The basics all work, so I have the engine.rb part worked out, but it is still missing some /app folder content after I create the gem. I think I just spotted a pattern. In this line, gem.files.include(''app/**/*.rb'') I am not familiar with /**/ but I''m now seeing that in the /app folder, a layout like this: So, /app /models model1.rb /views /red_stuff red1.rb.rb /blue_stuff blue1.rb.rb in my installed gem I see /models but not /views -- and I think that''s because /views doesn''t have any .rb files in it. So, I think the root of the problems I''m seeing is understanding the files.include() part of jeweler to get what I need (Note: I am not using git). Looking at the ruby gems docs, I don''t see any examples of files.include -- so it''s still confusing as to which of these settings commands use gem syntax and which uses jeweler syntax. -- gw -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> So, I think the root of the problems I''m seeing is understanding the > files.include() part of jeweler to get what I need (Note: I am not using > git).Oi! What a moron. gem.files.include(''app/**/*.rb'') There are no .rb files in /views! gem.files.include(''app/**/*.rb'') gem.files.include(''app/**/*.erb'') catches them. Major thwak to the forehead. -- gw -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Ah, I didn''t catch that in your post either. Glad to see you figured it out! On Oct 1, 10:56 am, Greg Willits <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> > So, I think the root of the problems I''m seeing is understanding the > > files.include() part of jeweler to get what I need (Note: I am not using > > git). > > Oi! What a moron. > > gem.files.include(''app/**/*.rb'') > > There are no .rb files in /views! > > gem.files.include(''app/**/*.rb'') > gem.files.include(''app/**/*.erb'') > > catches them. > > Major thwak to the forehead. > > -- gw > > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.