Александр Александр - 2 years ago 132
Ruby Question

Creating engine with ruby on rails

I am creating an engine, and I have some problems.

I`m reading this manual

and my project has the following information:

  • path to my main application:

  • path to my engine, myapp:

These are the steps I tried:

  1. I ran this code:
    rails plugin new myapp --mountable

  2. I created the resource in

  3. I added to
    the line
    mount Myapp::Engine => "/myapp"

  4. I ran in the console (/var/www/crs/myapp/test/dummy/) this code:
    rails s

So far so good. However, when I added to the gem file in main app (/var/www/crs/Gemfile ) this line:

gem 'myapp', path: "myapp"

and executed the command


I got the following erros:

The gemspec at /var/www/crs/myapp/myapp.gemspec is not valid. The validation error was '"FIXME" or "TODO" is not a description'
Could not find gem 'myapp' in source at `myapp`.
Source does not contain any versions of 'myapp'

I don't understand where this error is comming from, nor do I know where the file that is having it is. How can I find the troublematic file and how can I fix this?

rob rob
Answer Source

the myapp.gemspec is in your root folder of your engine.

in this file you write a short description (what does your engine does) and some dependecies e.g. the myapp.gemspec will be filled with default values when creating a gem (or a engine)

the configuration looks like the following

Gem::Specification.new do |spec|
  spec.name          = "myengine"
  spec.version       = Myengine::VERSION
  spec.authors       = ["my username"]
  spec.email         = ["my email"]
  spec.summary       = %q{ wow great engine }
  spec.description   = %q{ trust me, its a great engine which is great}
  spec.homepage      = ""
  spec.license       = "MIT"

  spec.files         = `git ls-files -z`.split("\x0")
  spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
  spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
  spec.require_paths = ["lib"]

  spec.add_development_dependency "bundler", "~> 1.7"
  spec.add_development_dependency "rake", "~> 10.0"

and there you find the description with the TODO and FIXME message

btw Brandon Hilkert offers a really good tutorial about engines (http://brandonhilkert.com/blog/how-to-build-a-rails-engine/)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download