rails-api not allowing any generation - mongodb

I'm struggling trying to get the configuration of rails-api with the mongo_mapper gem.
I'm using rails v 4.1.1
gemfile looks as follows
source 'https://rubygems.org'
gem 'mongo'
gem 'mongo_mapper', :git => "git://github.com/mongomapper/mongomapper.git", :tag => "v0.13.0.beta2"
gem 'bson_ext'
gem 'railties'
I ran rails-api new test-app --skip-active-record which generates a simple file structure.
.
├── Gemfile
├── Gemfile.lock
├── README.rdoc
├── Rakefile
└── config.ru
After that, per the instructions on the README for mongo_mapper I specified the correct version in my gemfile so that it's compatible with Rails 4.
gem 'mongo_mapper', :git => "git://github.com/mongomapper/mongomapper.git", :tag => "v0.13.0.beta2"
According to
- http://mongomapper.com/documentation/getting-started/rails.html
- How can I get mongo mapper to generate the config/mongo.yml file in Rails 4
I should then be able to run bundle exec rails generate mongo_mapper:config. It was here I started running into issues.
I first realized I need railsties gem since it wasn't even letting me run rails generate.
$ bundle exec rails generate mongo_mapper:config
/Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.6.1/lib/bundler/rubygems_integration.rb:248:in `block in replace_gem': railties is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
from /Users/colinhhart/.rbenv/versions/2.1.0/bin/rails:22:in `<main>'
After adding that gem it allowed me to run bundle exec rails generate mongo_mapper:config but doesn't actually have access to that mongo generator. The output from the command is the standard rails help info including usage, options etc.
Usage:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /Users/colinhhart/.rbenv/versions/2.1.0/bin/ruby
-m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
What I've tried so far
I've tried building out what the generator is supposed to build as is described in this guide
http://technicaldebt.com/getting-started-with-ruby/mongomapper-ith-rails-quickstart/
But then realized that even if I build that out there's obviously still some "glue" that I'm missing, which ties everything together. I built it out just in case and of course it still didn't work.
I've made sure to bundle and and reload the terminal appropriately.
Like I said, I'm pretty sure there's something necessary that gets skipped when I build the rails-api without active record.
Any thoughts on this? Would greatly appreciate the help.
For what it's worth this is the full output when I ran rails-api new my_app --skip-active-record.
$ rails-api new pitfworld_wide_atrocities_db --skip-active-record
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
(erb):19:in `template': undefined method `name' for []:Array (NoMethodError)
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/2.1.0/erb.rb:850:in `eval'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/2.1.0/erb.rb:850:in `result'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/file_manipulation.rb:116:in `block in template'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:53:in `call'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:53:in `render'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in `block (2 levels) in invoke!'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in `open'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in `block in invoke!'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in `call'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in `invoke_with_conflict_check'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:60:in `invoke!'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions.rb:94:in `action'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:25:in `create_file'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/actions/file_manipulation.rb:115:in `template'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/generators/rails/app/app_generator.rb:17:in `template'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/generators/rails/app/app_generator.rb:45:in `gemfile'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/generators/app_base.rb:133:in `build'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/generators/rails/app/app_generator.rb:176:in `create_root_files'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/commands/application.rb:17:in `<top (required)>'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/cli.rb:14:in `<top (required)>'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
from /Users/colinhhart/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/rails-api-0.2.1/bin/rails-api:4:in `<top (required)>'
from /Users/colinhhart/.rbenv/versions/2.1.0/bin/rails-api:23:in `load'
from /Users/colinhhart/.rbenv/versions/2.1.0/bin/rails-api:23:in `<main>'
Solution
I came across that rails-api issue right as I was writing this post and it turned out that that was the issue, after banging my head forever thinking it was a mongo issue.
The issue has been fixed and closed but hasn't yet been released and will probably be released in rails-api v0.2.2.
Ultimately, I decided to just go into the rails-api source code and apply the changes locally.

Related

Could not parse for environment production: no 'environments'

I have already installed puppet-server 3.7.5 and foreman. But when I am running this command I am getting below error.
~]# foreman-installer --foreman-db-type mysql
Error:
/usr/lib/ruby/site_ruby/1.8/puppet/context.rb:54:in `lookup': Could not parse for environment production: no 'environments' in {:root_environment=>#<Puppet::Node::Environment:0x7fe3646d9620 #modulepath=[], #watching=true, #config_version=nil, #manifest=:no_manifest, #name=:"*root*">, :current_environment=>#<Puppet::Node::Environment:0x7fe3646d9620 #modulepath=[], #watching=true, #config_version=nil, #manifest=:no_manifest, #name=:"*root*">} at top of [[0, nil, nil]] (Puppet::Error)
from /usr/lib/ruby/site_ruby/1.8/puppet.rb:236:in `lookup'
from /usr/lib/ruby/site_ruby/1.8/puppet.rb:264:in `future_parser?'
from /usr/lib/ruby/site_ruby/1.8/puppet/parser/parser_factory.rb:12:in `parser'
from /usr/lib/ruby/site_ruby/1.8/puppet/node/environment.rb:541:in `perform_initial_import'
from /usr/lib/ruby/site_ruby/1.8/puppet/node/environment.rb:276:in `known_resource_types'
from /usr/lib/ruby/site_ruby/1.8/puppet/resource/type_collection_helper.rb:5:in `known_resource_types'
from /usr/lib/ruby/site_ruby/1.8/puppet/parser/parser_support.rb:120:in `import'
from /usr/lib/ruby/gems/1.8/gems/kafo_parsers-0.0.3/lib/kafo_parsers/puppet_module_parser.rb:38:in `initialize'
from /usr/lib/ruby/gems/1.8/gems/kafo_parsers-0.0.3/lib/kafo_parsers/puppet_module_parser.rb:16:in `new'
from /usr/lib/ruby/gems/1.8/gems/kafo_parsers-0.0.3/lib/kafo_parsers/puppet_module_parser.rb:16:in `parse'
from /usr/lib/ruby/gems/1.8/gems/kafo-0.6.5/lib/kafo/puppet_module.rb:44:in `parse'
from /usr/lib/ruby/gems/1.8/gems/kafo-0.6.5/lib/kafo/configuration.rb:84:in `modules'
from /usr/lib/ruby/gems/1.8/gems/kafo-0.6.5/lib/kafo/configuration.rb:84:in `map'
from /usr/lib/ruby/gems/1.8/gems/kafo-0.6.5/lib/kafo/configuration.rb:84:in `modules'
from /usr/lib/ruby/gems/1.8/gems/kafo-0.6.5/lib/kafo/kafo_configure.rb:170:in `modules'
from /usr/lib/ruby/gems/1.8/gems/kafo-0.6.5/lib/kafo/kafo_configure.rb:152:in `params'
from /usr/lib/ruby/gems/1.8/gems/kafo-0.6.5/lib/kafo/kafo_configure.rb:185:in `set_parameters'
from /usr/lib/ruby/gems/1.8/gems/kafo-0.6.5/lib/kafo/kafo_configure.rb:66:in `initialize'
from /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:126:in `new'
from /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:126:in `run'
from /usr/lib/ruby/gems/1.8/gems/kafo-0.6.5/lib/kafo/kafo_configure.rb:116:in `run'
from /usr/sbin/foreman-installer:58
Looks like this is a bug introduced due to some changes in the way environments work in Puppet 3.7 and is not compatible with previous version. Based on bug filed here you will need to supply arguments to foreman installer.

Rails migration error with thumbs_up gem

I am using the thumbs_up gem to create a voting system. I am using PostgreSQL. When I run:
rails generate thumbs_up
I get the following error:
/usr/local/rvm/gems/ruby-2.0.0-p247#firehose/gems/thumbs_up-0.6.7/lib/generators/thumbs_up/thumbs_up_generator.rb:21:in `create_migration': wrong number of arguments (3 for 0) (ArgumentError)
from /usr/local/rvm/gems/ruby-2.0.0-p247#firehose/gems/railties-4.0.4/lib/rails/generators/migration.rb:65:in `migration_template'
from /usr/local/rvm/gems/ruby-2.0.0-p247#firehose/gems/thumbs_up-0.6.7/lib/generators/thumbs_up/thumbs_up_generator.rb:22:in `create_migration'
from /usr/local/rvm/gems/ruby-2.0.0-p247#firehose/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /usr/local/rvm/gems/ruby-2.0.0-p247#firehose/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /usr/local/rvm/gems/ruby-2.0.0-p247#firehose/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
from /usr/local/rvm/gems/ruby-2.0.0-p247#firehose/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each'
from /usr/local/rvm/gems/ruby-2.0.0-p247#firehose/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map'
from /usr/local/rvm/gems/ruby-2.0.0-p247#firehose/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
from /usr/local/rvm/gems/ruby-2.0.0-p247#firehose/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch'
from /usr/local/rvm/gems/ruby-2.0.0-p247#firehose/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /usr/local/rvm/gems/ruby-2.0.0-p247#firehose/gems/railties-4.0.4/lib/rails/generators.rb:156:in `invoke'
from /usr/local/rvm/gems/ruby-2.0.0-p247#firehose/gems/railties-4.0.4/lib/rails/commands/generate.rb:11:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p247#firehose/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:229:in `require'
from /usr/local/rvm/gems/ruby-2.0.0-p247#firehose/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:229:in `block in require'
from /usr/local/rvm/gems/ruby-2.0.0-p247#firehose/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:214:in `load_dependency'
from /usr/local/rvm/gems/ruby-2.0.0-p247#firehose/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:229:in `require'
from /usr/local/rvm/gems/ruby-2.0.0-p247#firehose/gems/railties-4.0.4/lib/rails/commands.rb:48:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
How do I fix this?
This is a bug in thumbs_up.
Check this issue on github: https://github.com/bouchard/thumbs_up/issues/96
I stumbled across the same error and fixed it with the help of the link above.
Apparently all you have to do is change a file in the thumbs_up gem (you will find the location of that gem in the error itself).
In file
[path to gem]/lib/generators/thumbs_up/thumbs_up_generator.rb
replace
def create_migration
migration_template 'migration.rb', File.join('db', 'migrate', 'thumbs_up_migration.rb')
end
with
def create_thumbs_up_migration
migration_template 'migration.rb', File.join('db', 'migrate', 'thumbs_up_migration.rb')
end
in your Gemfile require the gem this way:
gem 'thumbs_up', git: 'https://github.com/bouchard/thumbs_up.git', ref: 'f499a7c803c0a9fdcefe4275f2f0a10ca7964508'
then run
rails generate thumbs_up
This should work. Worked for me - hope this helps....

Rails app with mongoid ... (Mongoid::Errors::NoSessionConfig): No configuration could be found for a session named 'default'

With reference to https://github.com/mongoid/mongoid/issues/2894#issuecomment-14903927
I've done all the necessary changes ... still the issue is there ...
spec_helper.rb file
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", FILE)
require 'rspec/rails'
require 'rspec/autorun'
require 'rails/mongoid'
Gemfile
gem 'rails', '4.0.0'
gem 'rspec-rails', '~>2.14.0'
gem 'mongoid', git: 'https://github.com/mongoid/mongoid.git'
gem 'bson_ext'
mongoid.yml
development:
sessions:
default:
database: mongo_demo_development
hosts:
- localhost:27017
options:
options:
test:
sessions:
default:
database: mongo_demo_test
hosts:
- localhost:27017
options:
consistency: :strong
max_retries: 1
retry_interval: 0
Following is the Error Log which is generated when I run my rails server with $rails s ...
/home/nikunj/.rvm/gems/ruby-1.9.3-p385/bundler/gems/mongoid-d52c33bce36a/lib/mongoid/sessions/factory.rb:27:in create': (Mongoid::Errors::NoSessionConfig)
Problem:
No configuration could be found for a session named 'default'.
Summary:
When attempting to create the new session, Mongoid could not find a session configuration for the name: 'default'. This is necessary in order to know the host, port, and options needed to connect.
Resolution:
Double check your mongoid.yml to make sure under the sessions key that a configuration exists for 'default'. If you have set the configuration programatically, ensure that 'default' exists in the configuration hash.
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/bundler/gems/mongoid-d52c33bce36a/lib/mongoid/sessions.rb:137:inwith_name'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/bundler/gems/mongoid-d52c33bce36a/lib/mongoid/sessions.rb:390:in __session__'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/bundler/gems/mongoid-d52c33bce36a/lib/mongoid/sessions.rb:227:inmongo_session'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/bundler/gems/mongoid-d52c33bce36a/lib/mongoid/sessions.rb:171:in collection'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/bundler/gems/mongoid-d52c33bce36a/lib/mongoid/contextual/mongo.rb:265:ininitialize'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/bundler/gems/mongoid-d52c33bce36a/lib/mongoid/contextual.rb:51:in new'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/bundler/gems/mongoid-d52c33bce36a/lib/mongoid/contextual.rb:51:increate_context'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/bundler/gems/mongoid-d52c33bce36a/lib/mongoid/contextual.rb:34:in context'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/bundler/gems/mongoid-d52c33bce36a/lib/mongoid/contextual.rb:18:inlast'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/bundler/gems/mongoid-d52c33bce36a/lib/mongoid/findable.rb:130:in last'
from /home/nikunj/Practice/mongo_demo/app/rules/myrule_book.rb:5:inclass:Myrule_Book'
from /home/nikunj/Practice/mongo_demo/app/rules/myrule_book.rb:3:in <top (required)>'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:423:inload'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:423:in block in load_file'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:615:innew_constants_in'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:422:in load_file'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:323:inrequire_or_load'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:462:in load_missing_constant'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:183:inconst_missing'
from /home/nikunj/Practice/mongo_demo/config/environments/development.rb:30:in block in <top (required)>'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:24:inclass_eval'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:24:in configure'
from /home/nikunj/Practice/mongo_demo/config/environments/development.rb:1:in'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in require'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:inblock in require'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in load_dependency'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:inrequire'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/engine.rb:591:in block (2 levels) in <class:Engine>'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/engine.rb:590:ineach'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/engine.rb:590:in block in <class:Engine>'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/initializable.rb:30:ininstance_exec'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/initializable.rb:30:in run'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/initializable.rb:55:inblock in run_initializers'
from /home/nikunj/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/tsort.rb:150:in block in tsort_each'
from /home/nikunj/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/tsort.rb:183:inblock (2 levels) in each_strongly_connected_component'
from /home/nikunj/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/tsort.rb:210:in block (2 levels) in each_strongly_connected_component_from'
from /home/nikunj/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/tsort.rb:219:ineach_strongly_connected_component_from'
from /home/nikunj/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/tsort.rb:209:in block in each_strongly_connected_component_from'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/initializable.rb:44:ineach'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/initializable.rb:44:in tsort_each_child'
from /home/nikunj/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/tsort.rb:203:ineach_strongly_connected_component_from'
from /home/nikunj/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/tsort.rb:182:in block in each_strongly_connected_component'
from /home/nikunj/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/tsort.rb:180:ineach'
from /home/nikunj/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/tsort.rb:180:in each_strongly_connected_component'
from /home/nikunj/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/tsort.rb:148:intsort_each'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/initializable.rb:54:in run_initializers'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/application.rb:215:ininitialize!'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in method_missing'
from /home/nikunj/Practice/mongo_demo/config/environment.rb:5:in'
from /home/nikunj/Practice/mongo_demo/config.ru:3:in require'
from /home/nikunj/Practice/mongo_demo/config.ru:3:inblock in '
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385#global/gems/rack-1.5.2/lib/rack/builder.rb:55:in instance_eval'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385#global/gems/rack-1.5.2/lib/rack/builder.rb:55:ininitialize'
from /home/nikunj/Practice/mongo_demo/config.ru:in new'
from /home/nikunj/Practice/mongo_demo/config.ru:in'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385#global/gems/rack-1.5.2/lib/rack/builder.rb:49:in eval'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385#global/gems/rack-1.5.2/lib/rack/builder.rb:49:innew_from_string'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385#global/gems/rack-1.5.2/lib/rack/builder.rb:40:in parse_file'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385#global/gems/rack-1.5.2/lib/rack/server.rb:277:inbuild_app_and_options_from_config'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385#global/gems/rack-1.5.2/lib/rack/server.rb:199:in app'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/commands/server.rb:48:inapp'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385#global/gems/rack-1.5.2/lib/rack/server.rb:314:in wrapped_app'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/commands/server.rb:75:instart'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/commands.rb:78:in block in <top (required)>'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/commands.rb:73:intap'
from /home/nikunj/.rvm/gems/ruby-1.9.3-p385/gems/railties-4.0.0/lib/rails/commands.rb:73:in <top (required)>'
from bin/rails:4:inrequire'
from bin/rails:4:in `'
Your mongoid.yml has an error "hosts:" key should be inside of "default:" because it is a required configuration for sessions
Please check http://mongoid.org/en/mongoid/docs/installation.html#configuration
I had the same issue and error message - In my case it was caused because the yml config file wasn't loaded. I added the following line
Mongoid.load!('config/mongoid.yml')
to config/application.rb and it solved the problem
may be The problem is in the gem file, you did't mention the version of mongoid gem. in gem file change gem "mongoid" to gem "mongoid" , '~> 4.0.2' and run bundle install restart server and console.

"Could not find a JavaScript runtime." during executing the refinerycms command

I am working on Ubuntu 12.04.
I am trying to create a new website with Refinery CMS.
I read the official Getting Started guide, and executed the following command.
$ refinerycms rickrockstar
But I got the following error message:
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
rake db:create
rake aborted!
Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.
(See full trace by running task with --trace)
generate refinery:cms --fresh-installation
/home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/execjs-1.4.0/lib/execjs.rb:5:in `<module:ExecJS>'
from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/execjs-1.4.0/lib/execjs.rb:4:in `<top (required)>'
from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top (required)>'
from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'
from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `<top (required)>'
from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `require'
from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `<top (required)>'
from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `require'
from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `each'
from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `block in require'
from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `each'
from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `require'
from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.2.1/lib/bundler.rb:128:in `require'
from /srv/samba/share/refinery2test/rickrockstar/config/application.rb:13:in `<top (required)>'
from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.8/lib/rails/commands.rb:24:in `require'
from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.8/lib/rails/commands.rb:24:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I've pasted the entire output on Gist because it was too long.
Strangely, I tried the same command some days before, and at that time everything worked fine.
Why does this happen? How can I solve it?
Maybe you could sudo apt-get install nodejs or see this post ExecJS and could not find a JavaScript runtime
To solve it I did:
Run refinerycms rickrockstar - it will fail with exception you described
Edit rickrockstar/Gemfile and uncomment *gem 'therubyracer', :platforms => :ruby* and save changes;
Run refinerycms rickrockstar again
Gemfile will have a conflict and ask if you want to override it. Answer no;
Override other files with conflicts
cd rickrockstar
rails s

uninitialized constant Rake::Pipeline::ManifestEntry::DateTime

I'm not a ruby person and i'm working on a project with Ember.js and i'm using Rake pipeline for compile my scripts.
# AssetFile
$: << 'lib'
require 'rake-pipeline-web-filters'
output BUILD
input SRC_DIR do
match '**/*.handlebars' do
handlebars :precompile => true
concat 'templates.js'
end
match '**/*.coffee' do
coffee_script
end
end
output JS_DIR
input BUILD_DIR do
match '*.js' do
concat 'app.js'
end
end
when i execute rakep on the console works fine the first time but the second time i get an const_missing error
c:/Ruby193/lib/ruby/1.9.1/rake/ext/module.rb:36:in `const_missing': uninitialized constant Rake::Pipeline::ManifestEntry::DateTime (NameError)
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/manifest_entry.rb:9:in `from_hash'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/manifest.rb:24:in `block in read_manifest'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/manifest.rb:23:in `each'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/manifest.rb:23:in `read_manifest'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/project.rb:225:in `last_manifest'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/filter.rb:219:in `create_file_task'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/filter.rb:197:in `block (2 levels) in generate_rake_tasks'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/filter.rb:196:in `each'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/filter.rb:196:in `block in generate_rake_tasks'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/filter.rb:194:in `each'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/filter.rb:194:in `map'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/filter.rb:194:in `generate_rake_tasks'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline.rb:410:in `block in generate_rake_tasks'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline.rb:407:in `each'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline.rb:407:in `generate_rake_tasks'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline.rb:333:in `setup'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline.rb:308:in `block in invoke'
from <internal:prelude>:10:in `synchronize'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline.rb:305:in `invoke'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/project.rb:111:in `each'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/project.rb:111:in `block in invoke'
from <internal:prelude>:10:in `synchronize'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/project.rb:110:in `invoke'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/cli.rb:19:in `build'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/task.rb:27:in `run'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:120:in `invoke_task'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor.rb:275:in `dispatch'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/base.rb:425:in `start'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/bin/rakep:4:in `<top (required)>'
from c:/Ruby193/bin/rakep:23:in `load'
from c:/Ruby193/bin/rakep:23:in `<main>'
the rakep command works fine when i remove the files manually or let pass time
Note:I am also having problems to sort the files to concatenate
I just hit upon the same problem. I'm using rake-pipeline to minify stylesheets for a static site.
What's happening here is that rake-pipeline is trying to parse a datetime using the DateTime class, but since you're not working on a Ruby project, the class isn't available. I guess because rake-pipeline is mostly used in Ruby projects, nobody noticed that this was a problem at the time. I can see that this problem has been fixed on the master branch, but a new gem version hasn't been released yet.
In the meantime, you can add the following code to your Assetfile (before your input and output), which will delete the tmp directory before your filters run. This is only a temporary fix as it means that your inputs will be filtered every time, regardless of whether they've changed, but it does negate the need for any dodgy datetime parsing.
require 'fileutils'
FileUtils.rm_rf 'tmp'
Be careful with rm_rf! Make sure it's pointing at your tmp directory and nothing else.
Re: sorting your files, I don't know the specifics of your problem, but you might find this example helpful.