Spree backend + Core rails 4 - ruby-on-rails-4

I'm trying to install spree on my rails-4 application with only backend and api stuff. I've found on the web how to install spree for a rails4 application and I also found how to install only backend and api stuff. The problem is folowing, to install rails-4 I need to set it in branch :
gem 'spree', github: 'spree/spree', branch: 'rails4'
But if I want to use only spree's backend and api, I would usually specify them manually in gemfile :
gem 'spree_backend'
gem 'spree_api'
But since there is not specific git repo for them (they are all subfolders) I can't find out how to specify a subfolder in github in a specific branch.
Did I miss something?
Thanks

You're not missing something. The project in to separate gems when it is released. Spree doesn't have a subtree split of the subdirectories, so if you want to pull it in from git you'll have to do some work, or import the whole project.
Your best bet may be to try:
gem 'spree', github: 'spree/spree', branch: 'rails4', require: false
This will install the gem and maintain the dependencies, but not require anything. You can then manually require the sections that you want in an initializer.

Related

Integration of refinery cms in rails 4 existing application

How to integrate refinery cms in existing rails 4 application.
I have already added in gemfile this gem 'refinerycms-i18n',
github: 'refinery/refinerycms-i18n', branch: 'master'
gem 'refinerycms', github: 'refinery/refinerycms', branch: "master"
and I tried to do
rails g refinery:engine app name:string description:text
but the error is
Could not find generator refinery:engine.
How to resolve this
Was doing some research on this same topic. Currently the docs state that "Refinery CMS is not compatible with Rails 4". Please update your answer if you find this to not be the case!
Source: RefineryCMS Getting Started
I never do this, but here there is a official: Guide I hope it's useful!

PG pg_ext load error in rails

I recently updated to rails 4.1.6 and ruby 2.1.3p242. I also updated all gems on my system. After creating a new app, I keep getting a pg_ext load file error on running the server. I'm on windows 8 x64 with PostgreSQL 9.3. The pg gem was working fine under my previous RoR installation which was rails 3.2 and ruby 1.9.3.
Under the gem's installation directory, I've a 2.0/pg_ext.so file. I tried renaming the folder to 2.1 and ran the server. The result was the same. I assume it's cause Ruby doesn't allow to Require a .so file. Below is the screenshot of the error:
Any help would be really appreciated. Thanks!
Posted question on the official Gem page:
https://bitbucket.org/ged/ruby-pg/issue/192/pg_ext-load-error
As per the suggestion, I installed the pre-version of the next release. That gave me another error which was solved using:
https://github.com/tzinfo/tzinfo/wiki/Resolving-TZInfo::DataSourceNotFound-Errors
TZInfo::DataSourceNotFound error starting Rails v4.1.0 server on Windows
Posting the answer to help people facing similar problems in the future.
1) In the command line enter:
gem install pg --pre
gem list pg
2) In the Gemfile set the gem to the newly installed version:
gem 'pg', '~> 0.18.2'

bundle cannot find the global shared gem in nginx/passenger

The passenger reports error that the gem json cannot be found. While other gems can be found because they are installed by bundle install. However, json was default installation by ruby 2.1.1.
And it is wired that bundle shows json has been deleted.
$ bundle show json
The gem json has been deleted. It was installed at:
/home/canoe/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/json-1.8.1
But gem can still find it on system.
$ gem list json
json (1.8.1)
And json is installed at this location /home/canoe/.rbenv/versions/2.1.1/lib/ruby/2.1.0/json.rb.
I don't use cap while deploying the rails4.1 application, so this solution doesn't work for me.
I don't want to package everything into somewhere, instead to use all current installed gems in the gemsets.
So, how to make bundle use system default gems in nginx passenger?
I encountered the same issue, but following post helped me: fusion passenger issue with json gem when running on nginx
Maybe you are also using some ruby version control tool. As I'm using RVM.
According to the comment in above post. passenger_ruby need to be pointed to the RVM wrapper folder.
eg:
passenger_ruby /usr/local/rvm/wrappers/ruby-2.0.0-p481/ruby;

Get 'best-in-place' gem for rails4 from github w/o internet

I got a very limited internet connection on my office laptop and I want to install the 'best-in-place' gem. Since I use rails 4 I need to get the gem from github as far as I understood various threads. But I cant run bundle install with access outside of my local system.
Is it still possible to install that gem somehow? I already downloaded the folder form github and put it into my ruby but its not working that easy.
Best regards!
Edit: If thats not possible, does anyone of you uses an alternative gem with similar functions?
You can always clone it (or download it, as you have) and then access it later.
Let's say that you downloaded it to: /home/user3665315/workspace/best_in_place
Then, in your Gemfile you can access it locally with the :path option
# Gemfile
gem "best_in_place", path: "/home/user3665315/workspace/best_in_place"
then run
bundle install
and that's it, you have it working locally

cloudfoundry-jquery-rails in place of jquery-rails

When deploying to cloud-foundry its advised to change from 'jquery-rails' gem to 'cloudfoundry-jquery-rails'
# For Ruby 1.9 Cloud Foundry requires a tweak to the jquery-rails gem.
# gem 'jquery-rails'
gem 'cloudfoundry-jquery-rails'
so that jquery can seamlessly work with cloudfoundry.
What are those fixes refered to in this that are necessary to make it work on cloud-foundry?
The documentation for this is a little out of date and is in the process of being updated. For Rails 3.1 this may well be the case, but certainly not for 3.2, it should work fine as is.