Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Refactor internals to use Bundler for gem management instead of Jewler #6

Merged
merged 1 commit into from

2 participants

David Wilkie Josh Robinson
David Wilkie

FYI here's how you can push new versions to Ruby gems:

  1. Change the version number in lib/currencies/version.rb
  2. bundle exec rake -T # check available rake tasks
  3. bundle exec rake spec # run the tests
  4. bundle exec rake release # tags new version, builds the gem, pushes to Github and Rubygems
Josh Robinson
Owner

First of all I appreciate your contribution. But why change it to use bundler? I have grown fond of Jeweler, it works well, and is actively maintained.

David Wilkie

Hey hexorox,

The made reason I requested this change is because I was having trouble with the git-ruby gem with ruby 1.9.3-p194 which jeweler depends on: see https://rubygems.org/gems/jeweler. That Gem has not been updated for 8 months see: https://github.com/schacon/ruby-git and jeweler itself has not been updated for 4 months see: https://github.com/technicalpickles/jeweler

For me using Bundler seems much cleaner:
A) It has less dependencies (only bundler) and
B) You don't need to specify your Gemspec in your Rakefile which causes duplication and
C) The Gemspec is much smaller as it's not autogenerated

Don't take my word for it though here are some other articles who agree with me:

http://yehudakatz.com/2010/04/02/using-gemspecs-as-intended/
http://jeffkreeftmeijer.com/2010/dont-put-your-gemspec-in-your-rakefile/
http://asciicasts.com/episodes/245-new-gem-with-bundler
http://mlomnicki.com/ruby/rubygems/2011/01/22/jeweler-vs-bundler.html

Josh Robinson
Owner

Sounds reasonable. I will read through those articles. Before merging this I want to make sure I am still able to release updates since I have always used Jeweler for my gems.

David Wilkie dwilkie referenced this pull request in hexorx/countries
Closed

Remove dependency on currencies fork #59

Josh Robinson hexorx merged commit e9df653 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
20 .gitignore
View
@@ -1,7 +1,17 @@
-*.sw?
-.DS_Store
+*.gem
+*.rbc
+.bundle
+.config
+.yardoc
+Gemfile.lock
+InstalledFiles
+_yardoc
coverage
-rdoc
+doc/
+lib/bundler/man
pkg
-.rake_tasks~
-.bundle/
+rdoc
+spec/reports
+test/tmp
+test/version_tmp
+tmp
2  .rvmrc
View
@@ -1 +1 @@
-rvm ruby@currencies
+rvm use ruby-1.9.3@currencies --create
9 Gemfile
View
@@ -1,6 +1,5 @@
-source :rubygems
+source 'https://rubygems.org'
+gem "rake"
-gem 'jeweler', '=1.4.0'
-gem 'rspec', '=1.3.1'
-
-# /* vim: set filetype=ruby : */
+# Specify your gem's dependencies in currencies.gemspec
+gemspec
34 Gemfile.lock
View
@@ -1,20 +1,28 @@
+PATH
+ remote: .
+ specs:
+ currencies (0.4.0)
+
GEM
- remote: http://rubygems.org/
+ remote: https://rubygems.org/
specs:
- gemcutter (0.6.1)
- git (1.2.5)
- jeweler (1.4.0)
- gemcutter (>= 0.1.0)
- git (>= 1.2.5)
- rubyforge (>= 2.0.0)
- json_pure (1.4.6)
- rspec (1.3.1)
- rubyforge (2.0.4)
- json_pure (>= 1.1.7)
+ diff-lcs (1.1.3)
+ rake (0.9.2.2)
+ rspec (2.10.0)
+ rspec-core (~> 2.10.0)
+ rspec-expectations (~> 2.10.0)
+ rspec-mocks (~> 2.10.0)
+ rspec-core (2.10.0)
+ rspec-expectations (2.10.0)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.10.1)
+ yard (0.8.1)
PLATFORMS
ruby
DEPENDENCIES
- jeweler (= 1.4.0)
- rspec (= 1.3.1)
+ currencies!
+ rake
+ rspec
+ yard
4 LICENSE
View
@@ -1,4 +1,6 @@
-Copyright (c) 2009 hexorx
+Copyright (c) 2012 hexorx
+
+MIT License
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
47 Rakefile
View
@@ -1,43 +1,12 @@
-require 'rubygems'
-require 'rake'
-
-begin
- require 'jeweler'
- Jeweler::Tasks.new do |gem|
- gem.name = "currencies"
- gem.summary = %Q{Simple gem for working with currencies. It is extracted from the countries gem and contains all the currency information in the ISO 4217 standard.}
- gem.description = %Q{If you are tracking any kind of assets the currencies gem is for you. It contains every currency in the ISO 4217 standard and allows you to add your own as well. So if you decide to take sparkly buttons as a form of payment you can use currencies to display the shiny button unicode symbol ☼ (disclaimer: ☼ may not look like a shiny button to everyone.) when used with something like the money gem. Speaking of the money gem, currencies gives you an ExchangeBank that the money gem can use to convert from one currency to another. There are plans to have ExchangeRate provider plugin system. Right now the rates are either set manually or pulled from Yahoo Finance.}
- gem.email = "hexorx@gmail.com, pr0d1r2@gmail.com"
- gem.homepage = "http://github.com/hexorx/currencies"
- gem.authors = ["hexorx", "pr0d1r2"]
- gem.add_development_dependency "rspec"
- gem.add_development_dependency "yard"
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
- end
- Jeweler::GemcutterTasks.new
-rescue LoadError
- puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
-end
+#!/usr/bin/env rake
+require "bundler/gem_tasks"
-require 'spec/rake/spectask'
-Spec::Rake::SpecTask.new(:spec) do |spec|
- spec.libs << 'lib' << 'spec'
- spec.spec_files = FileList['spec/**/*_spec.rb']
-end
+require 'rake'
+require 'rspec/core/rake_task'
-Spec::Rake::SpecTask.new(:rcov) do |spec|
- spec.libs << 'lib' << 'spec'
- spec.pattern = 'spec/**/*_spec.rb'
- spec.rcov = true
+desc "Run all examples"
+RSpec::Core::RakeTask.new(:spec) do |t|
+ t.rspec_opts = %w[--color]
end
-task :default => :spec
-
-begin
- require 'yard'
- YARD::Rake::YardocTask.new
-rescue LoadError
- task :yardoc do
- abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
- end
-end
+task :default => [:spec]
1  VERSION
View
@@ -1 +0,0 @@
-0.4.0
77 currencies.gemspec
View
@@ -1,67 +1,20 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE DIRECTLY
-# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-
+require File.expand_path('../lib/currencies/version', __FILE__)
-Gem::Specification.new do |s|
- s.name = %q{currencies}
- s.version = "0.4.0"
+Gem::Specification.new do |gem|
+ gem.authors = ["hexorx", "pr0d1r2"]
+ gem.email = ["hexorx@gmail.com", "pr0d1r2@gmail.com"]
+ gem.description = %q{If you are tracking any kind of assets the currencies gem is for you. It contains every currency in the ISO 4217 standard and allows you to add your own as well. So if you decide to take sparkly buttons as a form of payment you can use currencies to display the shiny button unicode symbol ☼ (disclaimer: ☼ may not look like a shiny button to everyone.) when used with something like the money gem. Speaking of the money gem, currencies gives you an ExchangeBank that the money gem can use to convert from one currency to another. There are plans to have ExchangeRate provider plugin system. Right now the rates are either set manually or pulled from Yahoo Finance.}
+ gem.summary = %q{Simple gem for working with currencies. It is extracted from the countries gem and contains all the currency information in the ISO 4217 standard.}
+ gem.homepage = "http://github.com/hexorx/currencies"
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["hexorx", "pr0d1r2"]
- s.date = %q{2011-02-22}
- s.description = %q{If you are tracking any kind of assets the currencies gem is for you. It contains every currency in the ISO 4217 standard and allows you to add your own as well. So if you decide to take sparkly buttons as a form of payment you can use currencies to display the shiny button unicode symbol ☼ (disclaimer: ☼ may not look like a shiny button to everyone.) when used with something like the money gem. Speaking of the money gem, currencies gives you an ExchangeBank that the money gem can use to convert from one currency to another. There are plans to have ExchangeRate provider plugin system. Right now the rates are either set manually or pulled from Yahoo Finance.}
- s.email = %q{hexorx@gmail.com, pr0d1r2@gmail.com}
- s.extra_rdoc_files = [
- "LICENSE",
- "README.markdown"
- ]
- s.files = [
- ".document",
- ".gitignore",
- ".rvmrc",
- "Gemfile",
- "Gemfile.lock",
- "LICENSE",
- "README.markdown",
- "Rakefile",
- "VERSION",
- "currencies.gemspec",
- "lib/currencies.rb",
- "lib/currencies/currency.rb",
- "lib/currencies/exchange_bank.rb",
- "lib/currencies/extentions.rb",
- "lib/data/iso4217.yaml",
- "lib/iso4217.rb",
- "spec/currency_spec.rb",
- "spec/exchange_bank_spec.rb",
- "spec/spec_helper.rb"
- ]
- s.homepage = %q{http://github.com/hexorx/currencies}
- s.rdoc_options = ["--charset=UTF-8"]
- s.require_paths = ["lib"]
- s.rubygems_version = %q{1.3.7}
- s.summary = %q{Simple gem for working with currencies. It is extracted from the countries gem and contains all the currency information in the ISO 4217 standard.}
- s.test_files = [
- "spec/currency_spec.rb",
- "spec/exchange_bank_spec.rb",
- "spec/spec_helper.rb"
- ]
+ gem.files = `git ls-files`.split($\)
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
+ gem.name = "currencies"
+ gem.require_paths = ["lib"]
+ gem.version = Currencies::VERSION
- if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
- s.specification_version = 3
-
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_development_dependency(%q<rspec>, [">= 0"])
- s.add_development_dependency(%q<yard>, [">= 0"])
- else
- s.add_dependency(%q<rspec>, [">= 0"])
- s.add_dependency(%q<yard>, [">= 0"])
- end
- else
- s.add_dependency(%q<rspec>, [">= 0"])
- s.add_dependency(%q<yard>, [">= 0"])
- end
+ gem.add_development_dependency "rspec"
+ gem.add_development_dependency "yard"
end
-
2  lib/currencies.rb
View
@@ -1,4 +1,4 @@
-$LOAD_PATH << File.expand_path(File.dirname(__FILE__))
+require "currencies/version"
require 'iso4217'
3  lib/currencies/version.rb
View
@@ -0,0 +1,3 @@
+module Currencies
+ VERSION = "0.4.0"
+end
20 spec/currency_spec.rb
View
@@ -1,3 +1,5 @@
+# encoding: utf-8
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe ISO4217::Currency do
@@ -5,7 +7,7 @@
@usd = ISO4217::Currency.from_code(:USD)
@gbp = ISO4217::Currency.from_code(:GBP)
end
-
+
it 'should return code' do
@usd.code.should == 'USD'
@gbp.code.should == 'GBP'
@@ -14,7 +16,7 @@
@usd['code'].should == 'USD'
@gbp['code'].should == 'GBP'
end
-
+
it 'should return symbol' do
@usd.symbol.should == '$'
@gbp.symbol.should == '£'
@@ -23,7 +25,7 @@
@usd['symbol'].should == '$'
@gbp['symbol'].should == '£'
end
-
+
it 'should return name' do
@usd.name.should == 'Dollars'
@gbp.name.should == 'Pounds'
@@ -32,33 +34,33 @@
@usd['name'].should == 'Dollars'
@gbp['name'].should == 'Pounds'
end
-
+
describe 'from_code' do
it 'should return new Currency instance when passed iso4217 currency code' do
ISO4217::Currency.from_code('USD').should be_a(ISO4217::Currency)
end
-
+
it 'should return a currency with the same code' do
ISO4217::Currency.from_code('USD').code.should == 'USD'
ISO4217::Currency.from_code('GBP').code.should == 'GBP'
end
-
+
it 'should accept symbol' do
ISO4217::Currency.from_code(:USD).code.should == 'USD'
ISO4217::Currency.from_code(:GBP).code.should == 'GBP'
end
-
+
it 'should work with lower case' do
ISO4217::Currency.from_code('usd').code.should == 'USD'
ISO4217::Currency.from_code('gbp').code.should == 'GBP'
end
end
-
+
describe 'exchange_rate' do
it 'should return a float' do
ISO4217::Currency.from_code('GBP').exchange_rate.should be_a(Float)
end
-
+
it 'should have an exchange rate of 1.0 for the base currency' do
ISO4217::Currency.from_code(ISO4217::Currency.base_currency).exchange_rate.should == 1.0
end
8 spec/spec_helper.rb
View
@@ -1,9 +1 @@
-$LOAD_PATH.unshift(File.dirname(__FILE__))
-$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'iso4217'
-require 'spec'
-require 'spec/autorun'
-
-Spec::Runner.configure do |config|
-
-end
Something went wrong with that request. Please try again.