, .
- , .
:
Rails Rails:
$ bundle gem my_gem
Rails:
$ rails new my_app --skip-bundle
Rails :
$ cp -R my_app/* my_gem
Rails:
$ cd my_gem
$ bundle install --binstubs --path vendor/bundle
$ cd -
Rakefile Rails:
require "bundler/gem_tasks"
require File.expand_path('../config/application', __FILE__)
MyApp::Application.load_tasks
, :
$ rails server
:
, Rails , "" , config/application.rb , :
# Add additional load paths for your own custom dirs
# config.load_paths += %W(
"..", , Rails. .
, , , , "~/myfiles/". ENV vars , .
, , , :
$:.unshift File.dirname(__FILE__)
Gem Build:
my_gem.gemspec, , , .., :
$ gem build my_gem.gemspec
Successfully built RubyGem
Name: my_gem
Version: 0.0.1
File: my_gem-0.0.1.gem
Rails .
config.ru Rails. AFAIK.
:
$ gem install my_gem
gem. , . rubygems: http://docs.rubygems.org/read/chapter/3
Crate:
Crate:
Rack:
config.ru Rails:
require "config/environment"
use Rails::Rack::LogTailer
use ActionDispatch::Static
run ActionController::Dispatcher.new
Rails. Ruby "require" , LOAD_PATH.
:
require_relative 'filename'
require "config/environment"
:
require './../../filename'
, File.expand_path:
File.expand_path(__FILE__)
:
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'filename'
. , !