I know It's better to use this cms on a Virtual machine, with some OS like linux, etc. (because this command: $ wagon serve
doesn't run on windows at all)
I decided to use nitrous io and it's working really good (on a ubuntu os) the only problem is when I do the Preview of my locomotive cms installation it shows the backend without the styles (css).
Rails 3.2.19 ruby 2.1.0
Here step by step commands I ran, that didn't work for me: First, my gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '3.2.19'
gem 'locomotive_cms', '~> 2.4.1', :require => 'locomotive/engine'
group :assets do
gem 'compass', '~> 0.12.7'
gem 'compass-rails', '~> 1.0.2'
gem 'sass-rails', '~> 3.2.6'
gem 'coffee-rails', '~> 3.2.2'
gem 'uglifier', '~> 2.5.1'
gem 'therubyracer', :platforms => :ruby
end
# Use unicorn as the app server
gem 'unicorn'
gem 'rake', '10.0.4'
As suggested in the locomotivecms documentation, I started creating a new rails project for the engine:
$ rails new codigos_comentados_engine --skip-active-record --skip-test-unit --skip-javascript --skip-bundle
$ bundle
Creating the locomotivecms engine:
$ rails generate locomotive:install
Then, some files in the project didn't work in environment/production.rb and environment/development.rb:
Error: undefined method `configure' for #<CodigosComentadosEngine::Application:0x007f8
03fe43bf0> (NoMethodError)
Solved when changing this:
Rails.Aplication.configure do
by this:
CodigosComentadosEngine::Application.configure do
Then, locomotive engine worked well and I got this nice output :
1. blah blah
2. bundle exec unicorn_rails
3. Open your browser
open localhost:8080
4. Follow the installation wizard steps
5. Enjoy !
Then:
$ bundle exec unicorn_rails
I got this warning But the server was working anyway:
WARNING: unable to load the content types, Could not connect to any secondary or primary nodes for replica set <Moped::Cluster nodes=[<Moped::Node resolved_address="127.0.0.1:270
17">]>
OK. when I opened this url in my browser: myprojectblahblahblah.nitrousbox.com:8080
I got the next message:
ArgumentError: A secret is required to generate an integrity hash for cookie session data. Use config.secret_token = "some secret phrase of at least 30 characters"in config/initializers/secret_token.rb
Ok. I created the secret token file in config/initializers/secret_token.rb
CodigosComentadosEngine::Application.config.secret_token = 'blahblahblahblahblahblahblahblahblahblahblah'
Installing mongodb according to nitrous help docs:
$ parts install mongodb
Starting mongodb:
$ parts start mongodb
ok. => Started: mongodb
Starting server unicorn again:
$ bundle exec unicorn_rails
everything alright. ...
Preview in the browser: myprojectblahblahblah.nitrousbox.com:8080
BUT The styles of the backend doesn't appear, loads everthing, without the styles I could even create an user and see my site.
When I inspected the html the path of the <script></script>
in the head was:
myprojectblahblah.nitrousbox.com:8080/javascripts/locomotive/not_logged_in.js
myprojectblahblah.nitrousbox.com:8080/stylesheets/locomotive/not_logged_in.css
In a forum I found this step by step that worked for them, not for me on nitrous with ubuntu: link [https://locomotivecms.tenderapp.com/discussions/problems/309-backend-themestyles-does-not-apply-missing-files-reopen#comment_31593155][1]
To make the public/assets directory "appears" in the link was suggested to run this command:
$ RAILS_ENV=production bundle exec rake assets:precompile
After running this command, I got this output:
Digest::Digest is deprecated; use Digest
/home/action/.parts/packages/ruby2.1/2.1.1/bin/ruby /home/action/.gem/ruby/2.1.1/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
Digest::Digest is deprecated; use Digest
But puplic/assets was not appearing in the directory, and not showing any style in the backend of locomotive (the forms, and web is loading)
After that, I ran the same command but with --trace, and i got the following output:
$ RAILS_ENV=production bundle exec rake --trace assets:precompile
OUTPUT:
rake aborted!
Don't know how to build task 'default'
/home/action/.gem/ruby/2.1.1/gems/rake-10.0.4/lib/rake/application.rb:142:in `invoke_task'
...
/home/action/.gem/ruby/2.1.1/gems/rake-10.0.4/bin/rake:33:in `<top (required)>'
/home/action/.gem/ruby/2.1.1/bin/rake:23:in `load'
/home/action/.gem/ruby/2.1.1/bin/rake:23:in `<main>'
I google "rake aborted! Don't know how to build task 'default'" and I noticed that in the Rakefile i had this line:
`Rails.application.load_tasks`
and I changed by:
CodigosComentadosEngine::Application.load_tasks
I added this line in GemFile: gem rake '10.0.4'
Then I ran this command with a successful output: (both RAILS_ENV=development and RAILS_ENV=production return a successful output)
$ RAILS_ENV=development bundle exec rake --trace assets:precompile
Output:
/home/action/.parts/packages/ruby2.1/2.1.1/bin/ruby /home/action/.gem/ruby/2.1.1/bin/rake assets:precompile:all RAILS_ENV=development RAILS_GROUPS=assets --trace
Digest::Digest is deprecated; use Digest
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
**.....
** Execute assets:precompile:primary
....
After that, (according to the forum link I posted) the idea was that you MUST to see the public/assets directory, but I don't see it. The weird thing is that when I installed it on Windows (7) the backend styles loaded perfect, the problem there was the $wagon serve command
, that was a known win issue.
I'm going to try in a ubuntu locally, without nitrous. I'll update this question if I have success. Have you got a similar issue with this cms and nitrous?
PS. Sorry My English maybe is not perfect. Thanks for any help!