Permalink
Browse files

bundlerify

  • Loading branch information...
1 parent ccc9861 commit a4f5de84dee848327aa8c2e05f361d85130dbc81 @grosser committed May 14, 2012
Showing with 41 additions and 81 deletions.
  1. +4 −8 Gemfile
  2. +7 −7 Gemfile.lock
  3. +16 −14 Rakefile
  4. +0 −1 VERSION
  5. +10 −49 ar_merge.gemspec
  6. +1 −2 lib/ar_merge.rb
  7. +3 −0 lib/ar_merge/version.rb
View
12 Gemfile
@@ -1,10 +1,6 @@
source :rubygems
+gemspec
-gem 'activerecord'
-
-group :development do
- gem 'rake'
- gem 'sqlite3'
- gem 'rspec', '~>2'
- gem 'jeweler'
-end
+gem 'rake'
+gem 'sqlite3'
+gem 'rspec', '~>2'
View
@@ -1,3 +1,9 @@
+PATH
+ remote: .
+ specs:
+ ar_merge (0.1.3)
+ activerecord
+
GEM
remote: http://rubygems.org/
specs:
@@ -15,12 +21,7 @@ GEM
arel (3.0.2)
builder (3.0.0)
diff-lcs (1.1.3)
- git (1.2.5)
i18n (0.6.0)
- jeweler (1.6.4)
- bundler (~> 1.0)
- git (>= 1.2.5)
- rake
multi_json (1.3.4)
rake (0.9.2.2)
rspec (2.9.0)
@@ -38,8 +39,7 @@ PLATFORMS
ruby
DEPENDENCIES
- activerecord
- jeweler
+ ar_merge!
rake
rspec (~> 2)
sqlite3
View
@@ -1,20 +1,22 @@
+require 'bundler/gem_tasks'
+
task :default do
sh "rspec spec/"
end
-begin
- require 'jeweler'
- project_name = 'ar_merge'
- Jeweler::Tasks.new do |gem|
- gem.name = project_name
- gem.summary = "Merge 2 ActiveRecords, preserving associations and attributes"
- gem.email = "michael@grosser.it"
- gem.homepage = "https://github.com/grosser/#{project_name}"
- gem.authors = ["Michael Grosser"]
- gem.license = "MIT"
- end
+# extracted from https://github.com/grosser/project_template
+rule /^version:bump:.*/ do |t|
+ sh "git status | grep 'nothing to commit'" # ensure we are not dirty
+ index = ['major', 'minor','patch'].index(t.name.split(':').last)
+ file = 'lib/ar_merge/version.rb'
+
+ version_file = File.read(file)
+ old_version, *version_parts = version_file.match(/(\d+)\.(\d+)\.(\d+)/).to_a
+ version_parts[index] = version_parts[index].to_i + 1
+ version_parts[2] = 0 if index < 2 # remove patch for minor
+ version_parts[1] = 0 if index < 1 # remove minor for major
+ new_version = version_parts * '.'
+ File.open(file,'w'){|f| f.write(version_file.sub(old_version, new_version)) }
- Jeweler::GemcutterTasks.new
-rescue LoadError
- puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
+ sh "bundle && git add #{file} Gemfile.lock && git commit -m 'bump version to #{new_version}'"
end
View
@@ -1 +0,0 @@
-0.1.3
View
@@ -1,52 +1,13 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE DIRECTLY
-# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
-# -*- encoding: utf-8 -*-
+$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
+name = "ar_merge"
+require "#{name}/version"
-Gem::Specification.new do |s|
- s.name = %q{ar_merge}
- s.version = "0.1.3"
-
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+Gem::Specification.new name, ARMerge::VERSION do |s|
+ s.summary = "Merge 2 ActiveRecords, preserving associations and attributes"
s.authors = ["Michael Grosser"]
- s.date = %q{2009-12-13}
- s.email = %q{grosser.michael@gmail.com}
- s.extra_rdoc_files = [
- "README.markdown"
- ]
- s.files = [
- "README.markdown",
- "Rakefile",
- "VERSION",
- "ar_merge.gemspec",
- "init.rb",
- "lib/ar_merge.rb",
- "spec/ar_merge_spec.rb",
- "spec/setup_test_model.rb",
- "spec/spec_helper.rb"
- ]
- s.homepage = %q{http://github.com/grosser/ar_merge}
- s.rdoc_options = ["--charset=UTF-8"]
- s.require_paths = ["lib"]
- s.rubygems_version = %q{1.3.5}
- s.summary = %q{Merge 2 ActiveRecords, preserving associations and attributes}
- s.test_files = [
- "spec/spec_helper.rb",
- "spec/ar_merge_spec.rb",
- "spec/setup_test_model.rb"
- ]
-
- if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
- s.specification_version = 3
-
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<activerecord>, [">= 0"])
- else
- s.add_dependency(%q<activerecord>, [">= 0"])
- end
- else
- s.add_dependency(%q<activerecord>, [">= 0"])
- end
+ s.email = "michael@grosser.it"
+ s.homepage = "http://github.com/grosser/#{name}"
+ s.files = `git ls-files`.split("\n")
+ s.license = "MIT"
+ s.add_runtime_dependency "activerecord"
end
-
View
@@ -1,8 +1,7 @@
+require 'ar_merge/version'
require 'active_record'
module ARMerge
- VERSION = File.read( File.join(File.dirname(__FILE__),'..','VERSION') ).strip
-
def self.included(base)
base.extend ClassMethods
base.send(:include, InstanceMethods)
View
@@ -0,0 +1,3 @@
+module ARMerge
+ VERSION = Version = '0.1.3'
+end

0 comments on commit a4f5de8

Please sign in to comment.