Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit to amqp-spec.

  • Loading branch information...
commit a0208a92e2e9729a775a7fba223c95b1079ef3e2 0 parents
@arvicco arvicco authored
21 .gitignore
@@ -0,0 +1,21 @@
+## MAC OS
+.DS_Store
+
+## TEXTMATE
+*.tmproj
+tmtags
+
+## EMACS
+*~
+\#*
+.\#*
+
+## VIM
+*.swp
+
+## PROJECT::GENERAL
+coverage
+rdoc
+pkg
+
+## PROJECT::SPECIFIC
18 Gemfile
@@ -0,0 +1,18 @@
+## Dependencies in this Gemfile are managed through the gemspec. Add/remove
+## depenencies there, rather than editing this file
+#
+#require 'pathname'
+#NAME = 'amqp-spec'
+#BASE_PATH = Pathname.new(__FILE__).dirname
+#GEMSPEC_PATH = BASE_PATH + "#{NAME}.gemspec"
+#
+#source :gemcutter
+#
+## Setup gemspec dependencies
+#gemspec = eval(GEMSPEC_PATH.read)
+#gemspec.dependencies.each do |dep|
+# group = dep.type == :development ? :development : :default
+# gem dep.name, dep.requirement, :group => group
+#end
+#gem(gemspec.name, gemspec.version, :path => BASE_PATH)
+
3  HISTORY
@@ -0,0 +1,3 @@
+== 0.0.0 / 2010-10-13
+
+* Birthday!
20 LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2010 Arvicco
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 README.rdoc
@@ -0,0 +1,27 @@
+= amqp-spec
+by:: Arvicco
+url:: http://github.com/arvicco/amqp-spec
+
+== DESCRIPTION:
+
+FIXME (describe your package)
+
+== FEATURES/PROBLEMS:
+
+* FIXME (list of features or problems)
+
+== SYNOPSIS:
+
+ FIXME (code sample of usage)
+
+== REQUIREMENTS:
+
+* FIXME (list of requirements)
+
+== INSTALL:
+
+ $ sudo gem install amqp-spec
+* FIXME anything else?
+
+== LICENSE:
+Copyright (c) 2010 Arvicco. See LICENSE for details.
24 Rakefile
@@ -0,0 +1,24 @@
+require 'pathname'
+NAME = 'amqp-spec'
+BASE_PATH = Pathname.new(__FILE__).dirname
+LIB_PATH = BASE_PATH + 'lib'
+PKG_PATH = BASE_PATH + 'pkg'
+DOC_PATH = BASE_PATH + 'rdoc'
+
+$LOAD_PATH.unshift LIB_PATH.to_s
+require 'version'
+
+CLASS_NAME = AmqpSpec
+VERSION = CLASS_NAME::VERSION
+
+begin
+ require 'rake'
+rescue LoadError
+ require 'rubygems'
+ gem 'rake', '~> 0.8.3.1'
+ require 'rake'
+end
+
+# Load rakefile tasks
+Dir['tasks/*.rake'].sort.each { |file| load file }
+
1  VERSION
@@ -0,0 +1 @@
+0.0.0
43 amqp-spec.gemspec
@@ -0,0 +1,43 @@
+# Gemspecs should not be generated, but edited directly.
+# Refer to: http://yehudakatz.com/2010/04/02/using-gemspecs-as-intended/
+
+lib = File.expand_path('../lib/', __FILE__)
+$:.unshift lib unless $:.include?(lib)
+
+require 'version'
+require 'date'
+
+Gem::Specification.new do |gem|
+ gem.name = "amqp-spec"
+ gem.version = ::AmqpSpec::VERSION
+ gem.summary = %q{FIXME: New project amqp-spec}
+ gem.description = %q{FIXME: New project amqp-spec}
+ gem.authors = ["arvicco"]
+ gem.email = "arvitallian@gmail.com"
+ gem.homepage = %q{http://github.com/arvicco/amqp-spec}
+ gem.platform = Gem::Platform::RUBY
+ gem.date = Date.today.to_s
+
+ # Files setup
+ versioned = `git ls-files -z`.split("\0")
+ gem.files = Dir['{bin,lib,man,spec,features,tasks}/**/*', 'Rakefile', 'README*', 'LICENSE*',
+ 'VERSION*', 'CHANGELOG*', 'HISTORY*', 'ROADMAP*', '.gitignore'] & versioned
+ gem.executables = (Dir['bin/**/*'] & versioned).map{|file|File.basename(file)}
+ gem.test_files = Dir['spec/**/*'] & versioned
+ gem.require_paths = ["lib"]
+
+ # RDoc setup
+ gem.has_rdoc = true
+ gem.rdoc_options.concat %W{--charset UTF-8 --main README.rdoc --title amqp-spec}
+ gem.extra_rdoc_files = ["LICENSE", "HISTORY", "README.rdoc"]
+
+ # Dependencies
+ gem.add_development_dependency(%q{rspec}, [">= 1.2.9"])
+ gem.add_development_dependency(%q{cucumber}, [">= 0"])
+ #gem.add_dependency(%q{bunder}, [">= 1.2.9"])
+
+ gem.rubyforge_project = ""
+ gem.rubygems_version = `gem -v`
+ #gem.required_rubygems_version = ">= 1.3.6"
+end
+
7 bin/amqp-spec
@@ -0,0 +1,7 @@
+#!/usr/bin/env ruby
+
+require 'pathname'
+require Pathname.new(__FILE__).dirname + '../lib/amqp-spec'
+
+# Put your code here
+
9 features/amqp-spec.feature
@@ -0,0 +1,9 @@
+Feature: something something
+ In order to something something
+ A user something something
+ something something something
+
+ Scenario: something something
+ Given inspiration
+ When I create a sweet new gem
+ Then everyone should see how awesome I am
0  features/step_definitions/amqp-spec_steps.rb
No changes.
7 features/support/env.rb
@@ -0,0 +1,7 @@
+$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
+require 'amqp-spec'
+require 'spec/expectations'
+require 'spec/stubs/cucumber'
+
+require 'pathname'
+BASE_PATH = Pathname.new(__FILE__).dirname + '../..'
25 lib/amqp-spec.rb
@@ -0,0 +1,25 @@
+require 'version'
+
+module AmqpSpec
+
+# require "bundler"
+# Bundler.setup
+
+ # Requires ruby source file(s). Accepts either single filename/glob or Array of filenames/globs.
+ # Accepts following options:
+ # :*file*:: Lib(s) required relative to this file - defaults to __FILE__
+ # :*dir*:: Required lib(s) located under this dir name - defaults to gem name
+ #
+ def self.require_libs( libs, opts={} )
+ file = Pathname.new(opts[:file] || __FILE__)
+ [libs].flatten.each do |lib|
+ name = file.dirname + (opts[:dir] || file.basename('.*')) + lib.gsub(/(?<!.rb)$/, '.rb')
+ Pathname.glob(name.to_s).sort.each {|rb| require rb}
+ end
+ end
+end # module AmqpSpec
+
+# Require all ruby source files located under directory lib/amqp-spec
+# If you need files in specific order, you should specify it here before the glob
+AmqpSpec.require_libs %W[**/*]
+
8 lib/version.rb
@@ -0,0 +1,8 @@
+require 'pathname'
+
+module AmqpSpec
+
+ VERSION_FILE = Pathname.new(__FILE__).dirname + '../VERSION' # :nodoc:
+ VERSION = VERSION_FILE.exist? ? VERSION_FILE.read.strip : nil
+
+end
7 spec/amqp-spec_spec.rb
@@ -0,0 +1,7 @@
+require 'spec_helper'
+
+module AmqpSpecTest
+ describe AmqpSpec do
+ end
+end # module AmqpSpecTest
+
2  spec/spec.opts
@@ -0,0 +1,2 @@
+--color
+--format nested
18 spec/spec_helper.rb
@@ -0,0 +1,18 @@
+require 'amqp-spec'
+require 'spec'
+require 'spec/autorun'
+
+Spec::Runner.configure do |config|
+ # == Mock Framework
+ #
+ # RSpec uses it's own mocking framework by default. If you prefer to
+ # use mocha, flexmock or RR, uncomment the appropriate line:
+ #
+ # config.mock_with :mocha
+ # config.mock_with :flexmock
+ # config.mock_with :rr
+end
+
+module AmqpSpecTest
+
+end # module AmqpSpecTest
18 tasks/common.rake
@@ -0,0 +1,18 @@
+#task :default => 'test:run'
+#task 'gem:release' => 'test:run'
+
+task :notes do
+ puts 'Output annotations (TBD)'
+end
+
+#Bundler not ready for prime time just yet
+#desc 'Bundle dependencies'
+#task :bundle do
+# output = `bundle check 2>&1`
+#
+# unless $?.to_i == 0
+# puts output
+# system "bundle install"
+# puts
+# end
+#end
14 tasks/doc.rake
@@ -0,0 +1,14 @@
+desc 'Alias to doc:rdoc'
+task :doc => 'doc:rdoc'
+
+namespace :doc do
+ require 'rake/rdoctask'
+ Rake::RDocTask.new do |rdoc|
+# Rake::RDocTask.new(:rdoc => "rdoc", :clobber_rdoc => "clobber", :rerdoc => "rerdoc") do |rdoc|
+ rdoc.rdoc_dir = DOC_PATH.basename.to_s
+ rdoc.title = "#{NAME} #{VERSION} Documentation"
+ rdoc.main = "README.doc"
+ rdoc.rdoc_files.include('README*')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+ end
+end
40 tasks/gem.rake
@@ -0,0 +1,40 @@
+desc "Alias to gem:release"
+task :release => 'gem:release'
+
+desc "Alias to gem:install"
+task :install => 'gem:install'
+
+desc "Alias to gem:build"
+task :gem => 'gem:build'
+
+namespace :gem do
+ gem_file = "#{NAME}-#{VERSION}.gem"
+
+ desc "(Re-)Build gem"
+ task :build do
+ puts "Remove existing gem package"
+ rm_rf PKG_PATH
+ puts "Build new gem package"
+ system "gem build #{NAME}.gemspec"
+ puts "Move built gem to package dir"
+ mkdir_p PKG_PATH
+ mv gem_file, PKG_PATH
+ end
+
+ desc "Cleanup already installed gem(s)"
+ task :cleanup do
+ puts "Cleaning up installed gem(s)"
+ system "gem cleanup #{NAME}"
+ end
+
+ desc "Build and install gem"
+ task :install => :build do
+ system "gem install #{PKG_PATH}/#{gem_file}"
+ end
+
+ desc "Build and push gem to Gemcutter"
+ task :release => [:build, 'git:tag'] do
+ puts "Pushing gem to Gemcutter"
+ system "gem push #{PKG_PATH}/#{gem_file}"
+ end
+end
34 tasks/git.rake
@@ -0,0 +1,34 @@
+desc "Alias to git:commit"
+task :git => 'git:commit'
+
+namespace :git do
+
+ desc "Stage and commit your work [with message]"
+ task :commit, [:message] do |t, args|
+ puts "Staging new (unversioned) files"
+ system "git add --all"
+ if args.message
+ puts "Committing with message: #{args.message}"
+ system %Q[git commit -a -m "#{args.message}" --author arvicco]
+ else
+ puts "Committing"
+ system %Q[git commit -a -m "No message" --author arvicco]
+ end
+ end
+
+ desc "Push local changes to Github"
+ task :push => :commit do
+ puts "Pushing local changes to remote"
+ system "git push"
+ end
+
+ desc "Create (release) tag on Github"
+ task :tag => :push do
+ tag = VERSION
+ puts "Creating git tag: #{tag}"
+ system %Q{git tag -a -m "Release tag #{tag}" #{tag}}
+ puts "Pushing #{tag} to remote"
+ system "git push origin #{tag}"
+ end
+
+end
19 tasks/spec.rake
@@ -0,0 +1,19 @@
+desc 'Alias to spec:spec'
+task :spec => 'spec:spec'
+
+namespace :spec do
+ require 'spec/rake/spectask'
+
+ desc "Run all specs"
+ Spec::Rake::SpecTask.new(:spec) do |t|
+ t.spec_opts = ['--options', %Q{"#{BASE_PATH}/spec/spec.opts"}]
+ t.spec_files = FileList['spec/**/*_spec.rb']
+ end
+
+ desc "Run specs with RCov"
+ Spec::Rake::SpecTask.new(:rcov) do |t|
+ t.spec_files = FileList['spec/**/*_spec.rb']
+ t.rcov = true
+ t.rcov_opts = ['--exclude', 'spec']
+ end
+end
71 tasks/version.rake
@@ -0,0 +1,71 @@
+class Version
+ attr_accessor :major, :minor, :patch, :build
+
+ def initialize(version_string)
+ raise "Invalid version #{version_string}" unless version_string =~ /^(\d+)\.(\d+)\.(\d+)(?:\.(.*?))?$/
+ @major = $1.to_i
+ @minor = $2.to_i
+ @patch = $3.to_i
+ @build = $4
+ end
+
+ def bump_major(x)
+ @major += x.to_i
+ @minor = 0
+ @patch = 0
+ @build = nil
+ end
+
+ def bump_minor(x)
+ @minor += x.to_i
+ @patch = 0
+ @build = nil
+ end
+
+ def bump_patch(x)
+ @patch += x.to_i
+ @build = nil
+ end
+
+ def update(major, minor, patch, build=nil)
+ @major = major
+ @minor = minor
+ @patch = patch
+ @build = build
+ end
+
+ def write(desc = nil)
+ CLASS_NAME::VERSION_FILE.open('w') {|file| file.puts to_s }
+ (BASE_PATH + 'HISTORY').open('a') do |file|
+ file.puts "\n== #{to_s} / #{Time.now.strftime '%Y-%m-%d'}\n"
+ file.puts "\n* #{desc}\n" if desc
+ end
+ end
+
+ def to_s
+ [major, minor, patch, build].compact.join('.')
+ end
+end
+
+desc 'Set version: [x.y.z] - explicitly, [1/10/100] - bump major/minor/patch, [.build] - build'
+task :version, [:command, :desc] do |t, args|
+ version = Version.new(VERSION)
+ case args.command
+ when /^(\d+)\.(\d+)\.(\d+)(?:\.(.*?))?$/ # Set version explicitly
+ version.update($1, $2, $3, $4)
+ when /^\.(.*?)$/ # Set build
+ version.build = $1
+ when /^(\d{1})$/ # Bump patch
+ version.bump_patch $1
+ when /^(\d{1})0$/ # Bump minor
+ version.bump_minor $1
+ when /^(\d{1})00$/ # Bump major
+ version.bump_major $1
+ else # Unknown command, just display VERSION
+ puts "#{NAME} #{version}"
+ next
+ end
+
+ puts "Writing version #{version} to VERSION file"
+ version.write args.desc
+end
Please sign in to comment.
Something went wrong with that request. Please try again.