Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Commit

Permalink
Removed faulty gemspec history
Browse files Browse the repository at this point in the history
  • Loading branch information
Todd Blackman committed Jul 9, 2012
1 parent 8e8063f commit 6e3e0b7
Show file tree
Hide file tree
Showing 12 changed files with 274 additions and 86 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
*.gem
.bundle
Gemfile.lock
pkg/*
12 changes: 12 additions & 0 deletions .travis.yml
@@ -0,0 +1,12 @@
language: ruby
rvm:
- 1.8.7
- 1.9.2
- 1.9.3
- jruby-18mode # JRuby in 1.8 mode
- jruby-19mode # JRuby in 1.9 mode
- rbx-18mode
script: rake test
gemfile:
- Gemfile.rake-0.8.7
- Gemfile.rake-0.9.2.2
3 changes: 3 additions & 0 deletions Gemfile
@@ -0,0 +1,3 @@
source "http://rubygems.org"

gemspec
4 changes: 4 additions & 0 deletions Gemfile.rake-0.8.7
@@ -0,0 +1,4 @@
source "http://rubygems.org"

gem "rake", "0.8.7"
gemspec
4 changes: 4 additions & 0 deletions Gemfile.rake-0.9.2.2
@@ -0,0 +1,4 @@
source "http://rubygems.org"

gem "rake", "0.9.2.2"
gemspec
54 changes: 0 additions & 54 deletions README

This file was deleted.

78 changes: 78 additions & 0 deletions README.md
@@ -0,0 +1,78 @@
# rake-hooks

Rake hooks let you add callbacks to rake:

[![Build Status](https://secure.travis-ci.org/guillermo/rake-hooks.png)](http://travis-ci.org/guillermo/rake-hooks)
[![endorse](http://api.coderwall.com/guillermo/endorsecount.png)](http://coderwall.com/guillermo)


## Usage

For example in your Rakefile

```ruby
require 'rake/hooks'

task :say_hello do
puts "Good Morning !"
end

after :say_hello do
puts "GoodBye"
end

after :say_hello do
puts "Now go to bed !"
end

before :say_hello do
puts "Hi !"
end
```

Now run with rake

```bash
$ rake say_hello
Hi !
Good Morning !
GoodBye
Now go to bed !
```

You can also pass more than one task and each task will be setup with the
callback

```ruby
before :say_hello, :say_goodbye do
puts "Hi !"
end
```


## Installation

With rubygems use:
```bash
$ gem install rake-hooks
```

With other systems
Add lib dir to load path.

## Dependencies

* Rake

## Author

* [Joel Moss](mailto:joel@developwithstyle.com)
* [Guillermo Álvarez](mailto:guillermo@cientifico.net)

## Web

http://github.com/guillermo/rake-hooks

## Date of writing

9 Sep 2011
1 change: 1 addition & 0 deletions Rakefile
@@ -1,3 +1,4 @@
require "bundler/gem_tasks"
require 'rake/testtask'

Rake::TestTask.new do |t|
Expand Down
42 changes: 30 additions & 12 deletions lib/rake/hooks.rb
@@ -1,16 +1,34 @@
def before(task_name, &new_task)
old_task = Rake.application.instance_variable_get('@tasks').delete(task_name.to_s)
task task_name do
new_task.call
old_task.invoke
module Rake::Hooks
def before(*task_names, &new_task)
task_names.each do |task_name|
old_task = Rake.application.instance_variable_get('@tasks').delete(task_name.to_s)
desc old_task.full_comment
task task_name => old_task.prerequisites do
new_task.call
old_task.invoke
end
end
end
end

def after(task_name, &new_task)
old_task = Rake.application.instance_variable_get('@tasks').delete(task_name.to_s)

task task_name do
old_task.invoke
new_task.call
def after(*task_names, &new_task)
options = task_names.last.is_a?(Hash) ? task_names.pop : {}
ignore_exceptions = options.delete(:ignore_exceptions) || false

task_names.each do |task_name|
old_task = Rake.application.instance_variable_get('@tasks').delete(task_name.to_s)
desc old_task.full_comment
task task_name => old_task.prerequisites do
begin
old_task.invoke
rescue
raise unless ignore_exceptions
end

new_task.call
end
end
end
end

Rake::DSL.send(:include, Rake::Hooks) if defined?(Rake::DSL)
include Rake::Hooks unless self.class.included_modules.include?(Rake::Hooks)
5 changes: 5 additions & 0 deletions lib/rake/hooks/version.rb
@@ -0,0 +1,5 @@
module Rake
module Hooks
VERSION = "1.2.3"
end
end
30 changes: 22 additions & 8 deletions rake-hooks.gemspec
@@ -1,11 +1,25 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "rake/hooks/version"

Gem::Specification.new do |s|
s.name = "rake-hooks"
s.version = "0.1"
s.date = "2010-06-22"
s.authors = ["Guillermo Álvarez"]
s.email = "guillermo@cientifico.net"
s.summary = "Add after and before hooks to rake tasks"
s.homepage = "http://github.com/guillermo/rake-hooks"
s.name = "rake-hooks"
s.version = Rake::Hooks::VERSION
s.email = ["guillermo@cientifico.net", "joel@developwithstyle.com"]
s.authors = ["Guillermo Álvarez", "Joel Moss"]
s.summary = "Add after and before hooks to rake tasks"
s.description = "Add after and before hooks to rake tasks. You can use \"after :task do ... end\" and \"before :task do ... end\"."
s.files = [ "README", "LICENSE", "Rakefile", "test/test_rake_hooks.rb", "lib/rake/hooks.rb"]

s.rubyforge_project = "rake-hooks"

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"]

s.add_runtime_dependency "rake"

s.add_development_dependency "bundler"
end


0 comments on commit 6e3e0b7

Please sign in to comment.