mirror of
https://github.com/pry/pry-rails.git
synced 2022-11-09 12:36:03 -05:00
1.8 compatibility and Readme updates
This commit is contained in:
parent
16c0f2a459
commit
c3feb6f3d8
8 changed files with 57 additions and 20 deletions
|
@ -18,7 +18,9 @@ end
|
|||
appraise "rails4" do
|
||||
gem "rails",
|
||||
:git => "git@github.com:rails/rails.git"
|
||||
gem "active_record_deprecated_finders",
|
||||
:git => "git@github.com:rails/active_record_deprecated_finders"
|
||||
gem "activerecord-deprecated_finders",
|
||||
:git => "git@github.com:rails/activerecord-deprecated_finders"
|
||||
gem "journey",
|
||||
:git => "git@github.com:rails/journey"
|
||||
gem "sqlite3"
|
||||
end
|
||||
|
|
14
Appraisals-1.8
Normal file
14
Appraisals-1.8
Normal file
|
@ -0,0 +1,14 @@
|
|||
appraise "rails30" do
|
||||
gem "rails", "3.0.15"
|
||||
gem "sqlite3"
|
||||
end
|
||||
|
||||
appraise "rails31" do
|
||||
gem "rails", "3.1.6"
|
||||
gem "sqlite3"
|
||||
end
|
||||
|
||||
appraise "rails32" do
|
||||
gem "rails", "3.2.6"
|
||||
gem "sqlite3"
|
||||
end
|
21
Rakefile
21
Rakefile
|
@ -4,6 +4,16 @@ require "bundler/gem_tasks"
|
|||
require "rake/testtask"
|
||||
require "appraisal"
|
||||
|
||||
if RUBY_VERSION =~ /^1.8/
|
||||
module Appraisal
|
||||
class File
|
||||
def path
|
||||
'Appraisals-1.8'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Rake::TestTask.new do |t|
|
||||
t.libs.concat %w(pry-rails spec)
|
||||
t.pattern = "spec/*_spec.rb"
|
||||
|
@ -12,8 +22,13 @@ end
|
|||
desc 'Start the Rails server'
|
||||
task :server => :development_env do
|
||||
require 'rails/commands/server'
|
||||
Rails::Server.start(server: 'WEBrick', environment: 'development',
|
||||
Host: '0.0.0.0', Port: 3000, config: 'config/config.ru')
|
||||
Rails::Server.start(
|
||||
:server => 'WEBrick',
|
||||
:environment => 'development',
|
||||
:Host => '0.0.0.0',
|
||||
:Port => 3000,
|
||||
:config => 'config/config.ru'
|
||||
)
|
||||
end
|
||||
|
||||
desc 'Start the Rails console'
|
||||
|
@ -24,7 +39,7 @@ end
|
|||
|
||||
task :development_env do
|
||||
ENV['RAILS_ENV'] = 'development'
|
||||
require_relative 'spec/config/environment'
|
||||
require File.expand_path('../spec/config/environment', __FILE__)
|
||||
Dir.chdir(Rails.application.root)
|
||||
end
|
||||
|
||||
|
|
19
Readme.md
19
Readme.md
|
@ -72,18 +72,19 @@ Pokemon
|
|||
has_many beers through hacker
|
||||
```
|
||||
|
||||
# Developing
|
||||
# Developing and Testing
|
||||
|
||||
To initialize the dev environment for pry-rails, run
|
||||
`rake init_test_app`.
|
||||
To generate Gemfiles for Rails 3.0, 3.1, 3.2, and 4.0, run
|
||||
`rake appraisal:gemfiles appraisal:install`.
|
||||
|
||||
To test any changes across Rails 3.0, 3.1, 3.2, and 4.0, run
|
||||
`rake appraisal console` and `rake appraisal server`.
|
||||
You can then run the tests across all four versions with `rake appraisal`.
|
||||
You can also manually run the Rails console and server with `rake
|
||||
appraisal console` and `rake appraisal server`.
|
||||
|
||||
For a specific version of Rails, you can use `rake appraisal:rails30`,
|
||||
`rake appraisal:rails31`, `rake appraisal:rails32`, and `rake
|
||||
appraisal:rails4`.
|
||||
For a specific version of Rails, use `rake appraisal:rails30`, `rake
|
||||
appraisal:rails31`, `rake appraisal:rails32`, or `rake appraisal:rails4`.
|
||||
|
||||
# Alternative
|
||||
|
||||
If you want to enable pry everywhere, make sure to check out [pry everywhere](http://lucapette.com/pry/pry-everywhere/).
|
||||
If you want to enable pry everywhere, make sure to check out
|
||||
[pry everywhere](http://lucapette.com/pry/pry-everywhere/).
|
||||
|
|
|
@ -37,7 +37,11 @@ PryRails::Commands.create_command "show-models" do
|
|||
display_error "Table doesn't exist"
|
||||
end
|
||||
|
||||
model.reflections.each do |other_model, reflection|
|
||||
reflections = model.reflections.sort_by do |other_model, reflection|
|
||||
[reflection.macro.to_s, other_model.to_s]
|
||||
end
|
||||
|
||||
reflections.each do |other_model, reflection|
|
||||
options = []
|
||||
|
||||
if reflection.options[:through].present?
|
||||
|
|
|
@ -20,5 +20,6 @@ Gem::Specification.new do |s|
|
|||
|
||||
s.add_dependency "pry", ">= 0.9.10"
|
||||
s.add_development_dependency "appraisal"
|
||||
s.add_development_dependency "minitest"
|
||||
s.add_development_dependency "rr"
|
||||
end
|
||||
|
|
|
@ -55,7 +55,7 @@ end
|
|||
|
||||
class Pokemon < ActiveRecord::Base
|
||||
belongs_to :hacker
|
||||
has_many :beers, through: :hacker
|
||||
has_many :beers, :through => :hacker
|
||||
end
|
||||
|
||||
begin
|
||||
|
@ -64,7 +64,7 @@ begin
|
|||
class Artist
|
||||
include Mongoid::Document
|
||||
|
||||
field :name, type: String
|
||||
field :name, :type => String
|
||||
embeds_one :beer
|
||||
embeds_many :instruments
|
||||
end
|
||||
|
@ -72,8 +72,8 @@ begin
|
|||
class Instrument
|
||||
include Mongoid::Document
|
||||
|
||||
field :name, type: String
|
||||
field :name, :type => String
|
||||
embedded_in :artist
|
||||
end
|
||||
rescue LoadError # Mongoid doesn't support Rails 3.0 or 4.0
|
||||
rescue LoadError # Mongoid doesn't support Rails 3.0 or 4.0 or Ruby 1.8
|
||||
end
|
||||
|
|
|
@ -18,8 +18,8 @@ Beer
|
|||
Hacker
|
||||
id: integer
|
||||
social_ability: integer
|
||||
has_many :pokemons
|
||||
has_many :beers
|
||||
has_many :pokemons
|
||||
Pokemon
|
||||
id: integer
|
||||
name: string
|
||||
|
|
Loading…
Add table
Reference in a new issue