qup 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZjdhZTVjYjBiMzU3NTZiZjljOWZiM2IzYzU5MzgyM2FiZTc2MWU4Zg==
5
+ data.tar.gz: !binary |-
6
+ MzdiMDM3YThmYWI1ZjQzODU2NTJlNGEyYzg3NTZmZjM1ZDI0Yjc4OQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NTJhMjdjOGEyMzBhZGQzZjgyYzkwYzc1MDllMmQzYjQxYWM5NDRjMDlkNGU0
10
+ ZmQ2ODc3NmVkYmFmOTRmNTQ3MTZjOWQ0MzE1ZDQ5ZDIzZDJjNjhlYThkYWU3
11
+ NGM1OGQ3N2YyMjY4MjYyOTYyNTcyNWU4MGM3ZjkxMThlY2MzMmQ=
12
+ data.tar.gz: !binary |-
13
+ Y2M3MmI2ODI4MzA0ZjdjNTRhZmE2MDExZjJmOWY2YTMxNTlmNzNjMmQ1MmFj
14
+ ZThjMzYwNDI0YmI4MjVkODg4MzEyZDFjMmMwYzYwYzlmODg3YTUyMDRjOTQy
15
+ YjdlZGMxZjAxMDJmODk2M2U3MDU4NDUwMDI5YTgxNGEzZWY5MDg=
File without changes
@@ -0,0 +1,46 @@
1
+ # Hi there!
2
+
3
+ I see you are interested in contributing. That is wonderful. I love
4
+ contributions.
5
+
6
+ I guarantee that there are bugs in this software. And I guarantee that there is
7
+ a feature you want that is not in here yet. As such, any and all bugs reports
8
+ are gratefully accepted, bugfixes even more so. Helping out with bugs is the
9
+ easiest way to contribute.
10
+
11
+
12
+ ## The Quick Version
13
+
14
+ * Have a [GitHub Account][].
15
+ * Search the [GitHub Issues][] and see if your issue already present. If so
16
+ add your comments, :thumbsup:, etc.
17
+ * Issue not there? Not a problem, open up a [new issue][].
18
+ * **Bug reports** please be as detailed as possible. Include:
19
+ * full ruby engine and version: `ruby -e 'puts RUBY_DESCRIPTION'`
20
+ * operating system and version
21
+ * version of fixme `ruby -rubygems -e "require 'fixme'; puts Fixme::VERSION"`
22
+ * as much detail about the bug as possible so I can replicate it. Feel free
23
+ to link in a [gist][]
24
+ * **New Feature**
25
+ * What the new feature should do.
26
+ * What benefit the new feature brings to the project.
27
+ * Fork the [repo][].
28
+ * Create a new branch for your issue: `git checkout -b issue/my-issue`
29
+ * Lovingly craft your contribution:
30
+ * `rake develop` to get started, or if you prefer bundler `rake develop:using_bundler && bundle`.
31
+ * `rake test` to run tests
32
+ * Make sure that `rake test` passes. It's important, I said it twice.
33
+ * Add yourself to the contributors section below.
34
+ * Submit your [pull request][].
35
+
36
+ # Contributors
37
+
38
+ * [Jeremy Hinegardner](https://github.com/copiousfreetime)
39
+ * [Kevin Barnes](https://github.com/vinbarnes)
40
+
41
+ [GitHub Account]: https://github.com/signup/free "GitHub Signup"
42
+ [GitHub Issues]: https://github.com/copiousfreetime/fixme/issues "Fixme Issues"
43
+ [new issue]: https://github.com/copiousfreetime/fixme/issues/new "New Fixme Issue"
44
+ [gist]: https://gist.github.com/ "New Gist"
45
+ [repo]: https://github.com/copiousfreetime/fixme "Fixme Repo"
46
+ [pull request]: https://help.github.com/articles/using-pull-requests "Using Pull Requests"
@@ -1,47 +1,56 @@
1
- = Changelog
1
+ # Changelog
2
2
 
3
- == Version 1.4.0 - 2012-10-31
3
+ ## Version 1.4.1 - 2013-12-02
4
+
5
+ * update gem dependencies
6
+ * fix maildir adapter bug where subscribers in the same process where not loaded
7
+ * fix redis adapter bug where subscribers where not deleted if the topic was
8
+ removed.
9
+ * fix kestrel adapter bug where subscribers where not deleted if the topic was
10
+ removed.
11
+
12
+ ## Version 1.4.0 - 2012-10-31
4
13
 
5
14
  * Switch to 'kjess' as the Kestrel client.
6
15
 
7
- == Version 1.3.6 - 2012-09-06
16
+ ## Version 1.3.6 - 2012-09-06
8
17
 
9
18
  * Pass options to the Adapters (thanks rafer)
10
19
 
11
- == Version 1.3.5 - 2012-09-06
20
+ ## Version 1.3.5 - 2012-09-06
12
21
 
13
22
  * Rename 'Drainer' to 'BatchConsumer' and add documentation (issue #11, thanks rafer)
14
23
 
15
- == Version 1.3.4 - 2012-08-23
24
+ ## Version 1.3.4 - 2012-08-23
16
25
 
17
26
  * Add 'Drainer' class (issue #10, thanks rafer)
18
27
 
19
- == Version 1.3.3 - 2012-08-06
28
+ ## Version 1.3.3 - 2012-08-06
20
29
 
21
30
  * Fix newline bug (issue #9, thanks rafer)
22
31
 
23
- == Version 1.3.2 - 2012-07-17
32
+ ## Version 1.3.2 - 2012-07-17
24
33
 
25
34
  * Make Queue#consume non-blocking everywhere (issue #7, thanks rafer)
26
35
 
27
- == Version 1.3.1 - 2012-06-21
36
+ ## Version 1.3.1 - 2012-06-21
28
37
 
29
38
  * Add Consumer#depth
30
39
  * Check if the data payload is marshalled data and unmarshal it if it is.
31
40
 
32
- == Version 1.2.2 - 2012-05-17
41
+ ## Version 1.2.2 - 2012-05-17
33
42
 
34
43
  * Use the thrift interface to kestrel instead of the memcache interface
35
44
 
36
- == Version 1.2.0 - 2012-03-17
45
+ ## Version 1.2.0 - 2012-03-17
37
46
 
38
47
  * Persistent subscriptions for the Redis Adapter (issue #2, thanks aniero)
39
48
 
40
- == Version 1.1.0 - 2012-03-12
49
+ ## Version 1.1.0 - 2012-03-12
41
50
 
42
51
  * Addition of a Redis Adapter (issue #1, thanks aniero)
43
52
 
44
- == Version 1.0.0 - 2012-03-10
53
+ ## Version 1.0.0 - 2012-03-10
45
54
 
46
55
  * Initial public release
47
56
 
data/LICENSE ADDED
@@ -0,0 +1,16 @@
1
+ ISC LICENSE - http://opensource.org/licenses/isc-license.txt
2
+
3
+ Copyright (c) 2012,2013 Jeremy Hinegardner
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
+
@@ -1,9 +1,11 @@
1
1
  .autotest
2
2
  .gemtest
3
- ADAPTER_API.rdoc
4
- HISTORY.rdoc
3
+ ADAPTER_API.md
4
+ CONTRIBUTING.md
5
+ HISTORY.md
6
+ LICENSE
5
7
  Manifest.txt
6
- README.rdoc
8
+ README.md
7
9
  Rakefile
8
10
  lib/qup.rb
9
11
  lib/qup/adapter.rb
@@ -54,3 +56,5 @@ spec/qup/shared_topic_examples.rb
54
56
  spec/qup/topic_api_spec.rb
55
57
  spec/qup_spec.rb
56
58
  spec/spec_helper.rb
59
+ tasks/default.rake
60
+ tasks/this.rb
@@ -0,0 +1,167 @@
1
+ # qup - Queue Up
2
+
3
+ * <http://github.com/copiousfreetime/qup>
4
+
5
+ ## DESCRIPTION
6
+
7
+ Qup is a generalized API for Message Queue and Publish/Subscribe messaging
8
+ patterns with the ability to plug in an appropriate messaging infrastructure
9
+ based upon your needs.
10
+
11
+ Qup ships with support for [Kestrel](https://github.com/robey/kestrel),
12
+ [Redis](http://redis.io), and a filesystem infrastructure based on
13
+ [Maildir](https://rubygems.org/gems/maildir). Additional Adapters will be
14
+ developed as needs arise. [Please submit an
15
+ Issue](https://github.com/copiousfreetime/qup/issues) to have a new Adapter
16
+ created. Pull requests gladly accepted.
17
+
18
+ ## FEATURES
19
+
20
+ Qup provides an abstract implementation of two common messaging patterns.
21
+
22
+ ### Basic Message Queue
23
+
24
+ Examples of a basic message queue are [Work/Task
25
+ Queues](http://www.rabbitmq.com/tutorials/tutorial-two-python.html), [JMS
26
+ Queue](http://docs.oracle.com/javaee/6/api/javax/jms/Queue.html), or [Amazon
27
+ SQS](http://aws.amazon.com/sqs/). This is a pattern where one or more Producers
28
+ puts Messages on a Queue and one or more Consumers received those Messages. Each
29
+ Message is delivered only 1 time to a Consumer.
30
+
31
+ ### Publish/Subscribe
32
+
33
+ [Wikipedia Article on Pub/Sub
34
+ pattern](http://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern).
35
+
36
+ Qup implements a Topic based system, where Publishers send Messages on a Topic
37
+ and all Subscribers to that topic each receive their own copy of the message.
38
+
39
+ Qup assumes that the messaging systems it has adapters for provided durable and
40
+ acknowledgeable messaging.
41
+
42
+ ### Durability
43
+
44
+ When message is sent to the messaging system by Qup, the message is persisted to
45
+ disk.
46
+
47
+ ### Acknowledgeable Messages
48
+
49
+ When a Consumer receives a Message, and then processes it, Qup assumes that the
50
+ messaging infrastructure requires that the Message be positively acknowledged.
51
+ In other words, if the Consumer does not acknowledge the message then the
52
+ messages infrastructure will put the Message back onto the Queue.
53
+
54
+ ## SYNOPSIS
55
+
56
+ ### Basic Message Queue
57
+
58
+ session = Qup::Session.new( "maildir:///tmp/test-queue" )
59
+ queue = session.queue( 'basic-messaging' )
60
+ producer = queue.producer
61
+
62
+ consumer_1 = queue.consumer
63
+ consumer_2 = queue.consumer
64
+
65
+ producer.produce( 'message_1' )
66
+ producer.produce( 'message_2' )
67
+
68
+ message_1 = consumer_1.consume
69
+ puts message_1.data # => 'message_1'
70
+ consumer_1.acknowledge( message_1 )
71
+
72
+ consumer_2.consume do |message_2|
73
+ puts message_2.data # => 'message_2'
74
+ end # auto acknowledged at the end of the block
75
+
76
+ ### Publish/Subscribe
77
+
78
+ session = Qup::Session.new( "kestrel://messaging.example.com:22133" )
79
+ topic = session.topic( 'topic-messaging' )
80
+ publisher = topic.publisher
81
+
82
+ subscribers = []
83
+ 3.times do |n|
84
+ subscribers << topic.subscriber( "subscriber-#{n}" )
85
+ end
86
+
87
+ publisher.publish( 'a fine message on a topic' )
88
+
89
+ subscribers.each do |sub|
90
+ sub.consume do |msg|
91
+ puts msg.data # => 'a fine message on a topic'
92
+ end # auto acknowledge an end of block
93
+ end
94
+
95
+ ## REQUIREMENTS
96
+
97
+ Depending on the backend messaging system you want to use, you'll need to
98
+ install additional gems. At the current moment, these are the supported
99
+ messaging backends.
100
+
101
+ * Qup::Adapter::Maildir - built in and uses the 'maildir' gem
102
+ * Qup::Adapter::Kestrel - uses the 'kjess' gem
103
+ * Qup::Adapter::Redis - uses the 'redis' gem
104
+
105
+ ## INSTALL
106
+
107
+ * gem install qup
108
+
109
+ ## DEVELOPERS
110
+
111
+ After checking out the source, run:
112
+
113
+ $ rake develop
114
+
115
+ This task will install any missing dependencies. You may then run:
116
+
117
+ $ rake test
118
+
119
+ Other tasks are viewable with
120
+
121
+ $ rake -T
122
+
123
+ ### Kestrel
124
+
125
+ To run the Kestrel tests you will need:
126
+
127
+ * gem install kjess
128
+ * A Kestrel server running on <tt>localhost:22133</tt>
129
+
130
+ You can download Kestrel from <http://robey.github.com/kestrel/> and then run the
131
+ `scripts/devel.sh` command and you will have a default Kestrel server running on
132
+ `localhost:22133`. This will be enough to run the kestrel tests.
133
+
134
+ ### Redis
135
+
136
+ To run the Redis tests you will need:
137
+
138
+ * `gem install redis`
139
+ * A Redis server running on `localhost:6479`
140
+
141
+ You can download redis using brew, macports or your favorite linux package
142
+ manager.
143
+
144
+ ## LICENSE
145
+
146
+ (The ISC LICENSE)
147
+
148
+ Copyright (c) 2012,2013 Jeremy Hinegardner
149
+
150
+ Permission is hereby granted, free of charge, to any person obtaining
151
+ a copy of this software and associated documentation files (the
152
+ 'Software'), to deal in the Software without restriction, including
153
+ without limitation the rights to use, copy, modify, merge, publish,
154
+ distribute, sublicense, and/or sell copies of the Software, and to
155
+ permit persons to whom the Software is furnished to do so, subject to
156
+ the following conditions:
157
+
158
+ The above copyright notice and this permission notice shall be
159
+ included in all copies or substantial portions of the Software.
160
+
161
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
162
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
163
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
164
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
165
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
166
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
167
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,307 +1,24 @@
1
1
  # vim: syntax=ruby
2
+ load 'tasks/this.rb'
2
3
 
3
4
  This.name = "qup"
4
5
  This.author = "Jeremy Hinegardner"
5
6
  This.email = "jeremy@copiousfreetime.org"
6
7
  This.homepage = "http://github.com/copiousfreetime/#{ This.name }"
7
- This.version = Util.version
8
-
9
- #------------------------------------------------------------------------------
10
- # If you want to Develop on this project just run 'rake develop' and you'll
11
- # have all you need to get going. If you want to use bundler for development,
12
- # then run 'rake develop:using_bundler'
13
- #------------------------------------------------------------------------------
14
- namespace :develop do
15
-
16
- # Install all the development and runtime dependencies of this gem using the
17
- # gemspec.
18
- task :default do
19
- require 'rubygems/dependency_installer'
20
- installer = Gem::DependencyInstaller.new
21
-
22
- # list these here instead of gem dependencies since there is not a way to
23
- # sepcify ruby version specific dependencies
24
- if RUBY_VERSION < "1.9.2"
25
- Util.platform_gemspec.add_development_dependency( 'rcov', '~> 1.0.0' )
26
- else
27
- Util.platform_gemspec.add_development_dependency( 'simplecov', '~> 0.6.4' )
28
- end
29
-
30
- puts "Installing gem depedencies needed for development"
31
- Util.platform_gemspec.dependencies.each do |dep|
32
- if dep.matching_specs.empty? then
33
- puts "Installing : #{dep}"
34
- installer.install dep
35
- else
36
- puts "Skipping : #{dep} -> already installed #{dep.matching_specs.first.full_name}"
37
- end
38
- end
39
- puts "\n\nNow run 'rake test'"
40
- end
41
-
42
- # Create a Gemfile that just references the gemspec
43
- file 'Gemfile' => :gemspec do
44
- File.open( "Gemfile", "w+" ) do |f|
45
- f.puts 'source :rubygems'
46
- f.puts 'gemspec'
47
- end
48
- end
49
-
50
- desc "Create a bundler Gemfile"
51
- task :using_bundler => 'Gemfile' do
52
- puts "Now you can 'bundle'"
53
- end
54
-
55
- # Gemfiles are build artifacts
56
- CLOBBER << FileList['Gemfile*']
57
- end
58
- desc "Boostrap development"
59
- task :develop => "develop:default"
60
-
61
- #------------------------------------------------------------------------------
62
- # RSpec - standard RSpec rake task
63
- #------------------------------------------------------------------------------
64
- begin
65
- require 'rspec/core/rake_task'
66
- RSpec::Core::RakeTask.new( :test ) do |t|
67
- t.ruby_opts = %w[ -w ]
68
- t.rspec_opts = %w[ --color --format documentation ]
69
- end
70
- task :default => :test
71
- rescue LoadError
72
- Util.task_warning( 'test' )
73
- end
74
-
75
- #------------------------------------------------------------------------------
76
- # RDoc - standard rdoc rake task, although we must make sure to use a more
77
- # recent version of rdoc since it is the one that has 'tomdoc' markup
78
- #------------------------------------------------------------------------------
79
- begin
80
- gem 'rdoc' # otherwise we get the wrong task from stdlib
81
- require 'rdoc/task'
82
- RDoc::Task.new do |t|
83
- t.markup = 'tomdoc'
84
- t.rdoc_dir = 'doc'
85
- t.main = 'README.rdoc'
86
- t.title = "#{This.name} #{This.version}"
87
- t.rdoc_files.include( '*.rdoc', 'lib/**/*.rb' )
88
- end
89
- rescue LoadError
90
- Util.task_warning( 'rdoc' )
91
- end
92
-
93
- #------------------------------------------------------------------------------
94
- # Coverage - optional code coverage, rcov for 1.8 and simplecov for 1.9, so
95
- # for the moment only rcov is listed.
96
- #------------------------------------------------------------------------------
97
- if RUBY_VERSION < "1.9.2"
98
- begin
99
- require 'rcov/rcovtask'
100
- Rcov::RcovTask.new( :coverage ) do |t|
101
- t.libs << 'spec'
102
- t.pattern = 'spec/**/*_spec.rb'
103
- t.verbose = true
104
- t.rcov_opts << "-x ^/" # remove all the global files
105
- t.rcov_opts << "--sort coverage" # so we see the worst files at the top
106
- end
107
- rescue LoadError
108
- Util.task_warning( 'rcov' )
109
- end
110
- else
111
- begin
112
- require 'simplecov'
113
- desc "Run tests with code coverage"
114
- task :coverage do
115
- ENV['COVERAGE'] = 'true'
116
- Rake::Task[:test].execute
117
- end
118
- rescue LoadError
119
- Util.task_warning( 'simplecov' )
120
- end
121
- end
122
-
123
- #------------------------------------------------------------------------------
124
- # Manifest - We want an explicit list of thos files that are to be packaged in
125
- # the gem. Most of this is from Hoe.
126
- #------------------------------------------------------------------------------
127
- namespace 'manifest' do
128
- desc "Check the manifest"
129
- task :check => :clean do
130
- files = FileList["**/*", ".*"].exclude( This.exclude_from_manifest ).to_a.sort
131
- files = files.select{ |f| File.file?( f ) }
132
-
133
- tmp = "Manifest.tmp"
134
- File.open( tmp, 'w' ) do |f|
135
- f.puts files.join("\n")
136
- end
137
-
138
- begin
139
- sh "diff -du Manifest.txt #{tmp}"
140
- ensure
141
- rm tmp
142
- end
143
- puts "Manifest looks good"
144
- end
145
-
146
- desc "Generate the manifest"
147
- task :generate => :clean do
148
- files = %x[ git ls-files ].split("\n").sort
149
- files.reject! { |f| f =~ This.exclude_from_manifest }
150
- File.open( "Manifest.txt", "w" ) do |f|
151
- f.puts files.join("\n")
152
- end
153
- end
154
- end
155
-
156
- #------------------------------------------------------------------------------
157
- # Gem Specification
158
- #------------------------------------------------------------------------------
159
- This.gemspec = Hash.new
160
- This.gemspec['ruby'] = Gem::Specification.new do |spec|
161
- spec.name = This.name
162
- spec.version = This.version
163
- spec.author = This.author
164
- spec.email = This.email
165
- spec.homepage = This.homepage
166
-
167
- spec.summary = This.summary
168
- spec.description = This.description
169
-
170
- spec.files = This.manifest
171
- spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
172
- spec.test_files = spec.files.grep(/^spec/)
173
-
174
- spec.extra_rdoc_files += spec.files.grep(/(txt|rdoc)$/)
175
- spec.rdoc_options = [ "--main" , 'README.rdoc',
176
- "--markup", "tomdoc" ]
177
8
 
9
+ This.ruby_gemspec do |spec|
178
10
  # The Runtime Dependencies
179
11
  spec.add_runtime_dependency( 'maildir', '~> 2.1.0' )
180
12
 
181
13
  # Additional functionality if used
182
- spec.add_development_dependency( 'kjess' , '~> 1.0.0' )
183
- spec.add_development_dependency( 'redis' , '~> 3.0.2' )
14
+ spec.add_development_dependency( 'kjess' , '~> 1.2' )
15
+ spec.add_development_dependency( 'redis' , '~> 3.0' )
184
16
 
185
17
  # The Development Dependencies
186
- spec.add_development_dependency( 'rake' , '~> 0.9.2.2')
187
- spec.add_development_dependency( 'rspec' , '~> 2.11.0' )
188
- spec.add_development_dependency( 'rdoc' , '~> 3.12' )
18
+ spec.add_development_dependency( 'rake' , '~> 10.1.0' )
19
+ spec.add_development_dependency( 'rspec' , '~> 2.14.0' )
20
+ spec.add_development_dependency( 'rdoc' , '~> 4.0' )
189
21
 
190
22
  end
191
23
 
192
- # The name of the gemspec file on disk
193
- This.gemspec_file = "#{This.name}.gemspec"
194
-
195
- # Really this is only here to support those who use bundler
196
- desc "Build the #{This.name}.gemspec file"
197
- task :gemspec do
198
- File.open( This.gemspec_file, "wb+" ) do |f|
199
- f.write Util.platform_gemspec.to_ruby
200
- end
201
- end
202
-
203
- # the gemspec is also a dev artifact and should not be kept around.
204
- CLOBBER << This.gemspec_file
205
-
206
- # The standard gem packaging task, everyone has it.
207
- require 'rubygems/package_task'
208
- Gem::PackageTask.new( Util.platform_gemspec ) do
209
- # nothing
210
- end
211
-
212
- #------------------------------------------------------------------------------
213
- # Release - the steps we go through to do a final release, this is pulled from
214
- # a compbination of mojombo's rakegem, hoe and hoe-git
215
- #
216
- # 1) make sure we are on the master branch
217
- # 2) make sure there are no uncommitted items
218
- # 3) check the manifest and make sure all looks good
219
- # 4) build the gem
220
- # 5) do an empty commit to have the commit message of the version
221
- # 6) tag that commit as the version
222
- # 7) push master
223
- # 8) push the tag
224
- # 7) pus the gem
225
- #------------------------------------------------------------------------------
226
- task :release_check do
227
- unless `git branch` =~ /^\* master$/
228
- abort "You must be on the master branch to release!"
229
- end
230
- unless `git status` =~ /^nothing to commit/m
231
- abort "Nope, sorry, you have unfinished business"
232
- end
233
- end
234
-
235
- desc "Create tag v#{This.version}, build and push #{Util.platform_gemspec.full_name} to rubygems.org"
236
- task :release => [ :release_check, 'manifest:check', :gem ] do
237
- sh "git commit --allow-empty -a -m 'Release #{This.version}'"
238
- sh "git tag -a -m 'v#{This.version}' v#{This.version}"
239
- sh "git push origin master"
240
- sh "git push origin v#{This.version}"
241
- sh "gem push pkg/#{Util.platform_gemspec.full_name}.gem"
242
- end
243
-
244
- #------------------------------------------------------------------------------
245
- # Rakefile Support - This is all the guts and utility methods that are
246
- # necessary to support the above tasks.
247
- #
248
- # Lots of Credit for this Rakefile goes to:
249
- #
250
- # Ara T. Howard - see the Rakefile in all of his projects -
251
- # https://github.com/ahoward/
252
- # Tom Preston Werner - his Rakegem project https://github.com/mojombo/rakegem
253
- # Seattle.rb - Hoe - cuz it has relly good stuff in there
254
- #------------------------------------------------------------------------------
255
- BEGIN {
256
-
257
- require 'ostruct'
258
- require 'rake/clean'
259
- require 'rubygems' unless defined? Gem
260
-
261
- module Util
262
- def self.version
263
- line = File.read( "lib/#{ This.name }.rb" )[/^\s*VERSION\s*=\s*.*/]
264
- line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
265
- end
266
-
267
- # Partition an rdoc file into sections and return the text of the section
268
- # as an array of paragraphs
269
- def self.section_of( file, section_name )
270
- re = /^=+ (.*)$/
271
- parts = File.read( file ).split( re )[1..-1]
272
- parts.map! { |p| p.strip }
273
-
274
- sections = Hash.new
275
- Hash[*parts].each do |k,v|
276
- sections[k] = v.split("\n\n")
277
- end
278
- return sections[section_name]
279
- end
280
-
281
- def self.task_warning( task )
282
- warn "WARNING: '#{task}' tasks are not defined. Please run 'rake develop'"
283
- end
284
-
285
- def self.read_manifest
286
- abort "You need a Manifest.txt" unless File.readable?( "Manifest.txt" )
287
- File.readlines( "Manifest.txt" ).map { |l| l.strip }
288
- end
289
-
290
- def self.platform_gemspec
291
- This.gemspec[This.platform]
292
- end
293
- end
294
-
295
- # Hold all the metadata about this project
296
- This = OpenStruct.new
297
- This.platform = (RUBY_PLATFORM == "java") ? "java" : Gem::Platform::RUBY
298
-
299
- desc = Util.section_of( 'README.rdoc', 'DESCRIPTION')
300
- This.summary = desc.first
301
- This.description = desc.join(" ").tr("\n", ' ').gsub(/[{}]/,'').gsub(/\[[^\]]+\]/,'') # strip rdoc
302
-
303
-
304
- This.exclude_from_manifest = %r/tmp$|\.(git|DS_Store)|^(doc|coverage|pkg)|\.gemspec$|\.swp$|\.jar|\.rvmrc$|^kestrel|~$/
305
- This.manifest = Util.read_manifest
306
-
307
- }
24
+ load 'tasks/default.rake'