I'm working on a project comprising three different applications. They are supposed to share some models and the outer layout. To avoid code duplication, I'm trying to extract the application layout (project_name/app/views/layouts/application.html.haml
) into a gem.
I followed these steps:
- create the base gem structure with
bundle gem common
- place the layout file inside
common/app/views/layouts/application.html.haml
wrote the Gemspec descriptors
# -*- encoding: utf-8 -*- require File.expand_path('../lib/common/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["Arthur Alkmim"] gem.email = ["myemail@here"] gem.description = %q{Common project files} gem.summary = %q{Common project files, including layout and migrations} gem.homepage = "" gem.files = `git ls-files`.split($\) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.name = "common" gem.require_paths = ["lib"] gem.version = Common::VERSION end
commit the changes
gem build common.gemspec
(successful)rake install
(successful)- Place
gem 'common'
in the project Gemfile
But still the project won't load the application layout. What should I do to tell my project it has to load the layout files through the gem?
Thanks in advance.