Skip to content
Browse files

Replace Nake with a small Ruby script

  • Loading branch information...
1 parent e797f70 commit b917b57ed28af8085419940cff9de4a9340a7b18 @michaelklishin michaelklishin committed
Showing with 20 additions and 47 deletions.
  1. +0 −1 Gemfile
  2. +2 −3 README.textile
  3. +18 −0 generate.rb
  4. +0 −43 tasks.rb
View
1 Gemfile
@@ -3,7 +3,6 @@
source :rubygems
group :development do
- gem "nake", :platform => :mri_19
# excludes Windows, Rubinius and JRuby
gem "perftools.rb", :platform => :mri_18
end
View
5 README.textile
@@ -31,8 +31,7 @@ h3. Contributing
If you want to change some code, don't edit @lib/amq/protocol/client.rb@ —
that file is generated from @protocol.rb.pytemplate@
which is a template file used by @codegen.py@. You can re-generate by running
-<pre>nake ./tasks.rb generate</pre>
-Please note that nake gem only runs on Ruby 1.9.2.
+<pre>generate.rb</pre>
## Maintainer Information
@@ -47,4 +46,4 @@ h2. Links
* "Jabber room for contributors":xmpp://amqp-dev@conf.netlab.cz
* "Ruby AMQP mailing list":http://groups.google.com/group/ruby-amqp
* "Issue tracker":http://github.com/ruby-amqp/amq-protocol/issues
-* "Continous integration server":http://travis-ci.org/#!/ruby-amqp/amq-protocol
+* "Continous integration server":http://travis-ci.org/#!/ruby-amqp/amq-protocol
View
18 generate.rb
@@ -0,0 +1,18 @@
+#!/usr/bin/env ruby
+# encoding: utf-8
+
+def sh(*args)
+ system(*args)
+end
+
+spec = "vendor/rabbitmq-codegen/amqp-rabbitmq-0.9.1.json"
+unless File.exist?(spec)
+ sh "git submodule update --init"
+end
+
+path = "lib/amq/protocol/client.rb"
+sh "./codegen.py client #{spec} #{path}"
+if File.file?(path)
+ sh "./post-processing.rb #{path}"
+ sh "ruby -c #{path}"
+end
View
43 tasks.rb
@@ -1,43 +0,0 @@
-#!/usr/bin/env bundle exec nake
-# encoding: utf-8
-
-# ./tasks.rb generate
-# ./tasks.rb generate --targets=all,
-# ./tasks.rb generate --targets=client,server
-# ./tasks.rb generate --development
-Task.new(:generate) do |task|
- task.description = "Generate lib/amq/protocol/client.rb"
-
- def self.valid_choices
- ["client", "server", "all"]
- end
-
- def self.check_validity_of_target(target)
- unless self.valid_choices.include?(target)
- abort "Target can be one #{valid_choices.inspect}, not #{target.inspect}"
- end
- end
-
- task.define do |opts, spec = nil|
- opts[:targets] ||= ["client"]
-
- if spec.nil?
- spec = "vendor/rabbitmq-codegen/amqp-rabbitmq-0.9.1.json"
- unless File.exist?(spec)
- sh "git submodule update --init"
- end
- end
-
- opts[:targets].each do |type|
- self.check_validity_of_target(type)
- path = "lib/amq/protocol/#{type}.rb"
- sh "DEVELOPMENT=#{opts[:development]} ./codegen.py #{type} #{spec} #{path}"
- if File.file?(path)
- sh "./post-processing.rb #{path}"
- sh "ruby -c #{path}"
- end
- end
- end
-end
-
-Task.tasks.default = Task[:generate] # FIXME: it doesn't work now

0 comments on commit b917b57

Please sign in to comment.
Something went wrong with that request. Please try again.