diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4040c6c --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.gem +.bundle +Gemfile.lock +pkg/* diff --git a/.rvmrc b/.rvmrc new file mode 100644 index 0000000..39b2ebc --- /dev/null +++ b/.rvmrc @@ -0,0 +1 @@ +rvm '1.9.2@celebration' diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..417ceb5 --- /dev/null +++ b/Gemfile @@ -0,0 +1,4 @@ +source "http://rubygems.org" + +# Specify your gem's dependencies in celebration.gemspec +gemspec diff --git a/README.md b/README.md index e69de29..0dc0cd1 100644 --- a/README.md +++ b/README.md @@ -0,0 +1 @@ +# Larry E. Baltz's (LEB's) personal collection of Ruby code diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..ea69913 --- /dev/null +++ b/Rakefile @@ -0,0 +1,17 @@ +require "bundler/gem_tasks" +require 'rspec/core/rake_task' + +task :default => :spec +task :spec => ['spec:1.8', 'spec:1.9'] + +namespace :spec do + task '1.8' do + sh "/bin/bash -c 'rvm 1.8.7@celebration rake spec:just_run'" + end + + task '1.9' do + sh "/bin/bash -c 'rvm 1.9.2@celebration rake spec:just_run'" + end + + RSpec::Core::RakeTask.new(:just_run) +end diff --git a/celebration.gemspec b/celebration.gemspec new file mode 100644 index 0000000..da99774 --- /dev/null +++ b/celebration.gemspec @@ -0,0 +1,26 @@ +# -*- encoding: utf-8 -*- +$:.push File.expand_path('../lib', __FILE__) +require 'celebration/version' + +Gem::Specification.new do |s| + s.name = 'celebration' + s.version = Celebration::VERSION + s.authors = ['Larry Baltz'] + s.email = ['larry@baltz.org'] + s.homepage = '' + s.summary = %q{Larry E. Baltz's (LEB's) personal collection of Ruby code} + # s.description = %q{TODO: Write a gem description} + + s.rubyforge_project = 'celebration' + + 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'] + + # specify any dependencies here; for example: + s.add_development_dependency 'rspec' + s.add_development_dependency 'rr' + s.add_runtime_dependency 'facets' + s.add_runtime_dependency 'backports' +end diff --git a/lib/celebration.rb b/lib/celebration.rb new file mode 100644 index 0000000..2e619e3 --- /dev/null +++ b/lib/celebration.rb @@ -0,0 +1,5 @@ +require "celebration/version" + +module Celebration + # Your code goes here... +end diff --git a/lib/celebration/corext/pathname.rb b/lib/celebration/corext/pathname.rb new file mode 100644 index 0000000..a907fd3 --- /dev/null +++ b/lib/celebration/corext/pathname.rb @@ -0,0 +1 @@ +require 'pathname' diff --git a/lib/celebration/corext/symbol.rb b/lib/celebration/corext/symbol.rb new file mode 100644 index 0000000..ab96f3f --- /dev/null +++ b/lib/celebration/corext/symbol.rb @@ -0,0 +1,4 @@ +class Symbol + alias to_path to_s + alias_method :to_str, :to_s if RUBY_VERSION =~ /1\.8/ +end diff --git a/lib/celebration/version.rb b/lib/celebration/version.rb new file mode 100644 index 0000000..f3fc1cb --- /dev/null +++ b/lib/celebration/version.rb @@ -0,0 +1,3 @@ +module Celebration + VERSION = "0.0.1" +end diff --git a/spec/pathname_spec.rb b/spec/pathname_spec.rb new file mode 100644 index 0000000..ccbc893 --- /dev/null +++ b/spec/pathname_spec.rb @@ -0,0 +1,6 @@ +require 'backports' +require_relative 'spec_helper' + +describe Pathname do + +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..02abce1 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,6 @@ +require 'backports' +require_relative '../lib/celebration/corext/pathname' + +RSpec.configure do |c| + c.mock_with :rr +end diff --git a/spec/symbol_spec.rb b/spec/symbol_spec.rb new file mode 100644 index 0000000..1f7cd42 --- /dev/null +++ b/spec/symbol_spec.rb @@ -0,0 +1,24 @@ +require 'backports' +require_relative 'spec_helper' +require_relative '../lib/celebration/corext/symbol' + +describe Symbol do + describe '#to_path' do + it 'should return the text of the symbol' do + :some_path.to_path.should == 'some_path' + end + end + + describe '#to_str' do + case RUBY_VERSION + when /^1\.8/ + it 'should return the text of the symbol' do + :some_path.to_str.should == 'some_path' + end + else + it 'should not exist' do + :some_path.should_not respond_to(:to_str) + end + end + end +end