Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Switch to standalone Rakefile

* update dependencies across the board.
  • Loading branch information...
commit f43e744850d6d0e248887e4949e00959ecd545b2 1 parent 34c239e
@copiousfreetime authored
View
3  HISTORY.asciidoc
@@ -2,9 +2,10 @@ Stickler Changelog
==================
Jeremy Hinegardner <jeremy@hinegardner.org>
-Version 2.3.0 - 2012-
+Version 2.3.0 - 2012-05-
--------------------------
* Expose deleting a gem via the stickler commandline (copiousfreetime/stickler/#10)
+* Update dependencies for Excon so http proxy works (copiousfreetime/stickler/#24)
Version 2.2.4 - 2012-02-26
--------------------------
View
0  Manifest.txt
No changes.
View
38 README.asciidoc → README.rdoc
@@ -1,10 +1,10 @@
-Stickler
-========
-Jeremy Hinegardner <jeremy@hinegardner.org>
+= Stickler
+* Jeremy Hinegardner <jeremy@hinegardner.org>
+* http://github.com/copiousfreetime/qup
+
+== DESCRIPTION
-Overview
---------
Stickler is a tool to organize and maintain an internal gem repository.
Primarily, you would want to use Stickler if:
@@ -15,19 +15,17 @@ Primarily, you would want to use Stickler if:
3. You want both (1) and (2) in the same server.
-Installation
-------------
+== INSTALLATION
+
Installing stickler may be done via the standard gem installation
---------------------
-gem install stickler
---------------------
+ gem install stickler
Or downloaded from http://github.com/copiousfreetime/stickler/downloads
-Usage
------
+== USAGE
+
Stickler is broken up into a few commandline programs.
.Command line programs
@@ -132,27 +130,27 @@ View which manual?
>
---------------------------------
-Development
------------
+== DEVELOPMENT
+
If you want to do development on stickler, I suggest using
https://rvm.beginrescueend.com/[RVM] and creating a gemset for stickler.
Then run 'rake how_to_contribute'
-Credits
--------
+== CREDITS
+
* http://rubyforge.org/projects/rubygems/[The Rubygems Team]
-License
--------
+== LICENSE
+
Copyright (C) 2008-2010 Jeremy Hinegardner
ISC License, See LICENSE for details
-Appendix
---------
+== APPENDIX
+
* http://github.com/copiousfreetime/stickler[Github Project]
* link:HISTORY.html[History]
* http://www.copiousfreetime.org/projects/stickler/
View
309 Rakefile
@@ -1,61 +1,280 @@
+# vim: syntax=ruby
+
+This.name = "stickler"
+This.author = "Jeremy Hinegardner"
+This.email = "jeremy@copiousfreetime.org"
+This.homepage = "http://github.com/copiousfreetime/#{ This.name }"
+This.version = Util.version
+
+#------------------------------------------------------------------------------
+# If you want to Develop on this project just run 'rake develop' and you'll
+# have all you need to get going. If you want to use bundler for development,
+# then run 'rake develop:using_bundler'
+#------------------------------------------------------------------------------
+namespace :develop do
+
+ # Install all the development and runtime dependencies of this gem using the
+ # gemspec.
+ task :default do
+ require 'rubygems/dependency_installer'
+ installer = Gem::DependencyInstaller.new
+
+ puts "Installing gem depedencies needed for development"
+ This.gemspec.dependencies.each do |dep|
+ if dep.matching_specs.empty? then
+ puts "Installing : #{dep}"
+ installer.install dep
+ else
+ puts "Skipping : #{dep} -> already installed #{dep.matching_specs.first.full_name}"
+ end
+ end
+ puts "\n\nNow run 'rake test'"
+ end
+
+ # Create a Gemfile that just references the gemspec
+ file 'Gemfile' => :gemspec do
+ File.open( "Gemfile", "w+" ) do |f|
+ f.puts 'source :rubygems'
+ f.puts 'gemspec'
+ end
+ end
+
+ desc "Create a bundler Gemfile"
+ task :using_bundler => 'Gemfile' do
+ puts "Now you can 'bundle'"
+ end
+
+ # Gemfiles are build artifacts
+ CLOBBER << FileList['Gemfile*']
+end
+desc "Boostrap development"
+task :develop => "develop:default"
+
+#------------------------------------------------------------------------------
+# RSpec - standard RSpec rake task
+#------------------------------------------------------------------------------
+begin
+ require 'rspec/core/rake_task'
+ RSpec::Core::RakeTask.new( :test ) do |t|
+ t.ruby_opts = %w[ -w ]
+ t.rspec_opts = %w[ --color --format documentation ]
+ end
+ task :default => :test
+rescue LoadError
+ Util.task_warning( 'test' )
+end
+
+#------------------------------------------------------------------------------
+# RDoc - standard rdoc rake task, although we must make sure to use a more
+# recent version of rdoc since it is the one that has 'tomdoc' markup
+#------------------------------------------------------------------------------
+begin
+ gem 'rdoc' # otherwise we get the wrong task from stdlib
+ require 'rdoc/task'
+ RDoc::Task.new do |t|
+ t.markup = 'tomdoc'
+ t.rdoc_dir = 'doc'
+ t.main = 'README.rdoc'
+ t.title = "#{This.name} #{This.version}"
+ t.rdoc_files.include( '*.rdoc', 'lib/**/*.rb' )
+ end
+rescue LoadError
+ Util.task_warning( 'rdoc' )
+end
+
+#------------------------------------------------------------------------------
+# Coverage - optional code coverage, rcov for 1.8 and simplecov for 1.9, so
+# for the moment only rcov is listed.
+#------------------------------------------------------------------------------
begin
- USING_BONES_VERSION = '3.7.3'
- require 'bones'
+ require 'rcov/rcovtask'
+ Rcov::RcovTask.new do |t|
+ t.libs << 'spec'
+ t.pattern = 'spec/**/*_spec.rb'
+ t.verbose = true
+ t.rcov_opts << "-x ^/" # remove all the global files
+ t.rcov_opts << "--sort coverage" # so we see the worst files at the top
+ end
rescue LoadError
- load 'tasks/contribute.rake'
- Rake.application.invoke_task( :help )
+ Util.task_warning( 'rcov' )
end
-task :default => 'spec:run'
-task 'gem:release' => 'spec:run'
+#------------------------------------------------------------------------------
+# Manifest - We want an explicit list of thos files that are to be packaged in
+# the gem. Most of this is from Hoe.
+#------------------------------------------------------------------------------
+namespace 'manifest' do
+ desc "Check the manifest"
+ task :check => :clean do
+ files = FileList["**/*", ".*"].exclude( This.exclude_from_manifest ).to_a.sort
+ files = files.select{ |f| File.file?( f ) }
-$: << "lib"
-require 'stickler/version'
+ tmp = "Manifest.tmp"
+ File.open( tmp, 'w' ) do |f|
+ f.puts files.join("\n")
+ end
-Bones {
- name 'stickler'
- authors 'Jeremy Hinegardner'
- email 'jeremy@hinegardner.org'
- url 'http://www.copiousfreetime.org/projects/stickler'
- version Stickler::VERSION
+ begin
+ sh "diff -du Manifest.txt #{tmp}"
+ ensure
+ rm tmp
+ end
+ puts "Manifest looks good"
+ end
- ruby_opts %w[-w -rubygems]
- readme_file 'README.asciidoc'
- ignore_file '.bnsignore'
- history_file 'HISTORY.asciidoc'
+ desc "Generate the manifest"
+ task :generate => :clean do
+ files = %x[ git ls-files ].split("\n").sort
+ files.reject! { |f| f =~ This.exclude_from_manifest }
+ File.open( "Manifest.txt", "w" ) do |f|
+ f.puts files.join("\n")
+ end
+ end
+end
- spec.opts << "--color" << "--format documentation"
+#------------------------------------------------------------------------------
+# Gem Specification
+#------------------------------------------------------------------------------
+This.gemspec = Gem::Specification.new do |spec|
+ spec.name = This.name
+ spec.version = This.version
+ spec.author = This.author
+ spec.email = This.email
+ spec.homepage = This.homepage
- summary 'Stickler is a tool to organize and maintain an internal gem repository.'
- description <<_
-Stickler is a tool to organize and maintain an internal gem repository.
-Primarily, you would want to use Stickler if:
+ spec.summary = This.summary
+ spec.description = This.description
-1. You have proprietary gems that you want to have available via a gem server so
- you may +gem install+ them.
-2. You would like to have a local mirror of third party gems from either
- http://rubygems.org or some other gem server.
-3. You want both (1) and (2) in the same server.
-_
+ spec.files = This.manifest
+ spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
+ spec.test_files = spec.files.grep(/^spec/)
- # I'm explicitly controlling the version of bones.
+ spec.extra_rdoc_files += spec.files.grep(/(txt|rdoc)$/)
+ spec.rdoc_options = [ "--main" , 'README.rdoc',
+ "--markup", "tomdoc" ]
+ spec.add_runtime_dependency( 'sinatra' , '~> 1.3.2' )
+ spec.add_runtime_dependency( 'addressable', '~> 2.2.6' )
+ spec.add_runtime_dependency( 'excon' , '~> 0.13.4' )
+ spec.add_runtime_dependency( 'trollop' , '~> 1.16.2' )
+ spec.add_runtime_dependency( 'logging' , '~> 1.6.2' )
- depend_on 'sinatra' , '~> 1.3.2'
- depend_on 'addressable', '~> 2.2.6'
- depend_on 'excon' , '~> 0.9.5'
- depend_on 'trollop' , '~> 1.16.2'
- depend_on 'logging' , '~> 1.6.2'
+ # The Development Dependencies
+ spec.add_development_dependency( 'rake' , '~> 0.9.2.2' )
+ spec.add_development_dependency( 'rack-test' , '~> 0.6.1' )
+ spec.add_development_dependency( 'builder' , '~> 3.0.0' )
+ spec.add_development_dependency( 'rspec' , '~> 2.9.0' )
+ spec.add_development_dependency( 'rdoc' , '~> 3.12' )
- depend_on 'rake' , '~> 0.9.2.2', :development => true
- depend_on 'bones' , "~> #{USING_BONES_VERSION}", :development => true
- depend_on 'rack-test' , '~> 0.6.1', :development => true
- depend_on 'bones-extras', '~> 1.3.0', :development => true
- depend_on 'builder' , '~> 3.0.0', :development => true
- depend_on 'rspec' , '~> 2.8.0', :development => true
-}
+end
-# Sorry Tim, I need to manage my own bones version
-::Bones.config.gem._spec.dependencies.delete_if do |d|
- d.name == 'bones' and d.requirement.to_s =~ /^>=/
+# The name of the gemspec file on disk
+This.gemspec_file = "#{This.name}.gemspec"
+
+# Really this is only here to support those who use bundler
+desc "Build the #{This.name}.gemspec file"
+task :gemspec do
+ File.open( This.gemspec_file, "wb+" ) do |f|
+ f.write This.gemspec.to_ruby
+ end
+end
+
+# the gemspec is also a dev artifact and should not be kept around.
+CLOBBER << This.gemspec_file
+
+# The standard gem packaging task, everyone has it.
+require 'rubygems/package_task'
+Gem::PackageTask.new( This.gemspec ) do
+ # nothing
+end
+
+#------------------------------------------------------------------------------
+# Release - the steps we go through to do a final release, this is pulled from
+# a compbination of mojombo's rakegem, hoe and hoe-git
+#
+# 1) make sure we are on the master branch
+# 2) make sure there are no uncommitted items
+# 3) check the manifest and make sure all looks good
+# 4) build the gem
+# 5) do an empty commit to have the commit message of the version
+# 6) tag that commit as the version
+# 7) push master
+# 8) push the tag
+# 7) pus the gem
+#------------------------------------------------------------------------------
+task :release_check do
+ unless `git branch` =~ /^\* master$/
+ abort "You must be on the master branch to release!"
+ end
+ unless `git status` =~ /^nothing to commit/m
+ abort "Nope, sorry, you have unfinished business"
+ end
+end
+
+desc "Create tag v#{This.version}, build and push #{This.gemspec.full_name} to rubygems.org"
+task :release => [ :release_check, 'manifest:check', :gem ] do
+ sh "git commit --allow-empty -a -m 'Release #{This.version}'"
+ sh "git tag -a -m 'v#{This.version}' v#{This.version}"
+ sh "git push origin master"
+ sh "git push origin v#{This.version}"
+ sh "gem push pkg/#{This.gemspec.full_name}.gem"
end
+
+#------------------------------------------------------------------------------
+# Rakefile Support - This is all the guts and utility methods that are
+# necessary to support the above tasks.
+#
+# Lots of Credit for this Rakefile goes to:
+#
+# Ara T. Howard - see the Rakefile in all of his projects -
+# https://github.com/ahoward/
+# Tom Preston Werner - his Rakegem project https://github.com/mojombo/rakegem
+# Seattle.rb - Hoe - cuz it has relly good stuff in there
+#------------------------------------------------------------------------------
+BEGIN {
+
+ require 'ostruct'
+ require 'rake/clean'
+ require 'rubygems' unless defined? Gem
+
+ module Util
+ def self.version
+ line = File.read( "lib/#{ This.name }.rb" )[/^\s*VERSION\s*=\s*.*/]
+ line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
+ end
+
+ # Partition an rdoc file into sections and return the text of the section
+ # as an array of paragraphs
+ def self.section_of( file, section_name )
+ re = /^=+ (.*)$/
+ parts = File.read( file ).split( re )[1..-1]
+ parts.map! { |p| p.strip }
+
+ sections = Hash.new
+ Hash[*parts].each do |k,v|
+ sections[k] = v.split("\n\n")
+ end
+ return sections[section_name]
+ end
+
+ def self.task_warning( task )
+ warn "WARNING: '#{task}' tasks are not defined. Please run 'rake develop'"
+ end
+
+ def self.read_manifest
+ abort "You need a Manifest.txt" unless File.readable?( "Manifest.txt" )
+ File.readlines( "Manifest.txt" ).map { |l| l.strip }
+ end
+ end
+
+ # Hold all the metadata about this project
+ This = OpenStruct.new
+ desc = Util.section_of( 'README.rdoc', 'DESCRIPTION')
+ This.summary = desc.first
+ This.description = desc.join(" ").tr("\n", ' ').gsub(/[{}]/,'').gsub(/\[[^\]]+\]/,'') # strip rdoc
+
+
+ This.exclude_from_manifest = %r/tmp$|\.(git|DS_Store)|^(doc|coverage|pkg)|\.gemspec$|\.swp$|\.jar|\.rvmrc$|~$/
+ This.manifest = Util.read_manifest
+
+}
View
3  lib/stickler.rb
@@ -1,4 +1,6 @@
module Stickler
+ # The Current Version of the library
+ VERSION = "2.2.4"
end
require 'stickler/error'
@@ -6,5 +8,4 @@ module Stickler
require 'stickler/repository'
require 'stickler/middleware'
require 'stickler/spec_lite'
-require 'stickler/version'
require 'stickler/server'
View
2  lib/stickler/repository/remote.rb
@@ -1,5 +1,5 @@
require 'excon'
-require 'stickler/version'
+require 'stickler'
require 'stickler/repository'
require 'stickler/repository/api'
require 'stickler/repository/rubygems_authenticator'
View
36 lib/stickler/version.rb
@@ -1,36 +0,0 @@
-#--
-# Copyright (c) 2008 Jeremy Hinegardner
-# All rights reserved. Licensed under the same terms as Ruby. No warranty is
-# provided. See LICENSE and COPYING for details.
-#++
-
-module Stickler
-
- # Version access in every possibly way that people might want to get it.
- #
- module Version
-
- MAJOR = 2
- MINOR = 2
- BUILD = 4
-
- def self.to_ary
- [ MAJOR, MINOR, BUILD ]
- end
-
- def self.to_s
- self.to_ary.join(".")
- end
-
- def self.to_hash
- { :major => MAJOR, :minor => MINOR, :build => BUILD }
- end
-
- # Version string constant
- STRING = Version.to_s
-
- end
-
- # Version string constant
- VERSION = Version.to_s
-end
Please sign in to comment.
Something went wrong with that request. Please try again.