-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First commit. Initial implementation.
- Loading branch information
0 parents
commit 1143a48
Showing
9 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,4 @@ | |||
*.gem | |||
.bundle | |||
Gemfile.lock | |||
pkg/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,47 @@ | |||
#!/usr/bin/env bash | |||
|
|||
# This is an RVM Project .rvmrc file, used to automatically load the ruby | |||
# development environment upon cd'ing into the directory | |||
|
|||
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional. | |||
environment_id="ruby-1.8.7-p330@require_relative" | |||
|
|||
# | |||
# First we attempt to load the desired environment directly from the environment | |||
# file, this is very fast and efficicent compared to running through the entire | |||
# CLI and selector. If you want feedback on which environment was used then | |||
# insert the word 'use' after --create as this triggers verbose mode. | |||
# | |||
if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \ | |||
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]] ; then | |||
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id" | |||
else | |||
# If the environment file has not yet been created, use the RVM CLI to select. | |||
rvm --create "$environment_id" | |||
fi | |||
|
|||
# | |||
# If you use an RVM gemset file to install a list of gems (*.gems), you can have | |||
# it be automatically loaded, uncomment the following and adjust the filename if | |||
# necessary. | |||
# | |||
# filename=".gems" | |||
# if [[ -s "$filename" ]] ; then | |||
# rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d' | |||
# fi | |||
|
|||
# | |||
# If you use bundler and would like to run bundle each time you enter the | |||
# directory you can uncomment the following code. | |||
# | |||
# # Ensure that Bundler is installed, install it if it is not. | |||
# if ! command -v bundle ; then | |||
# printf "The rubygem 'bundler' is not installed, installing it now.\n" | |||
# gem install bundler | |||
# fi | |||
# | |||
# # Bundle while redcing excess noise. | |||
# printf "Bundling your gems this may take a few minutes on a fresh clone.\n" | |||
# bundle | grep -v 'Using' | grep -v 'complete' | sed '/^$/d' | |||
# | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,4 @@ | |||
source "http://rubygems.org" | |||
|
|||
# Specify your gem's dependencies in require_relative.gemspec | |||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,9 @@ | |||
require 'bundler' | |||
Bundler::GemHelper.install_tasks | |||
|
|||
task :default => :test | |||
|
|||
require 'rake/testtask' | |||
Rake::TestTask.new do |t| | |||
t.pattern = "test/*_test.rb" | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,8 @@ | |||
$:.delete(".") | |||
|
|||
def require_relative file | |||
$:.unshift(".") | |||
ret = require file | |||
$:.delete(".") | |||
ret | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,3 @@ | |||
module RequireRelative | |||
VERSION = "0.0.1" | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,21 @@ | |||
# -*- encoding: utf-8 -*- | |||
$:.push File.expand_path("../lib", __FILE__) | |||
require "require_relative/version" | |||
|
|||
Gem::Specification.new do |s| | |||
s.name = "require_relative" | |||
s.version = RequireRelative::VERSION | |||
s.platform = Gem::Platform::RUBY | |||
s.authors = ["Steve Klabnik"] | |||
s.email = ["steve@steveklabnik.com"] | |||
s.homepage = "" | |||
s.summary = %q{This backports require_relative to Ruby 1.8.} | |||
s.description = %q{In Ruby 1.9.2, "." was removed from $:. This is a good idea, for security reasons. This gem backports this to Ruby 1.8.} | |||
|
|||
s.add_development_dependency "minitest" | |||
|
|||
s.files = `git ls-files`.split("\n") | |||
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") | |||
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } | |||
s.require_paths = ["lib"] | |||
end |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,18 @@ | |||
require 'rubygems' | |||
require 'bundler' | |||
require 'minitest/autorun' | |||
|
|||
require 'require_relative' | |||
|
|||
class RequireRelativeTest < MiniTest::Unit::TestCase | |||
|
|||
def test_current_dir_not_in_load_path | |||
assert_nil $:.detect{|i| i == "."} | |||
end | |||
|
|||
def test_require_relative | |||
assert require_relative('test/foo') | |||
end | |||
|
|||
end | |||
|