이 패치를 적용해야 할 때부터 모든 것이 시작되었습니다. http://seclists.org/oss-sec/2012/q2/504. 겉으로보기에는 단순한 작업이 * ss의 고통이었습니다.포크 (및 패치 된) 레일 사용하기 2-3 ~ 안정적인 git에서
가 나는 다음과 같은 옵션을 알고 있었다 : 그것은 나를 공식 REPO와 리베이스 수 때문에 옵션 # 3, 나에게 가장 매력적인 보였다
1.Monkeypatch;
2.Vendor rails;
3.fork Rails, apply the patch for 2.3 to the 2-3-stable
branch and use it in the Gemfile.
, 필요한 경우; 깨끗한 방법으로 추가 변경 사항 적용 - Rails의 보석에서 수십 개의 소스 파일을 가지고 앱 저장소를 파기 할 필요가 없습니다. 2.3 - stable 브랜치가 종종 업데이트되지 않기 때문에 Monkey patching이 그 일을했을지 모르지만, 나는 이와 같은 패치를위한 클래스를 여는 것을 정말로 좋아하지 않습니다.
그래서 # 3으로 진행했습니다.
1. I forked Rails;
2. I cloned my Rails repo locally;
3. I applied the 2.3 patch (http://seclists.org/oss-sec/2012/q2/att-504/2-3-sql-injection.patch)
using git am --signoff;
4. I pushed the changes.
5. I went to our app's Gemfile and added:
gem "rails","2.3.14", :git => "git://github.com/fullofcaffeine/rails.git", :branch => "2-3-stable"
6. Ran bundle install
번들 설치가 성공적으로 완료되면 모든 것이 멋지게 보입니다. 레일즈 서버를 시작하려고 할 때 "로드 할 파일이 없습니다 - 초기화 프로그램" 오류가 있습니다.
약간의 인터넷 검색 결과, 다음 게시물을 발견했습니다. How to use a branch in a fork of rails in a project with bundler. 나는 gemspec을 수동으로 생성하고 그에 따라 Gemfile을 변경했다고 말한 것과 똑같습니다. 내가 들러를 실행하려고 할 때, 놀랍게도 그것은 문제없이 실행, 그리고 출력이를 보았다 :
Using activerecord (2.3.14) from git://github.com/fullofcaffeine/rails.git (at 2-3-stable) Successfully built RubyGem
Name: activerecord
Version: 2.3.14
File: activerecord-2.3.14.gem
Using rails (2.3.14) from git://github.com/fullofcaffeine/rails.git (at 2-3-stable) Successfully built RubyGem
Name: rails
Version: 2.3.14
File: rails-2.3.14.gem
...
등, 보석의 각 난에 대한 gemspec을 생성합니다. 내가 Bundler를 내장 보석 (나는 Bundler를 보석을 구축에 대해 위에 붙여 메시지를) 찾을하려고하면, 또한
$ script/server
/Users/fullofcaffeine/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/source.rb:572:in `load_spec_files': git://github.com/fullofcaffeine/rails.git (at 2-3-stable) is not checked out. Please run `bundle install` (Bundler::GitError)
from /Users/fullofcaffeine/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/source.rb:385:in `local_specs'
from /Users/fullofcaffeine/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/source.rb:555:in `specs'
from /Users/fullofcaffeine/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/definition.rb:356:in `converge_locked_specs'
from /Users/fullofcaffeine/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/definition.rb:345:in `each'
from /Users/fullofcaffeine/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/definition.rb:345:in `converge_locked_specs'
from /Users/fullofcaffeine/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/definition.rb:143:in `resolve'
from /Users/fullofcaffeine/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/definition.rb:90:in `specs'
from /Users/fullofcaffeine/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/definition.rb:135:in `specs_for'
from /Users/fullofcaffeine/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/definition.rb:124:in `requested_specs'
from /Users/fullofcaffeine/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/environment.rb:23:in `requested_specs'
from /Users/fullofcaffeine/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/runtime.rb:11:in `setup'
from /Users/fullofcaffeine/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler.rb:110:in `setup'
from ./script/../config/../config/preinitializer.rb:16
from ./script/../config/boot.rb:28:in `load'
from ./script/../config/boot.rb:28:in `preinitialize'
from ./script/../config/boot.rb:10:in `boot!'
from ./script/../config/boot.rb:125
from script/server:3:in `require'
from script/server:3
: 나는 레일 서버를 실행하려고하면
그러나,이 얻을 , 나는 그들을 찾을 수 없다.
나는 정말로 무엇을해야할지 모르지만, 그러한 단순한 작업은 악몽으로 변했습니다. 이 수업에 너무 많은 시간을 보내고 있다면 수업을 monkeypatch 할 수도 있습니다.
- 그래서 정말 문제입니다 - 시나리오 "나는 패치를 적용하거나 내 요구에 레일을 사용자 정의해야"이 위한 가장 실용적인 해결책은 무엇인가?
편집 : 나는, 지금 monkeypatching하여 문제를 해결 아래에있는 내 마지막 코멘트를 참조하십시오.
'번들 설치'를 실행하라는 메시지가 표시됩니다. 처음 설치시 오류가 발생하면 다시 설치합니까? –
안녕하세요. 예, 그랬습니다. Bundler FAQ를 따랐습니다. 내가 할 수있는 모든 것을 정리했습니다 (Gemfile.lock 등을 삭제했습니다).번들 설치를 실행하면 --verbose와 동일한 출력을 얻습니다. Bundler는 Rails repo에서 각각의 보석에 대한 보석을 만들었지 만 Rails를 시작하려고 할 때도 동일한 오류가 발생한다고 말합니다. – FullOfCaffeine
아마도 번들 업그레이드를 시도해 보시겠습니까? 귀하의 버전은 최신 버전보다 조금 뒤떨어져 있습니다. –