How to install spree_static_content? - ruby-on-rails

How do I install spree_static_content? I get following error.
In Gemfile:
spree_core (~> 3.0.0) ruby
spree_core (~> 3.0.0) ruby
spree_core (~> 3.0) ruby
spree_static_content (>= 0) ruby depends on
spree_core (~> 3.1.0.beta) ruby
spree_core (= 3.0.1) ruby
spree_core (= 3.0.1) ruby
spree_core (= 3.0.1) ruby
spree_core (= 3.0.1) ruby
Could not find gem 'spree_core (~> 3.1.0.beta) ruby in any of the sources
At last it said that I need to do
bundle update
I did that but again get the same error.

The master branch of spree_static_content is, as if this writing, referencing 3.1.0.beta of Spree. Any project using an older version of Spree, like 3.0-stable, will not be compatible.
To use this gem for a 3.0-stable Spree project, you'll need to use the branch of spree_static_content that is built to run against that version of Spree. You can view it here:
https://github.com/spree-contrib/spree_static_content/tree/3-0-stable
Your Gemfile should use this line to include the gem:
gem 'spree_static_content', github: 'spree-contrib/spree_static_content', branch: '3-0-stable'
Note the branch: value. For other versions of Spree, find the matching branch of spree_static_content.

The error message tells you what to do.
The error is:
spree_static_content (>= 0) ruby depends on spree_core (~>
3.1.0.beta) ruby
That means you need spree_core 3.1.0.beta or higher.
Running bundle update will not update a gem beyond the version specified in the Gemfile.
It appears you may have the same gem listed multiple times in your Gemfile, as well.
Try adjusting your gemfile to have just one entry for spree, of the appropriate version. It will probably look like this:
gem 'spree', github: 'spree/spree'
Note that the spree documentation instructs adding spree, not spree_core. The spree gem will include the appropriate spree components of the correct version.
Please also not that updating spree is usually a little more involved than simply updating the version number and running bundle update. You will likely need to make other adjustments to your application to accommodate the new version.

Related

Various difficulties creating Rails apps in different versions and installing Spree

As per rbenv -global my ruby version is 2.3.3
The versions of Rails I have:
*** LOCAL GEMS ***
rails (5.1.1, 5.0.0)
Initially, my goal was to create a Rails with Spree. Like usual I began with:
rails new spree_app
Following the Spree README I then added the following gems to my gemfile:
gem 'spree', '~> 3.2.0'
gem 'spree_auth_devise', '~> 3.2.0.beta'
gem 'spree_gateway', '~> 3.2.0.beta'
Then, when I ran bundle install I'm met with the following errors:
Bundler could not find compatible versions for gem "rails":
In snapshot (Gemfile.lock):
rails (= 5.1.1)
In Gemfile:
rails (~> 5.1.1)
spree (~> 3.2.0) was resolved to 3.2.0, which depends on
spree_frontend (= 3.2.0) was resolved to 3.2.0, which depends on
canonical-rails (~> 0.1.0) was resolved to 0.1.2, which depends on
rails (< 5.1, >= 4.1)
spree (~> 3.2.0) was resolved to 3.2.0, which depends on
spree_core (= 3.2.0) was resolved to 3.2.0, which depends on
deface (~> 1.0) was resolved to 1.2.0, which depends on
rails (>= 4.1)
spree (~> 3.2.0) was resolved to 3.2.0, which depends on
spree_core (= 3.2.0) was resolved to 3.2.0, which depends on
rails (~> 5.0.0)
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
Running bundle update as suggested yields me this:
Bundler could not find compatible versions for gem "rails":
In Gemfile:
rails (~> 5.1.1)
spree (~> 3.2.0) was resolved to 3.2.0, which depends on
spree_core (= 3.2.0) was resolved to 3.2.0, which depends on
rails (~> 5.0.0)
So it seems to me that Spree depends on Rails 5.0.0 and my 5.1.1 is causing problems. In light of this I changed gem 'rails', '~> 5.1.1' to gem 'rails', '~> 5.0.0', ran bundle update and bundle install and everything worked properly bundler-wise.
The issue is that this seems to have broken my rails app. Running, any rails generate commands or rails s gives me the following error:
/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.3/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `load_defaults' for #<Rails::Application::Configuration:0x0055a1cd5a36f0> (NoMethodError)
For the life of me, I have no idea what is the matter here.
My final attempt was to try and generate a new Rails app in 5.0.0 with:
rails _5.0.0_ new spree_app_2
But for whatever reason, this seems to make no difference. The gemfile of this app still contains gem 'rails', '~> 5.1.1' and I am met with all the same errors that I got before hand.
So it seems that I either, don't know how to manage different versions of Rails, I'm not installing Spree correctly, or both. Any help is appreciated, thanks.
Update: Partial Solution
I still don't know how to generate a Rails app in any version other than 5.1.1, and simply changing the version in the gemfile still doesn't work for me. It seems to me that some other changes are need.
I switched the version of rails in the gemfile from 5.1.1 to 5.0.3. looked at the /config/application.rb files from Rails apps using 5.0.2 and found that they had a different setup.
Mine looked had this:
module AppName
class Application < Rails::Application
config.load_defaults 5.1
end
end
And the rails app generated in 5.0.2 had like this:
module AppName
class Application < Rails::Application
config.generators do |generate|
generate.assets false
end
end
end
So I swapped out what I had with that and it worked! I don't really know why it worked and I still don't know why I can just generate a 5.0.3 Rails app from the get go.
I am by no means a Spree expert, but from what it looks like, 5.1.1 is not compatible with Spree.
spree (~> 3.2.0) was resolved to 3.2.0, which depends on
spree_frontend (= 3.2.0) was resolved to 3.2.0, which depends on
canonical-rails (~> 0.1.0) was resolved to 0.1.2, which depends on
rails (< 5.1, >= 4.1)
In your Gemfile, go ahead and put gem 'rails', '5.0.3' at the top (replacing any other rails gems), then rm Gemfile.lock followed by a bundle
Should do the trick.

not able to create spree rails app

I am trying to create a rails spree app.
I am following this official link.
When I do spree install --auto-accept, I am getting the below error.
Bundler could not find compatible versions for gem "rails":
In snapshot (Gemfile.lock):
rails (= 4.2.0)
In Gemfile:
rails (= 4.2.0)
spree (~> 3.0.8) was resolved to 3.0.8, which depends on
spree_core (= 3.0.8) was resolved to 3.0.8, which depends on
rails (~> 4.2.2)
Running bundle update will rebuild your snapshot from scratch, using
only the gems in your Gemfile, which may resolve the conflict.
And then when I run bundle update, I am getting below error.
Bundler could not find compatible versions for gem "rails":
In Gemfile:
rails (= 4.2.0)
spree (~> 3.0.8) was resolved to 3.0.8, which depends on
spree_core (= 3.0.8) was resolved to 3.0.8, which depends on
rails (~> 4.2.2)
So I am not able to solve this dependency error.
Please help with a solution.
You are right, I had the same issue. Documentation is a bit outdated.
Please repeat installation process installing version 4.2.2 of Rails instead of 4.2.0:
gem install rails -v 4.2.2
gem install bundler
gem install spree_cmd
rails _4.2.2_ new mystore
cd mystore
spree install --auto-accept
I just checked and it works.

Error while installing spree_wallet, spree_marketplace and spree_drop_ship

I was trying to install spree_wallet, spree_drop_ship and spree_marketplace in spree app I am using.
However, there occurred different problems while installing these gems.
1) I could successfully install bundle for gem spree_wallet but while installing bundle exec rails g spree_wallet:install it gives me the error
Could not find generator 'spree_wallet:install'. Maybe you meant 'spree:auth:install', 'spree_gateway:install' or 'spree:install'
Run `rails generate --help` for more options.
2) When I add the spree_marketplace and spree_drop_ship to the gemfile and execute bundle install , it gives me different version conflict errors.
Bundler could not find compatible versions for gem "spree_core":
In snapshot (Gemfile.lock):
spree_core (= 3.0.4)
In Gemfile:
spree_core (= 3.0.4) ruby
spree_core (~> 3.0.0) ruby
spree_core (~> 3.0.0) ruby
spree_core (>= 0) ruby
spree_drop_ship (>= 0) ruby depends on
spree_core (~> 3.1.0.beta) ruby
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
3) Similarly, when I drop the spree_drop_ship from gemfile, spree_marketplace gives the error saying no gem spree_drop_ship found, which I think is necessary for the working of marketplace gem
Is there any workaround to resolve the issues without downgrading the spree from current version 3.0.4 ??
For those who are struggling with same, I found the solution with adding below gems
gem 'spree_drop_ship', github: 'spree-contrib/spree_drop_ship', branch: '3-0-stable'
gem 'spree_marketplace', github: 'firman/spree_marketplace'
firman/spree_marketplace is forked from spree-contrib/spree_marketplace and resolves the dependency issue

Rails gem for adding an on site tutorial supported for rails 4

I'm attempting to add an on boarding tutorial to my site. I've installed the joyride-rails gem and am getting this error when running bundle install.
Bundler could not find compatible versions for gem "rails":
In Gemfile:
joyride-rails (~> 0.0.14) ruby depends on
rails (~> 3.1) ruby
rails (4.1.6)
I've done some research and found this answer Dependency error while installing the gem "joyride-rails"
And this answer Simple Javascript Joyride plugin in rails
The problem is I think that the joyride gem just isn't compatible with rails 4 and when I down grade to 3.1 a bunch of my other gems are in conflict. I delte the gemfile.lock and run bundle install and get this error.
Bundler could not find compatible versions for gem "railties":
In Gemfile:
coffee-rails (~> 4.0.0) ruby depends on
railties (< 5.0, >= 4.0.0.beta) ruby
rails (= 3.1) ruby depends on
railties (3.1.0)
Any suggestions as to how I can implement this gem? Or do you know of another Gem that will accomplish the same goal?
Thanks!

How to install Refinery CMS using Rails 4

I previously never had a problem with Refinery. I was refreshing my knowledge by following along to the tutorial http://railscasts.com/episodes/332-refinery-cms-basics .Then when I created a new app with Refinery CMS, I got this error
Bundler could not find compatible versions for gem "actionmailer":
In Gemfile:
refinerycms (~> 2.1.0) ruby depends on
actionmailer (< 3.3, >= 3.1.3) ruby
rails (= 4.0.0) ruby depends on
actionmailer (4.0.0)
But should not these things be there by default with the CMS? why would there be errors only now?
The latest code supports Rails 4; the gem must be sourced from the master branch, until a release is made.
Git Issue #2428 - Rails 4 support
Add to your Gemfile:
gem 'refinerycms-i18n', github: 'refinery/refinerycms-i18n', branch: 'master'
gem 'refinerycms', github: 'refinery/refinerycms', branch: "master"
# Strong parameters is a new feature not used by Refinery
gem 'protected_attributes'
Do a:
$ bundle install
Create a new Refinery app, the command will be different depending on what you want to do. For that there are a few guides that you can follow. In my case, I added it to an existing app with:
$ rails generate refinery:cms --fresh-installation
Start your server and go to: http://localhost:3000/refinery
Well, my five cents are that Refinery is not yet available for Rails 4:
Is there any cms for Rails 4?
http://refinerycms.com/
http://refinerycms.com/blog/refinery-cms-210-released
Best,
Ben.
Simply initialize the application using:
rails new my_new_application -m http://refinerycms.com/t/edge
Behind the scenes:
This command makes your application use the master branch of refinery, which supports Rails 4.
Update
Although the above is the easiest and official way, it didn't totally work for me. I had to manually run the following command after the above one:
rails generate refinery:cms --fresh-installation
Looks like the rails4 branch has been getting a bit of love over the past few days:
https://github.com/refinery/refinerycms/tree/rails4
I will try it out and update with how I get on.
OK, let's try and answer this one. This is the route I went down.
First, I installed the refinerycms gem.
gem install refinerycms
I then did a:
rbenv rehash
Then I followed the guide:
refinerycms rickrockstar
Bundler complained:
Bundler could not find compatible versions for gem "refinerycms-core":
In Gemfile:
refinerycms (~> 3.0) ruby depends on
refinerycms-images (= 3.0.0) ruby depends on
refinerycms-core (= 3.0.0) ruby
refinerycms (~> 3.0) ruby depends on
refinerycms-images (= 3.0.0) ruby depends on
refinerycms-core (= 3.0.0) ruby
refinerycms (~> 3.0) ruby depends on
refinerycms-images (= 3.0.0) ruby depends on
refinerycms-core (= 3.0.0) ruby
refinerycms (~> 3.0) ruby depends on
refinerycms-images (= 3.0.0) ruby depends on
refinerycms-core (= 3.0.0) ruby
refinerycms-wymeditor (>= 1.0.6, ~> 1.0) ruby depends on
refinerycms-core (>= 3.0.0, ~> 3.0) ruby
refinerycms-acts-as-indexed (>= 1.0.0, ~> 1.0) ruby depends on
refinerycms-core (~> 2.1.0) ruby
In my gemfile, I changed the following lines:
gem 'rails', '4.2.4'
gem 'refinerycms'
gem 'refinerycms-acts-as-indexed'
gem 'refinerycms-wymeditor'
And this solved the issue.
I had to then do a:
bundle install
Then a:
rails generate refinery:cms --fresh-installation
I posted an issue on github and got the following answer from the RefineryTeam:
It looks like the culprit was refinerycms-acts-as-indexed version - it should be ~> 2.0.1 to work with Refinery 3.0.0
https://github.com/refinery/refinerycms/issues/3072
Please also see this page where things might be running more smoothly than following the guide on Refinery's website. What is to be seen there is similar to Zuhaib Ali's answer above (in a bit more details).
Hope this helps

Resources