diff --git a/.document b/.document new file mode 100644 index 0000000..3d618dd --- /dev/null +++ b/.document @@ -0,0 +1,5 @@ +lib/**/*.rb +bin/* +- +features/**/*.feature +LICENSE.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eb8e985 --- /dev/null +++ b/.gitignore @@ -0,0 +1,48 @@ +# rcov generated +coverage + +# rdoc generated +rdoc + +# yard generated +doc +.yardoc + +# bundler +.bundle + +# jeweler generated +pkg + +# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore: +# +# * Create a file at ~/.gitignore +# * Include files you want ignored +# * Run: git config --global core.excludesfile ~/.gitignore +# +# After doing this, these files will be ignored in all your git projects, +# saving you from having to 'pollute' every project you touch with them +# +# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line) +# +# For MacOS: +# +#.DS_Store + +# For TextMate +#*.tmproj +#tmtags + +# For emacs: +#*~ +#\#* +#.\#* + +# For vim: +#*.swp + +# For redcar: +#.redcar + +# For rubinius: +#*.rbc diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..4e1e0d2 --- /dev/null +++ b/.rspec @@ -0,0 +1 @@ +--color diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..6dbed2c --- /dev/null +++ b/Gemfile @@ -0,0 +1,15 @@ +source "http://rubygems.org" +# Add dependencies required to use your gem here. +# Example: +# gem "activesupport", ">= 2.3.5" + +# Add dependencies to develop your gem here. +# Include everything needed to run rake, tests, features, etc. +group :development do + gem "rdoc", ">= 0" + gem "rspec", "~> 2.3.0" + gem "cucumber", ">= 0" + gem "bundler", "~> 1.0.0" + gem "jeweler", "~> 1.6.4" + gem "rcov", ">= 0" +end diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..0eef874 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,42 @@ +GEM + remote: http://rubygems.org/ + specs: + builder (3.0.0) + cucumber (1.0.2) + builder (>= 2.1.2) + diff-lcs (>= 1.1.2) + gherkin (~> 2.4.5) + json (>= 1.4.6) + term-ansicolor (>= 1.0.5) + diff-lcs (1.1.2) + gherkin (2.4.5) + json (>= 1.4.6) + git (1.2.5) + jeweler (1.6.4) + bundler (~> 1.0) + git (>= 1.2.5) + rake + json (1.5.3) + rake (0.9.2) + rcov (0.9.9) + rdoc (3.8) + rspec (2.3.0) + rspec-core (~> 2.3.0) + rspec-expectations (~> 2.3.0) + rspec-mocks (~> 2.3.0) + rspec-core (2.3.1) + rspec-expectations (2.3.0) + diff-lcs (~> 1.1.2) + rspec-mocks (2.3.0) + term-ansicolor (1.0.6) + +PLATFORMS + ruby + +DEPENDENCIES + bundler (~> 1.0.0) + cucumber + jeweler (~> 1.6.4) + rcov + rdoc + rspec (~> 2.3.0) diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..5fdd713 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,20 @@ +Copyright (c) 2011 Gregory Eremin + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.rdoc b/README.rdoc new file mode 100644 index 0000000..599395e --- /dev/null +++ b/README.rdoc @@ -0,0 +1,77 @@ + ______ __ __ ______ ______ ______ ______ ______ + /\ ___\ /\ \/\ \ /\ == \ /\___ \ /\ ___\ /\ == \ /\ __ \ + \ \___ \ \ \ \_\ \ \ \ __< \/_/ /__ \ \ __\ \ \ __< \ \ \/\ \ + \/\_____\ \ \_____\ \ \_____\ /\_____\ \ \_____\ \ \_\ \_\ \ \_____\ + \/_____/ \/_____/ \/_____/ \/_____/ \/_____/ \/_/ /_/ \/_____/ + + +Yeah, he IS awesome! + + tjG### + tjfG###j::# + tjfLE###LLDWLi + ,jfE##KW###fi.; :W + jD###KKKW###ft::,WWt + tL###KKKK#### EDi iWWDt + ###KGGEW#WK# KE#GWjLjt + Di#KLLK###KW LK#fWiftit + #Gj#EDK##WEK DW G iD E; + #K#ffKW##WEK# K# E tG D; WWWKK + #E#LG###WEK## fK ## KW fj KKKKKKKK + #K##EE##WK#### W### K# WWKKDEKKEK + #W###EEDEWW#WKW W ###WKGDEKEEW + K#####WWW#KWDLLD# LE ##KKKEGDEKEE# + EK#####KDDEj;,;if##GGGE ###KK#KDDEKKDW + EEKWEEDDDti: .;tEDfWWfLG ###KDWWKKKKKEK# + KEDEDGfEjt;. ,tD#WDjEKLLj ####KK##W##WKK# + WEDfijDGLji,,tGGWGjjftWjtj ############### + KKDjiGEDLfjtfDjEitifftGttt ##########W#### + DWEjfEKEDLLfEjj;iittii;Wtf ################ + DWDLDKWKDGG#KfiiiitiitjWiLK#######GLjj:ijGD + GWEDEKKKDDEWiiiiiiittjj#E#######fLfiji;fjf + EWKKEWWKEtDiiiiiiiiiif#######L#fE###GGGLE + KWKKKKKEitiiiiiiiiiiW#######jijjEW##### + WWKKWWLtiiiiiiiiiL########j,i:jDWEG# + WWWjiiiiiiii;L###WK###Lf,tijjDjK + GW#GEjiiiiiiL####WE###ELf,fDfjfjf + j####iEitii;j###K#KW###EGf,,:;t:j + ######WtW;KE###WK#K###EKWffjGWEE + W#ft####EiEK####KK####EDDLfffDG + W#:t:;K#EED######W####EGGLDDDEWf + i#tjff:;#EK#####WW#####EGLGDEKf;W + jftjffji;###############EDGGDDttiKj + j;ijffjtL################EEDDtii;;iE + D,tjffff#################WWDfiitiit:Wt + #ttjffff################EKGftttt;ii,WWLf + i#iijfLfE###############ffjjititiii;jWi## :iiGft + i#iijfff##############fKftiti;;,,,:LW;### ;,;j;.;ij;t + G#ifjffD##############WEKL;;,,,,,,jW;### :;W##,j###E, + t#jW#fGDW#############i:i##Ej;,,:LWiWEE# :iE####L#t + Di:iE##E##############tti:W##fjtfWt#GGD# ;fG#######Gj + f,:tjiW##############tjjtt;E##LfWfWGfifK itE#####W##Gi + ::,tjtj#############Wffffff;L##DLKDji;tE #W### Gf + :,,tttj#############ffffffff:#EG#Eji,:,j ##K### tE + :,,ttjL############ELLLfffffDWf#WDt;. :iL #K###W fi + :,ijtjG############GGLLGLLLDWf###Gj,. ;tL #K##WK K + :;itjjD############EGGGGGGGWf###WDfi;..,ijKWK##WE + :ittjfE#############EGDDDDEL#####KGjt;,;tt#K###EE + :ttjfLE##########ti###DDEEWE####WWDLjtiij##K###KE + :,jjffK##########fEEEWWKEEW#####KKKDLjjfE#KW##WEE + ;,tjfLK#########jEEEWWWW########WEEEEEEW#KE###EGG + ,,,jfLE#########EEEEKWWWW##W#####EGGDWWGWEK###DGE + :;jfGK########GEEEEKWWW#E###WW##KGfj;;LKE####DEE + :,tLDE########EEEEEEWWWED##### #DLj;tff#####ED + ,,tLDE#######WEKGGEEWWGD##### KGfjj#LGE#WEDE + ,ifGE#######LLDGGDEWGDD#### #EGLG#EEEE#WD# + ;ifDE######EGEDDGGLffLW### WKGE###EE#### + ,G;fEE######GEDDDDGGLfE#### KDD######## + jWjGKW#####ELGDDDGGfLDW### KK######## + E##fLL#####DGGGGGGLLfD### K######## + G##K#WfEfD#EGDGGGLLLGE## #W###### + iL############EGGDDEE#WE ####W + tLjj##################KEW ## + ;tGW,,L###############GKK + tjfWjfDLi,,G#########DfWEW + ,jtfWjtfLGLLLjiWWEEWWWLEEEW + jijjLjjffffttt:WWEKWEWWWKGW + diff --git a/Rakefile b/Rakefile index 5235cfe..c120efc 100644 --- a/Rakefile +++ b/Rakefile @@ -1,15 +1,52 @@ -require "rubygems" +# encoding: utf-8 -spec = Gem::Specification.new do |s| - - s.name = "subzero" - s.version = "0.1.0" - s.summary = "Totally awesome gem that extends Fixnum functionality" - s.description = "Adds one magic method to Fixnum class. Guest what method is it?" - s.authors = ["Gregory Eremin"] - s.email = "chez@vim.me" - s.homepage = "https://github.com/magnolia-fan/subzero" +require 'rubygems' +require 'bundler' +begin + Bundler.setup(:default, :development) +rescue Bundler::BundlerError => e + $stderr.puts e.message + $stderr.puts "Run `bundle install` to install missing gems" + exit e.status_code +end +require 'rake' - s.require_paths = ["lib"] - -end \ No newline at end of file +require 'jeweler' +Jeweler::Tasks.new do |gem| + # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options + gem.name = "subzero" + gem.homepage = "http://github.com/magnolia-fan/subzero" + gem.license = "MIT" + gem.summary = %Q{Totally awesome gem that extends Fixnum functionality} + gem.description = %Q{Adds one magic method to the Numeric class. Guest what method is it?} + gem.email = "magnolia_fan@me.com" + gem.authors = ["Gregory Eremin"] + # dependencies defined in Gemfile +end +Jeweler::RubygemsDotOrgTasks.new + +require 'rspec/core' +require 'rspec/core/rake_task' +RSpec::Core::RakeTask.new(:spec) do |spec| + spec.pattern = FileList['spec/**/*_spec.rb'] +end + +RSpec::Core::RakeTask.new(:rcov) do |spec| + spec.pattern = 'spec/**/*_spec.rb' + spec.rcov = true +end + +require 'cucumber/rake/task' +Cucumber::Rake::Task.new(:features) + +task :default => :spec + +require 'rdoc/task' +RDoc::Task.new do |rdoc| + version = File.exist?('VERSION') ? File.read('VERSION') : "" + + rdoc.rdoc_dir = 'rdoc' + rdoc.title = "subzero #{version}" + rdoc.rdoc_files.include('README*') + rdoc.rdoc_files.include('lib/**/*.rb') +end diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..afaf360 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.0.0 \ No newline at end of file diff --git a/features/step_definitions/subzero_steps.rb b/features/step_definitions/subzero_steps.rb new file mode 100644 index 0000000..e69de29 diff --git a/features/subzero.feature b/features/subzero.feature new file mode 100644 index 0000000..b908b60 --- /dev/null +++ b/features/subzero.feature @@ -0,0 +1,9 @@ +Feature: something something + In order to something something + A user something something + something something something + + Scenario: something something + Given inspiration + When I create a sweet new gem + Then everyone should see how awesome I am diff --git a/features/support/env.rb b/features/support/env.rb new file mode 100644 index 0000000..45b9bfb --- /dev/null +++ b/features/support/env.rb @@ -0,0 +1,13 @@ +require 'bundler' +begin + Bundler.setup(:default, :development) +rescue Bundler::BundlerError => e + $stderr.puts e.message + $stderr.puts "Run `bundle install` to install missing gems" + exit e.status_code +end + +$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib') +require 'subzero' + +require 'rspec/expectations' diff --git a/lib/subzero.rb b/lib/subzero.rb index 6681965..687fc8b 100644 --- a/lib/subzero.rb +++ b/lib/subzero.rb @@ -1,4 +1,4 @@ -class Fixnum +class Numeric def subzero? self < 0 end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..4109076 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,12 @@ +$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) +$LOAD_PATH.unshift(File.dirname(__FILE__)) +require 'rspec' +require 'subzero' + +# Requires supporting files with custom matchers and macros, etc, +# in ./support/ and its subdirectories. +Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f} + +RSpec.configure do |config| + +end diff --git a/spec/subzero_spec.rb b/spec/subzero_spec.rb new file mode 100644 index 0000000..cce8344 --- /dev/null +++ b/spec/subzero_spec.rb @@ -0,0 +1,14 @@ +require File.expand_path(File.dirname(__FILE__) + '/spec_helper') + +describe "Number" do + it "should be subzero" do + -1.subzero?.should == true + -0.123.subzero?.should == true + -1000.subzero?.should == true + end + it "should be uncool" do + 0.subzero?.should == false + 1.subzero?.should == false + 0.123.subzero?.should == false + end +end diff --git a/subzero.gemspec b/subzero.gemspec deleted file mode 100644 index 5d94b18..0000000 --- a/subzero.gemspec +++ /dev/null @@ -1,15 +0,0 @@ -Gem::Specification.new do |s| - - s.name = %q{subzero} - s.version = "0.1.0" - - s.authors = ["Gregory Eremin"] - s.date = %q{2011-06-30} - s.email = %q{chez@vim.me} - s.files = ["lib/subzero.rb"] - s.homepage = %q{https://github.com/magnolia-fan/subzero} - s.require_paths = ["lib"] - s.summary = %q{Totally awesome gem that extends Fixnum functionality} - s.description = %q{Adds one magic method to Fixnum class. Guest what method is it?} - -end \ No newline at end of file