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!
Related
I'm running the run rake db:migration command and terminal is telling me that rake is not a command
$ heroku run rake db:migrate --app"glacial-lake-5597"
Running `rake db:migrate --appglacial-lake-5597` attached to terminal... up, run.1930
bash: rake: command not found
$ heroku run rake db:migrate
Running `rake db:migrate` attached to terminal... up, run.4588
bash: rake: command not found
i've already bundle installed and committed changes to git.
I've looked all over StackOverflow and I cannot find the answer
Can someone point me in the right direction
I had the same problem,
The cause was that I hadn't specified a remote branch when first pushing to Heroku, Heroku apps start with a blank repository – they have no branches and no code. So the first time you deploy, you need to specify a remote branch.
git push heroku master
I hadn't done this initially and in doing so this fixed my rake problem.
See if the gem sqlite is in development only.
like this
group :development do
gem 'sqlite3'
gem 'web-console'
gem 'listen', '~> 3.0.5'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
To check to see if your app deployed correctly just look at the trace in your shell after you attempt to push to Heroku. I had been running mine in Cloud 9 and not really looking at the results because they were so small, I'm new to this, and, heck, it had always deployed perfectly before....
When I scrolled through I found two errors mentioned; I corrected these errors, then the heroku db migration ran fine. One error was a missing line of code, the other I found on SO (which I can't refind the link to, sorry), and it had to do with the file extensions for my css files, which I changed from .css to .css.scss.
I am trying to do "rake db:migrate" and it is giving me this error.
Andy:AcademyAir Andy$ rake db:migrate
/Users/Andy/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.2.2/lib/bundler/runtime.rb:197: warning: Insecure world writable dir /usr in PATH, mode 040777
rake aborted!
You have already activated rake 10.0.2, but your Gemfile requires rake 0.9.2.2. Using bundle exec may solve this.
/Users/Andy/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.2.2/lib/bundler/runtime.rb:31:in `block in setup'
/Users/Andy/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.2.2/lib/bundler/runtime.rb:17:in `setup'
/Users/Andy/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.2.2/lib/bundler.rb:116:in `setup'
/Users/Andy/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.2.2/lib/bundler/setup.rb:7:in `<top (required)>'
/Users/Andy/Desktop/AcademyAir/config/boot.rb:6:in `<top (required)>'
/Users/Andy/Desktop/AcademyAir/config/application.rb:1:in `<top (required)>'
/Users/Andy/Desktop/AcademyAir/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)
Try this bundle exec rake db:migrate
Remove rake 10.0.2 gem
By using gem uninstall rake and remove 10.0.2 version of rake gem
And Then Try rake db:migrate
Why Error comes : In you gem list two version (10.0.2 and 0.9.2.2) of rake gem install so that this error comes.*
Another Solution is you can do bundle update
For me, I just ran bundle update and everything works right again.
I was able to solve this by opening up Gemfile and changing gem 'rake', '~> 0.9.2.2' to gem 'rake', '~> 10.0.1'
In your Gemfile, explicitly set the latest rake version by:
gem 'rake', '~> 10.0.1'
And then run
$ bundle update rake
Then try
I've just ran into the same problem.
I inserted in my gemfilen gem 'rake', '~> 10.0.1' [in your case it should be '10.0.2']
I deleted my gemfile lock
I ran rake db:migration again and it worked.
I got this tip here: Activated Ruby RAKE 10.0.1, require 10.0.0
Update: In my case I didn't have rake duplicated. I just have in my gems the 10.0.1 version.
Solved the same issue by running:
bundle update
This will update your rake gem to the latest version and allow you to run the migration.
If you are using a gemset: be sure to run bundle install after you've updated rake to update your local gemset as well.
It happens because you are using rake from the system. (latest version by default)
The solution is use follow command:
bundle exec rake db:migrate
Also, you can create alias. Because this command is too big and difficult to write.
echo "alias be='bundle exec'" >> ~/.bash_profile
source ~/.bash_profile
Then you can use follow short command:
be rake db:migrate
change the version which located both in the gemfile and gemlock to the version number shown in the console, it will be done
I have a rake task that looks like so (crontab):
cd /data/TheApp/current && bundle exec rake nightly_tasks[3]
--trace --silent 2>> /data/TheApp/shared/log/tasks_prod_errors.log
It all runs fine in test and dev, but on prod I get this error:
rake aborted!
no such file to load -- ruby-debug
/usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in
`require'
/usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in
`block (2 levels) in require'
OK so I check my gemfile and I have this:
group :development, :test do
gem 'ruby-debug19', :require => 'ruby-debug', :platforms => :ruby
...
Production env should be ignoring that ruby-debug requirement. So I check my RAILS_ENV and it's correct:
$ echo $RAILS_ENV
production
On top of that the line that used to require ruby debug in this rake task is commented out. So to me it looks like there's no way bundle exec should be trying to load ruby-debug in prod. Is this maybe something to do with the gemfile.lock? There is an entry for ruby-debug19 in there. But why would my rake task be loading it in that case?
Also, running the command from the command line works fine. Confusing.
The rails environment and bundler groups are two completely different things. One doesn't know about the other although they use similar terms in your case
As a workaround, you can use bundle install --without development test in production to tell bundler to not install those groups. Alternatively, you can use something like this in your Gemfile:
unless ENV['RAILS_ENV'] == "production"
gem 'ruby-debug19', :require => 'ruby-debug', :platforms => :ruby
end
That expects that you have the environment variable RAILS_ENV set. during your bundle install run as well as during your bundle exec run (i.e. always).
All you need to do is use the “debugger” gem for ruby 1.9.
gem install debugger
I have trouble deploying my app on heroku. I have added 'pg' gem to Gemfile, and even try to include something like gem 'therubyracer-heroku'.
during
heroku rake db:migrate
I get something like this:
>heroku rake db:migrate
--trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
Please install the postgresql adapter: `gem install activerecord-postgresql-adap
ter` (pg is not part of the bundle. Add it to Gemfile.)
/app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connectio
n_adapters/abstract/connection_specification.rb:71:in `rescue in establish_conne
ction'
Another interesting part is that while pushing to heroku pg is not mentioned during bundle install operation like if it was ignored. I also watched the Gemfile.lock and pg is mentioned there to:
pg (0.11.0-x86-mingw32)
I wonder if it is a Windows gem issue that cause heroku to ignore the pg gem or something ?
Can anyone help or had similar problem ?
//EDIT
Seems related: enter link description here
And looks unsolveable
In your Gemfile limit postgres to your production group;
group :production do
gem "pg"
end
rebundle
bundle --without production
and commit to git (Gemfile and Gemfile.lock) and push to Heroku. That should solve your problem.
Pranay-Tares-MacBook-Pro:music_library pranaytare$ rake db:migrate
(in /Users/pranaytare/Sites/music_library)
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
rake aborted!
no such file to load -- mysql
(See full trace by running task with --trace)
I got this error while running rake in ROR.. plz help..
I recently installed mysql on my Mac and configured it.
Either install the gem as the error message says, or put the mysql gem in your Gemfile and run bundle install. In the Gemfile, it would be like :
gem 'mysql2'