Generating new rails projects on the edge is painful #7773

Closed
Spaceghost opened this Issue Sep 27, 2012 · 24 comments

Comments

Projects
None yet
10 participants
@Spaceghost

Problem

When I use this command to generate a new edge application.

  rails new blog --edge

And then I change the Gemfile from this:

source 'https://rubygems.org'

gem 'rails',     :git => 'git://github.com/rails/rails.git', :branch => '3-2-stable'
...

into a truly edge rails project bundle using this (even include the latest passing commit hash as a ref key based on travis ci build statuses):

source :rubygems

gem 'rails', git: 'git://github.com/rails/rails.git'

I run into some more gem issues.

Could not find gem 'activerecord-deprecated_finders (= 0.0.1) ruby', which is required by gem 'rails (>= 0) ruby', in any of the sources.

To which my reponse is gem 'activerecord-deprecated_finders', git: 'git://github.com/rails/rails.git'

The next part that I come up against follows.

Bundler could not find compatible versions for gem "railties":
  In Gemfile:
    sass-rails (>= 0) ruby depends on
      railties (~> 3.2.0) ruby

    rails (>= 0) ruby depends on
      railties (4.0.0.beta)

So I update that line in my gemfile to remove the :branch => ''3-2-stable' reference in the Gemfile. Immediately following up with coffee-rails. So to date, the only oddity for the moment is really just that activerecord-deprecated_finders gem.

Now I feel like I'm really close because the bundle finishes. So I go ahead with a risky bundle exec rails s. What happens next is one issue that I believe needs to be changed.

/Users/spaceghost/Projects/testerly/config/application.rb:7:in `require': cannot load such file -- active_resource/railtie (LoadError)

I don't personally think I need to explain this, but we should either require that gem in rails, the generated Gemfile or remove this railtie from config/application.rb:7

I added a simple:

gem 'activeresource', git: 'git://github.com/rails/activeresource', require: 'active_resource' 

But was stopped again by this:

/Users/spaceghost/Projects/testerly/config/application.rb:8:in `require': cannot load such file -- sprockets/railtie (LoadError)

After exploring this a bit, I found that sstephenson/sprockets doesn't include a railtie anymore. It seems to be living in rails/sprockets-rails. This is my relevant gem line, followed by my config/application.rb changes.

gem 'sprockets-rails'
require 'sprockets/rails/railtie'

To recap, there are three problems.

  1. activerecord-deprecated_finders not having a proper gem in rubygems is a problem, so rails should include it in the gemfile for rails itself.
  2. activeresource is still including a railtie in rails when it has been extracted into a gem. Add it to rails' Gemfile or the local project? Maybe just remove the railtie since the gem has been extracted anyways. I ❤️ activeresource by the way. I'm glad it's a separate gem.
  3. sprockets no longer has a railtie that I can find. Rails should refer to sprockets-rails and the necessary file to require is sprockets/rails/railtie

After I got past these myself, I successfully launched my rails server instance (rails console is still broken.)

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Sep 27, 2012

Member

This occurs because the script you are using to generate the Rails edge project is the Rails 3.2.x. You need to have the Rails 4.0 gem in your machine.

Member

rafaelfranca commented Sep 27, 2012

This occurs because the script you are using to generate the Rails edge project is the Rails 3.2.x. You need to have the Rails 4.0 gem in your machine.

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Sep 27, 2012

Member

To install clone the Rails repository and run the install.rb script

Member

rafaelfranca commented Sep 27, 2012

To install clone the Rails repository and run the install.rb script

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Sep 27, 2012

Member

I don't think we have a way to tell the rails 3.2.x executable to generate a full edge application.

@josevalim @wycats thoughts?

Member

rafaelfranca commented Sep 27, 2012

I don't think we have a way to tell the rails 3.2.x executable to generate a full edge application.

@josevalim @wycats thoughts?

@Spaceghost

This comment has been minimized.

Show comment
Hide comment
@Spaceghost

Spaceghost Sep 27, 2012

Hey, I'm running the install.rb script. Is there anything I have to pass to it? I'm getting some fun responses.

Installing activesupport...
ERROR:  Could not find a valid gem 'activesupport-.gem' (>= 0) in any repository
ERROR:  Possible alternatives: activesupport, activesupport-slices, active_support, activesupport-jcache, jactive_support
Installing activemodel...
ERROR:  Could not find a valid gem 'activemodel-.gem' (>= 0) in any repository
ERROR:  Possible alternatives: activemodel-form, activemodel, activemodel-error, active_device, activelogger
Installing activerecord...
ERROR:  Could not find a valid gem 'activerecord-.gem' (>= 0) in any repository
ERROR:  Possible alternatives: ActiveRecord-JDBC, activerecord-mimer, activerecord-uuid, activerecord-lazy, activerecord_enum
Installing actionpack...
ERROR:  Could not find a valid gem 'actionpack-.gem' (>= 0) in any repository
ERROR:  Possible alternatives: actionpack, eactionpack
Installing actionmailer...
ERROR:  Could not find a valid gem 'actionmailer-.gem' (>= 0) in any repository
ERROR:  Possible alternatives: actionmailer, actionmailer_x509, action_mailer_tls, action_mailer_verp, actionmailer-javamail
Installing railties...
ERROR:  Could not find a valid gem 'railties-.gem' (>= 0) in any repository
ERROR:  Possible alternatives: railties
Installing Rails...
ERROR:  Could not find a valid gem 'rails-.gem' (>= 0) in any repository
ERROR:  Possible alternatives: rails-ajax, rails-api, rails-crud, rails-dbi, rails-erd
rm: rails-.gem: No such file or directory

Hey, I'm running the install.rb script. Is there anything I have to pass to it? I'm getting some fun responses.

Installing activesupport...
ERROR:  Could not find a valid gem 'activesupport-.gem' (>= 0) in any repository
ERROR:  Possible alternatives: activesupport, activesupport-slices, active_support, activesupport-jcache, jactive_support
Installing activemodel...
ERROR:  Could not find a valid gem 'activemodel-.gem' (>= 0) in any repository
ERROR:  Possible alternatives: activemodel-form, activemodel, activemodel-error, active_device, activelogger
Installing activerecord...
ERROR:  Could not find a valid gem 'activerecord-.gem' (>= 0) in any repository
ERROR:  Possible alternatives: ActiveRecord-JDBC, activerecord-mimer, activerecord-uuid, activerecord-lazy, activerecord_enum
Installing actionpack...
ERROR:  Could not find a valid gem 'actionpack-.gem' (>= 0) in any repository
ERROR:  Possible alternatives: actionpack, eactionpack
Installing actionmailer...
ERROR:  Could not find a valid gem 'actionmailer-.gem' (>= 0) in any repository
ERROR:  Possible alternatives: actionmailer, actionmailer_x509, action_mailer_tls, action_mailer_verp, actionmailer-javamail
Installing railties...
ERROR:  Could not find a valid gem 'railties-.gem' (>= 0) in any repository
ERROR:  Possible alternatives: railties
Installing Rails...
ERROR:  Could not find a valid gem 'rails-.gem' (>= 0) in any repository
ERROR:  Possible alternatives: rails-ajax, rails-api, rails-crud, rails-dbi, rails-erd
rm: rails-.gem: No such file or directory
@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Sep 27, 2012

Member
ruby install.rb 4.0.0.beta
Member

rafaelfranca commented Sep 27, 2012

ruby install.rb 4.0.0.beta
@Spaceghost

This comment has been minimized.

Show comment
Hide comment
@Spaceghost

Spaceghost Sep 27, 2012

Here's my output from ruby install.rb 4.0.0.beta

Installing activesupport...
Installing activemodel...
Installing activerecord...
ERROR:  While executing gem ... (Gem::DependencyError)
    Unable to resolve dependencies: activerecord requires activerecord-deprecated_finders (= 0.0.1)
Installing actionpack...
ERROR:  While executing gem ... (Gem::DependencyError)
    Unable to resolve dependencies: actionpack requires journey (~> 2.0.0)
Installing actionmailer...
ERROR:  While executing gem ... (Gem::DependencyError)
    Unable to resolve dependencies: actionmailer requires actionpack (= 4.0.0.beta)
Installing railties...
ERROR:  While executing gem ... (Gem::DependencyError)
    Unable to resolve dependencies: railties requires actionpack (= 4.0.0.beta)
Installing Rails...
ERROR:  While executing gem ... (Gem::DependencyError)
    Unable to resolve dependencies: rails requires actionpack (= 4.0.0.beta), activerecord (= 4.0.0.beta), actionmailer (= 4.0.0.beta), railties (= 4.0.0.beta)

So is --edge really about sticking on the edge of your z release, as in x.y.z?

If so, perhaps the documentation of that switch might be updated to reflect that?

Here's my output from ruby install.rb 4.0.0.beta

Installing activesupport...
Installing activemodel...
Installing activerecord...
ERROR:  While executing gem ... (Gem::DependencyError)
    Unable to resolve dependencies: activerecord requires activerecord-deprecated_finders (= 0.0.1)
Installing actionpack...
ERROR:  While executing gem ... (Gem::DependencyError)
    Unable to resolve dependencies: actionpack requires journey (~> 2.0.0)
Installing actionmailer...
ERROR:  While executing gem ... (Gem::DependencyError)
    Unable to resolve dependencies: actionmailer requires actionpack (= 4.0.0.beta)
Installing railties...
ERROR:  While executing gem ... (Gem::DependencyError)
    Unable to resolve dependencies: railties requires actionpack (= 4.0.0.beta)
Installing Rails...
ERROR:  While executing gem ... (Gem::DependencyError)
    Unable to resolve dependencies: rails requires actionpack (= 4.0.0.beta), activerecord (= 4.0.0.beta), actionmailer (= 4.0.0.beta), railties (= 4.0.0.beta)

So is --edge really about sticking on the edge of your z release, as in x.y.z?

If so, perhaps the documentation of that switch might be updated to reflect that?

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Sep 27, 2012

Member

Actually the install script will not work because of the journey version and the activerecord-deprecated_finders.

Right now there is no a easy way to generate rails 4 application. I'll leave this open to try to cook a solution.

Yes --edge is about sticking on the edge of your release.

Feel free to update the documentation in the docrails project

Member

rafaelfranca commented Sep 27, 2012

Actually the install script will not work because of the journey version and the activerecord-deprecated_finders.

Right now there is no a easy way to generate rails 4 application. I'll leave this open to try to cook a solution.

Yes --edge is about sticking on the edge of your release.

Feel free to update the documentation in the docrails project

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Sep 27, 2012

Member

The only way to generate an application using Rails 4 right now:

  • cloning the repository
  • running bundle install
  • running PATH_OF_YOUR_RAILS_FORK/railties/bin/rails new my_rails_4_app

We are close to the beta release so I think this solution is fine until we don't create the release.

Closing this now

Member

rafaelfranca commented Sep 27, 2012

The only way to generate an application using Rails 4 right now:

  • cloning the repository
  • running bundle install
  • running PATH_OF_YOUR_RAILS_FORK/railties/bin/rails new my_rails_4_app

We are close to the beta release so I think this solution is fine until we don't create the release.

Closing this now

@Spaceghost

This comment has been minimized.

Show comment
Hide comment
@Spaceghost

Spaceghost Sep 27, 2012

I'll go play with that. I might need to have the ticket reopened if things go squirrely.

Thank you.

I'll go play with that. I might need to have the ticket reopened if things go squirrely.

Thank you.

@fxn

This comment has been minimized.

Show comment
Hide comment
@fxn

fxn Sep 28, 2012

Member

You normally want also to pass the --dev option so that the Gemfile points to the local checkout.

Member

fxn commented Sep 28, 2012

You normally want also to pass the --dev option so that the Gemfile points to the local checkout.

@revans

This comment has been minimized.

Show comment
Hide comment
@revans

revans Oct 2, 2012

Contributor

Anyone working on this? This has been annoying me while working on another issue.

I can add this to my list after I finish issue #7596

Contributor

revans commented Oct 2, 2012

Anyone working on this? This has been annoying me while working on another issue.

I can add this to my list after I finish issue #7596

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Oct 2, 2012

Member

We can't work on this since the 3.2.8 binary doesn't know anything about the Rails 4 dependencies.

Member

rafaelfranca commented Oct 2, 2012

We can't work on this since the 3.2.8 binary doesn't know anything about the Rails 4 dependencies.

@Spaceghost

This comment has been minimized.

Show comment
Hide comment
@Spaceghost

Spaceghost Oct 2, 2012

It's okay that 3.2.8 isn't good with it. I'm working on getting master working. If things don't work out well, can you reopen the ticket?

It's okay that 3.2.8 isn't good with it. I'm working on getting master working. If things don't work out well, can you reopen the ticket?

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Oct 3, 2012

Member

I think master branch is working fine. But if it doesn't is better to open a new issue

Member

rafaelfranca commented Oct 3, 2012

I think master branch is working fine. But if it doesn't is better to open a new issue

@olivierlacan

This comment has been minimized.

Show comment
Hide comment
@olivierlacan

olivierlacan Oct 10, 2012

Contributor

Simple-ish solution assuming you're either using bundle exec (you'll need to prepend it when necessary below) or you have gem binaries set to install in bin and your path pointing there first.

  • mkdir <appname>
  • cd <appname>
  • bundle init (assuming you have bundler installed)
  • add this in Gemfile:
gem 'rails',     github: 'rails/rails'
gem 'journey',   github: 'rails/journey'
gem 'arel',      github: 'rails/arel'
gem 'activerecord-deprecated_finders', github: 'rails/activerecord-deprecated_finders'
  • run bundle
  • check your version with rails -v, it should be Rails 4.0.0.beta. If not and you're using rbenv, try rbenv rehash.
  • run rails new . --edge

Mine failed to bundle initially but after calling it manually everything seemed fine.

Contributor

olivierlacan commented Oct 10, 2012

Simple-ish solution assuming you're either using bundle exec (you'll need to prepend it when necessary below) or you have gem binaries set to install in bin and your path pointing there first.

  • mkdir <appname>
  • cd <appname>
  • bundle init (assuming you have bundler installed)
  • add this in Gemfile:
gem 'rails',     github: 'rails/rails'
gem 'journey',   github: 'rails/journey'
gem 'arel',      github: 'rails/arel'
gem 'activerecord-deprecated_finders', github: 'rails/activerecord-deprecated_finders'
  • run bundle
  • check your version with rails -v, it should be Rails 4.0.0.beta. If not and you're using rbenv, try rbenv rehash.
  • run rails new . --edge

Mine failed to bundle initially but after calling it manually everything seemed fine.

@brookemckim

This comment has been minimized.

Show comment
Hide comment
@brookemckim

brookemckim Oct 20, 2012

Following the PATH_OF_YOUR_RAILS_FORK/railties/bin/rails new my_rails_4_app method I then had to edit my Gemfile to remove all the references to '4.0.0.beta' because it doesn't exist for coffee-rails, sass-rails, or rails. I changed them all to just pull from github master.

Following the PATH_OF_YOUR_RAILS_FORK/railties/bin/rails new my_rails_4_app method I then had to edit my Gemfile to remove all the references to '4.0.0.beta' because it doesn't exist for coffee-rails, sass-rails, or rails. I changed them all to just pull from github master.

@revans

This comment has been minimized.

Show comment
Hide comment
@revans

revans Oct 21, 2012

Contributor

When creating a new app from your fork, use the --edge switch.

On Saturday, October 20, 2012, Brooke McKim wrote:

Following the PATH_OF_YOUR_RAILS_FORK/railties/bin/rails new
my_rails_4_app method I then had to edit my Gemfile to remove all the
references to '4.0.0.beta' because it doesn't exist for coffee-rails,
sass-rails, or rails. I changed them all to just pull from github master.


Reply to this email directly or view it on GitHubhttps://github.com/rails/rails/issues/7773#issuecomment-9633951.


Robert Evans
Owner & Lead Programmer

http://www.codewranglers.org
http://www.github.com/revans
http://www.twitter.com/revans

Contributor

revans commented Oct 21, 2012

When creating a new app from your fork, use the --edge switch.

On Saturday, October 20, 2012, Brooke McKim wrote:

Following the PATH_OF_YOUR_RAILS_FORK/railties/bin/rails new
my_rails_4_app method I then had to edit my Gemfile to remove all the
references to '4.0.0.beta' because it doesn't exist for coffee-rails,
sass-rails, or rails. I changed them all to just pull from github master.


Reply to this email directly or view it on GitHubhttps://github.com/rails/rails/issues/7773#issuecomment-9633951.


Robert Evans
Owner & Lead Programmer

http://www.codewranglers.org
http://www.github.com/revans
http://www.twitter.com/revans

@ddd

This comment has been minimized.

Show comment
Hide comment
@ddd

ddd Nov 28, 2012

After running the following it worked perfectly fine for me.

cd $HOME/projects/local/
git clone https://github.com/rails/rails.git
cd $HOME/projects/github/ddd
$HOME/projects/local/rails/railties/bin/rails new cstg_rails4 --edge
cd cstg_rails4
bundle install # I had to run this one twice. I have RVM's globalcache enabled, so had to delete the cached version)

Which resulted in:

∴ be rails --version
Rails 4.0.0.beta

be is a bash shell alias I have for bundle exec

ddd commented Nov 28, 2012

After running the following it worked perfectly fine for me.

cd $HOME/projects/local/
git clone https://github.com/rails/rails.git
cd $HOME/projects/github/ddd
$HOME/projects/local/rails/railties/bin/rails new cstg_rails4 --edge
cd cstg_rails4
bundle install # I had to run this one twice. I have RVM's globalcache enabled, so had to delete the cached version)

Which resulted in:

∴ be rails --version
Rails 4.0.0.beta

be is a bash shell alias I have for bundle exec

@clemensg

This comment has been minimized.

Show comment
Hide comment
@clemensg

clemensg Dec 2, 2012

What's the reason for this failure if I exchange my default Rails 3.2.9 line with a github: rails/rails line:

clemens.tuxnet :: ~/Rails/pqgruber ‹master› » emacs Gemfile
clemens.tuxnet :: ~/Rails/pqgruber ‹master*› » bundle install --no-deployment --without production
Updating git://github.com/rails/rails.git
Fetching gem metadata from https://rubygems.org/.......
Fetching gem metadata from https://rubygems.org/..
Could not find gem 'activerecord-deprecated_finders (= 0.0.1) ruby', which is required by gem 'rails (>= 0) ruby', in any of the sources.

Does anybody know how to resolve this? Shouldn't switching from default rails to rails master on github in your Gemfile "just work" ?

Adding gem 'activerecord-deprecated_finders', github: 'rails/activerecord-deprecated_finders' to the Gemfile shouldn't be necessary, in my opinion.. if it's really "deprecated" why not remove it completely? Any remaining dependencies?

clemensg commented Dec 2, 2012

What's the reason for this failure if I exchange my default Rails 3.2.9 line with a github: rails/rails line:

clemens.tuxnet :: ~/Rails/pqgruber ‹master› » emacs Gemfile
clemens.tuxnet :: ~/Rails/pqgruber ‹master*› » bundle install --no-deployment --without production
Updating git://github.com/rails/rails.git
Fetching gem metadata from https://rubygems.org/.......
Fetching gem metadata from https://rubygems.org/..
Could not find gem 'activerecord-deprecated_finders (= 0.0.1) ruby', which is required by gem 'rails (>= 0) ruby', in any of the sources.

Does anybody know how to resolve this? Shouldn't switching from default rails to rails master on github in your Gemfile "just work" ?

Adding gem 'activerecord-deprecated_finders', github: 'rails/activerecord-deprecated_finders' to the Gemfile shouldn't be necessary, in my opinion.. if it's really "deprecated" why not remove it completely? Any remaining dependencies?

@steveklabnik

This comment has been minimized.

Show comment
Hide comment
@steveklabnik

steveklabnik Dec 2, 2012

Member

@clemensg if you're running edge rails, you have to be willing for there to be a little bit of friction.

Member

steveklabnik commented Dec 2, 2012

@clemensg if you're running edge rails, you have to be willing for there to be a little bit of friction.

@ddd

This comment has been minimized.

Show comment
Hide comment
@ddd

ddd Dec 2, 2012

@steveklabnik agreed.

@clemensg If you do what I showed up above, you can then copy over your models, views, and controllers. When dealing with the bleeding edge of something, one should not expect clean exchange of baseline engine+gems. You'll need to generate the way I show, then copy over your M/C/V files. Then backtrack looking for logic changes. There will most likely be some going from 3.x to 4.x, just as there was from 1.x to 2.x, and from 2.x to 3.x.

Also, bear in mind that if you are still using ruby 1.8, you will definitely have to do a swap out to Ruby 1.9, as Ruby 1.8 is not supported under Rails 4.x, going forward.

Not sure if you knew this already, but a reiteration shouldn't be a cause for issue.

ddd commented Dec 2, 2012

@steveklabnik agreed.

@clemensg If you do what I showed up above, you can then copy over your models, views, and controllers. When dealing with the bleeding edge of something, one should not expect clean exchange of baseline engine+gems. You'll need to generate the way I show, then copy over your M/C/V files. Then backtrack looking for logic changes. There will most likely be some going from 3.x to 4.x, just as there was from 1.x to 2.x, and from 2.x to 3.x.

Also, bear in mind that if you are still using ruby 1.8, you will definitely have to do a swap out to Ruby 1.9, as Ruby 1.8 is not supported under Rails 4.x, going forward.

Not sure if you knew this already, but a reiteration shouldn't be a cause for issue.

@clemensg

This comment has been minimized.

Show comment
Hide comment
@clemensg

clemensg Dec 2, 2012

Thanks, I know how to create a new edge rails app, but I did not understand what the reason for the bundler error above was. The activerecord-deprecated_finders gem is in the rails Gemfile, so why doesn't it get pulled in by bundler?

I also must got confused about the upgrade of existing apps to Rails 4. I thought, existing apps still work, if you "just" adapt this one Gemfile line. Did not know that you have to do a rails new xy for migrating an app to the Rails master branch.

@ddd thanks, I did already read your post above.

clemensg commented Dec 2, 2012

Thanks, I know how to create a new edge rails app, but I did not understand what the reason for the bundler error above was. The activerecord-deprecated_finders gem is in the rails Gemfile, so why doesn't it get pulled in by bundler?

I also must got confused about the upgrade of existing apps to Rails 4. I thought, existing apps still work, if you "just" adapt this one Gemfile line. Did not know that you have to do a rails new xy for migrating an app to the Rails master branch.

@ddd thanks, I did already read your post above.

@steveklabnik

This comment has been minimized.

Show comment
Hide comment
@steveklabnik

steveklabnik Dec 3, 2012

Member

Because the activerecord-deprecated_finders gem has yet to be released to RubyGems. As soon as it is, then it will be.

I thought, existing apps still work, if you "just" adapt this one Gemfile line. Did not know that you have to do a rails new xy for migrating an app to the Rails master branch.

You won't, upon the release of Rails 4. And you don't need to do a rails new xy to migrate, that is just one way of doing it.

Member

steveklabnik commented Dec 3, 2012

Because the activerecord-deprecated_finders gem has yet to be released to RubyGems. As soon as it is, then it will be.

I thought, existing apps still work, if you "just" adapt this one Gemfile line. Did not know that you have to do a rails new xy for migrating an app to the Rails master branch.

You won't, upon the release of Rails 4. And you don't need to do a rails new xy to migrate, that is just one way of doing it.

@hdiwan

This comment has been minimized.

Show comment
Hide comment
@hdiwan

hdiwan Feb 27, 2013

Worked with 1 hiccup, I had to change source https://rubyforge.org to source: http://rubyforge.org. I'm on FreeBSD, if it makes a difference, using ruby 2.0.0b1.

hdiwan commented Feb 27, 2013

Worked with 1 hiccup, I had to change source https://rubyforge.org to source: http://rubyforge.org. I'm on FreeBSD, if it makes a difference, using ruby 2.0.0b1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment