Sha256: f0d0c315ef69ec0e4c7c30fa2b0335d388b659fd06733b0063bd335b3174bdf7

Contents?: true

Size: 393 Bytes

Versions: 5

Compression:

Stored size: 393 Bytes

Contents

begin
  require 'rails' unless defined?(Rails)
rescue LoadError => e
end

module RailsStub

  def self.env
    defined?(Rails) ? Rails.env : ENV['RAILS_ENV']
  end
  
  def self.logger
    defined?(Rails) ? Rails.logger : nil
  end
  
  def self.root
    path = defined?(Rails) ? Rails.root : nil
    path ||= defined?(APP_ROOT) ? APP_ROOT : '.'
    Pathname.new(path).realpath.to_s
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bin_script-0.1.7 lib/bin_script/rails_stub.rb
bin_script-0.1.6 lib/bin_script/rails_stub.rb
bin_script-0.1.5 lib/bin_script/rails_stub.rb
bin_script-0.1.4 lib/bin_script/rails_stub.rb
bin_script-0.1.3 lib/bin_script/rails_stub.rb