Skip to content
Browse files

Restructure the project

* Regenerate the project skeleton using Bundler instead of Jeweler
* Add MIT License
* Configure Travis CI and organize dependencies to work with it
* Configure rubygems-test
* Credit individual contributors in ninja-deploy.gemspec
* Set up YARD for documentation
* Set up Guard for automated test/spec/feature running
  • Loading branch information...
1 parent d470abd commit abb300f288ade664f1c45498e49d57ed3b55a904 @njonsson njonsson committed Feb 1, 2012
Showing with 140 additions and 153 deletions.
  1. +3 −25 .gitignore
  2. +11 −0 .travis.yml
  3. +1 −0 .yardopts
  4. +17 −6 Gemfile
  5. +17 −0 Guardfile
  6. +9 −0 MIT-LICENSE.markdown
  7. +2 −2 README.rdoc
  8. +29 −34 Rakefile
  9. +0 −1 VERSION
  10. +1 −3 lib/ninja_deploy.rb
  11. +5 −0 lib/ninja_deploy/version.rb
  12. +24 −65 ninja-deploy.gemspec
  13. +0 −7 spec/ninja-deploy_spec.rb
  14. +5 −0 spec/ninja_deploy/version_spec.rb
  15. +16 −0 spec/ninja_deploy_spec.rb
  16. +0 −1 spec/spec.opts
  17. +0 −9 spec/spec_helper.rb
View
28 .gitignore
@@ -1,28 +1,6 @@
-## MAC OS
-.DS_Store
-
-## TEXTMATE
-*.tmproj
-tmtags
-
-## EMACS
-*~
-\#*
-.\#*
-
-## VIM
-*.swp
-
-## RVM
+.bundle
.rvmrc
-
-## BUNDLER
-.bundle/
+.yardoc
Gemfile.lock
-
-## PROJECT::GENERAL
-coverage
-rdoc
+doc
pkg
-
-## PROJECT::SPECIFIC
View
11 .travis.yml
@@ -0,0 +1,11 @@
+bundler_args: --without debug doc tooling
+rvm:
+ - 1.8.7
+ - 1.9.2
+ - 1.9.3
+ - ree
+ - jruby-18mode
+ - jruby-19mode
+ - rbx-18mode
+ - rbx-19mode
+script: "bundle exec rake"
View
1 .yardopts
@@ -0,0 +1 @@
+--file MIT-LICENSE.markdown --no-private --protected --title "ninja-deploy"
View
23 Gemfile
@@ -1,9 +1,20 @@
source 'http://rubygems.org'
-gem 'cape', '~> 1'
+gemspec
-group :development do
- gem 'gem-dandy'
- gem 'jeweler'
- gem 'rspec', '1.3.2'
-end
+group :debug do
+ gem 'ruby-debug', '~> 0', :platforms => :mri_18
+ gem 'ruby-debug19', '~> 0', :platforms => :mri_19, :require => 'ruby-debug'
+end
+
+group :doc do
+ gem 'yard', '~> 0', :platforms => [:ruby, :mswin, :mingw]
+ gem 'rdiscount', '~> 1', :platforms => [:ruby, :mswin, :mingw]
+end
+
+group :tooling do
+ gem 'guard-rspec', '~> 0'
+ if RUBY_PLATFORM =~ /darwin/i
+ gem 'rb-fsevent', '~> 0', :require => false
+ end
+end
View
17 Guardfile
@@ -0,0 +1,17 @@
+guard 'rspec', :cli => '--color', :version => 2 do
+ # Run the corresponding spec (or all specs) when code changes.
+ watch( %r{^lib/(.+)\.rb$} ) do |match|
+ corresponding_spec = "spec/#{match[1]}_spec.rb"
+ if File.file?( File.expand_path( "../#{corresponding_spec}", __FILE__ ))
+ corresponding_spec
+ else
+ 'spec'
+ end
+ end
+
+ # Run a spec when it changes.
+ watch %r{^spec/.+_spec\.rb$}
+
+ # Run all specs when the bundle changes.
+ watch( 'Gemfile.lock' ) { 'spec' }
+end
View
9 MIT-LICENSE.markdown
@@ -0,0 +1,9 @@
+# The MIT License
+
+Source code for _ninja-deploy_ is Copyright © 2010–2012 [Jason Harrelson](mailto:jason@lookforwardenterprises.com), [Nils Jonsson](mailto:ninja-deploy@nilsjonsson.com) and [contributors](http://github.com/ninja-loss/ninja-deploy/contributors "ninja-deploy contributors at GitHub").
+
+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.
View
4 README.rdoc
@@ -304,6 +304,6 @@ From Command-Line:
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
* Send me a pull request. Bonus points for topic branches.
-== Copyright
+== License
-Copyright (c) 2010 Ninja Loss. See LICENSE for details.
+Released under the MIT License.
View
63 Rakefile
@@ -1,45 +1,40 @@
-require 'rubygems'
-require 'rake'
-
begin
- require 'jeweler'
- Jeweler::Tasks.new do |gem|
- gem.name = "ninja-deploy"
- gem.summary = %Q{Common shared deployment recipes.}
- gem.description = %Q{Common shared deployment recipes for your pleasure.}
- gem.email = "ninja.loss@gmail.com"
- gem.homepage = "http://github.com/ninja-loss/ninja-deploy"
- gem.authors = ["Ninja Loss"]
- gem.add_development_dependency "rspec", ">= 1.2.9"
- gem.add_development_dependency "yard", ">= 0"
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
- end
- Jeweler::GemcutterTasks.new
+ require 'bundler/gem_tasks'
rescue LoadError
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
end
+require 'rspec/core/rake_task'
-require 'spec/rake/spectask'
-Spec::Rake::SpecTask.new(:spec) do |spec|
- spec.libs << 'lib' << 'spec'
- spec.spec_files = FileList['spec/**/*_spec.rb']
+begin
+ require 'yard'
+rescue LoadError
+else
+ namespace :build do
+ YARD::Rake::YardocTask.new :doc
+ end
end
-Spec::Rake::SpecTask.new(:rcov) do |spec|
- spec.libs << 'lib' << 'spec'
- spec.pattern = 'spec/**/*_spec.rb'
- spec.rcov = true
+def define_spec_task(name, options={})
+ RSpec::Core::RakeTask.new name do |t|
+ t.rspec_opts = ['--color']
+ unless options[:debug] == false
+ begin
+ require 'ruby-debug'
+ rescue LoadError
+ else
+ t.rspec_opts << '--debug'
+ end
+ end
+ t.pattern = %w(spec/*_spec.rb spec/**/*_spec.rb)
+ end
end
-task :spec => :check_dependencies
+desc 'Run all specs'
+define_spec_task :spec
+desc 'Run all specs'
+task '' => :spec
task :default => :spec
-begin
- require 'yard'
- YARD::Rake::YardocTask.new
-rescue LoadError
- task :yardoc do
- abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
- end
-end
+# Support the 'gem test' command.
+desc ''
+define_spec_task :test, :debug => false
View
1 VERSION
@@ -1 +0,0 @@
-1.4.0
View
4 lib/ninja_deploy.rb
@@ -1,8 +1,6 @@
require 'cape'
-module NinjaDeploy
- VERSION = File.read( "#{File.dirname __FILE__}/../VERSION" ).chomp
-end
+module NinjaDeploy; end
def NinjaDeploy( &block )
Cape( &block )
View
5 lib/ninja_deploy/version.rb
@@ -0,0 +1,5 @@
+module NinjaDeploy
+
+ VERSION = '1.4.0'
+
+end
View
89 ninja-deploy.gemspec
@@ -1,72 +1,31 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE DIRECTLY
-# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
+$:.push File.expand_path('../lib', __FILE__)
+require 'ninja_deploy/version'
Gem::Specification.new do |s|
- s.name = "ninja-deploy"
- s.version = "1.4.0"
+ s.name = 'ninja-deploy'
+ s.version = NinjaDeploy::VERSION
+ s.summary = 'Common shared deployment recipes for your pleasure.'
+ s.description = s.summary
+ s.platform = Gem::Platform::RUBY
+ s.authors = ['Jason Harrelson', 'Nils Jonsson']
+ s.email = %w(jason@lookforwardenterprises.com ninja-deploy@nilsjonsson.com)
+ s.homepage = 'http://github.com/ninja-loss/ninja-deploy'
+ s.license = 'MIT'
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["Ninja Loss"]
- s.date = "2011-09-15"
- s.description = "Common shared deployment recipes for your pleasure."
- s.email = "ninja.loss@gmail.com"
- s.extra_rdoc_files = [
- "LICENSE",
- "README.rdoc"
- ]
- s.files = [
- ".document",
- "Gemfile",
- "LICENSE",
- "README.rdoc",
- "Rakefile",
- "VERSION",
- "lib/ninja_deploy.rb",
- "lib/ninja_deploy/recipes/database.rb",
- "lib/ninja_deploy/recipes/deploy.rb",
- "lib/ninja_deploy/recipes/log.rb",
- "lib/ninja_deploy/recipes/passenger.rb",
- "lib/ninja_deploy/recipes/rvm.rb",
- "lib/ninja_deploy/recipes/thinking_sphinx.rb",
- "lib/ninja_deploy/recipes/version.rb",
- "lib/ninja_deploy/recipes/whenever.rb",
- "ninja-deploy.gemspec",
- "spec/ninja-deploy_spec.rb",
- "spec/spec.opts",
- "spec/spec_helper.rb"
- ]
- s.homepage = "http://github.com/ninja-loss/ninja-deploy"
- s.require_paths = ["lib"]
- s.rubygems_version = "1.8.10"
- s.summary = "Common shared deployment recipes."
+ # TODO: Claim the RubyForge project
+ # s.rubyforge_project = 'ninja-deploy'
- if s.respond_to? :specification_version then
- s.specification_version = 3
+ 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 do |f|
+ File.basename f
+ end
+ s.require_paths = %w(lib)
+ s.has_rdoc = true
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<cape>, ["~> 1"])
- s.add_development_dependency(%q<gem-dandy>, [">= 0"])
- s.add_development_dependency(%q<jeweler>, [">= 0"])
- s.add_development_dependency(%q<rspec>, ["= 1.3.2"])
- s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
- s.add_development_dependency(%q<yard>, [">= 0"])
- else
- s.add_dependency(%q<cape>, ["~> 1"])
- s.add_dependency(%q<gem-dandy>, [">= 0"])
- s.add_dependency(%q<jeweler>, [">= 0"])
- s.add_dependency(%q<rspec>, ["= 1.3.2"])
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
- s.add_dependency(%q<yard>, [">= 0"])
- end
- else
- s.add_dependency(%q<cape>, ["~> 1"])
- s.add_dependency(%q<gem-dandy>, [">= 0"])
- s.add_dependency(%q<jeweler>, [">= 0"])
- s.add_dependency(%q<rspec>, ["= 1.3.2"])
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
- s.add_dependency(%q<yard>, [">= 0"])
- end
-end
+ s.add_runtime_dependency 'cape', '~> 1'
+ s.add_development_dependency 'rake', '~> 0'
+ s.add_development_dependency 'rspec', '~> 2'
+end
View
7 spec/ninja-deploy_spec.rb
@@ -1,7 +0,0 @@
-require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
-
-describe "NinjaDeploy" do
- it "fails" do
- fail "hey buddy, you should probably rename this file and start specing for real"
- end
-end
View
5 spec/ninja_deploy/version_spec.rb
@@ -0,0 +1,5 @@
+require 'ninja_deploy/version'
+
+describe NinjaDeploy::VERSION do
+ it { should =~ /^\d+\.\d+\.\d+/ }
+end
View
16 spec/ninja_deploy_spec.rb
@@ -0,0 +1,16 @@
+require 'ninja_deploy'
+
+describe '#NinjaDeploy' do
+ it 'should yield the Cape module if given a unary block' do
+ yielded = nil
+ NinjaDeploy do |object|
+ yielded = object
+ end
+ yielded.name.should == 'Cape'
+ end
+
+ it 'should accept a nullary block' do
+ NinjaDeploy do
+ end
+ end
+end
View
1 spec/spec.opts
@@ -1 +0,0 @@
---color
View
9 spec/spec_helper.rb
@@ -1,9 +0,0 @@
-$LOAD_PATH.unshift(File.dirname(__FILE__))
-$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
-require 'ninja-deploy'
-require 'spec'
-require 'spec/autorun'
-
-Spec::Runner.configure do |config|
-
-end

0 comments on commit abb300f

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