Skip to content

Commit

Permalink
Updated newgem and updated version to 0.1.5.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnunemaker committed Oct 26, 2008
1 parent c38d32b commit 4d62251
Show file tree
Hide file tree
Showing 17 changed files with 394 additions and 164 deletions.
Empty file added History.txt
Empty file.
15 changes: 15 additions & 0 deletions Manifest.txt
@@ -1,14 +1,20 @@
CHANGELOG.txt
History.txt
MIT-LICENSE
Manifest.txt
PostInstall.txt
README.txt
Rakefile
TODO.txt
bin/snitch
config/hoe.rb
config/requirements.rb
lib/snitch.rb
lib/snitch/base.rb
lib/snitch/config.rb
lib/snitch/exceptions.rb
lib/snitch/gitcommit.rb
lib/snitch/message.rb
lib/snitch/patches/hash.rb
lib/snitch/patches/tinder.rb
lib/snitch/service.rb
Expand All @@ -17,9 +23,18 @@ lib/snitch/services/email.rb
lib/snitch/services/twitter.rb
lib/snitch/svnlook.rb
lib/snitch/version.rb
script/console
script/destroy
script/generate
script/txt2html
setup.rb
tasks/deployment.rake
tasks/environment.rake
tasks/website.rake
test/snitch_config
test/test_helper.rb
test/unit/base_test.rb
test/unit/gitcommit_test.rb
test/unit/service_test.rb
test/unit/services/campfire_test.rb
test/unit/services/email_test.rb
Expand Down
Empty file added PostInstall.txt
Empty file.
82 changes: 4 additions & 78 deletions Rakefile
@@ -1,78 +1,4 @@
require 'rubygems'
require 'rake'
require 'rake/clean'
require 'rake/testtask'
require 'rake/packagetask'
require 'rake/gempackagetask'
require 'rake/rdoctask'
require 'rake/contrib/rubyforgepublisher'
require 'fileutils'
require 'hoe'
include FileUtils
require File.join(File.dirname(__FILE__), 'lib', 'snitch', 'version')

AUTHOR = "John Nunemaker" # can also be an array of Authors
EMAIL = "nunemaker@gmail.com"
DESCRIPTION = "Makes tattling on your svn commits to other services simple"
GEM_NAME = "snitch" # what ppl will type to install your gem
RUBYFORGE_PROJECT = "snitch" # The unix name for your project
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"


NAME = "snitch"
REV = nil # UNCOMMENT IF REQUIRED: File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
VERS = ENV['VERSION'] || (Snitch::VERSION::STRING + (REV ? ".#{REV}" : ""))
CLEAN.include ['**/.*.sw?', '*.gem', '.config']
RDOC_OPTS = ['--quiet', '--title', "snitch documentation",
"--opname", "index.html",
"--line-numbers",
"--main", "README",
"--inline-source"]

class Hoe
def extra_deps
@extra_deps.reject { |x| Array(x).first == 'hoe' }
end
end

# Generate all the Rake tasks
# Run 'rake -T' to see list of generated tasks (from gem root directory)
hoe = Hoe.new(GEM_NAME, VERS) do |p|
p.author = AUTHOR
p.description = DESCRIPTION
p.email = EMAIL
p.summary = DESCRIPTION
p.url = HOMEPATH
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
p.test_globs = ["test/**/*_test.rb"]
p.clean_globs = CLEAN #An array of file patterns to delete on clean.

# == Optional
#p.changes - A description of the release's latest changes.
p.extra_deps = ['twitter', 'tinder', 'activesupport', 'tmail']
#p.spec_extras - A hash of extra values to set in the gemspec.
end

desc 'Upload website files to rubyforge'
task :website do
config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml")))
host = "#{config["username"]}@rubyforge.org"
remote_dir = "/var/www/gforge-projects/#{RUBYFORGE_PROJECT}/"
# remote_dir = "/var/www/gforge-projects/#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
local_dir = 'website'
sh %{rsync -av #{local_dir}/ #{host}:#{remote_dir}}
end

desc 'Release the website and new gem version'
task :deploy => [:check_version, :website, :release]

task :check_version do
unless ENV['VERSION']
puts 'Must pass a VERSION=x.y.z release version'
exit
end
unless ENV['VERSION'] == VERS
puts "Please update your version.rb to match the release version, currently #{VERS}"
exit
end
end
require 'config/requirements'
require 'config/hoe' # setup Hoe + all gem configuration

Dir['tasks/**/*.rake'].each { |rake| load rake }
78 changes: 78 additions & 0 deletions config/hoe.rb
@@ -0,0 +1,78 @@
require 'snitch/version'

AUTHOR = 'John Nunemaker' # can also be an array of Authors
EMAIL = "nunemaker@gmail.com"
DESCRIPTION = "Drop dead easy subversion commit notifications."
GEM_NAME = 'snitch' # what ppl will type to install your gem
RUBYFORGE_PROJECT = 'snitch' # The unix name for your project
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
EXTRA_DEPENDENCIES = [
['activesupport', '>= 1.3.1'],
['mojombo-grit', '>= 0.9.0']
]
EXTRA_DEV_DEPENDENCIES = [
# ['rspec', '>= 1.1.5']
]

@config_file = "~/.rubyforge/user-config.yml"
@config = nil
RUBYFORGE_USERNAME = "jnunemaker"
def rubyforge_username
unless @config
begin
@config = YAML.load(File.read(File.expand_path(@config_file)))
rescue
puts <<-EOS
ERROR: No rubyforge config file found: #{@config_file}
Run 'rubyforge setup' to prepare your env for access to Rubyforge
- See http://newgem.rubyforge.org/rubyforge.html for more details
EOS
exit
end
end
RUBYFORGE_USERNAME.replace @config["username"]
end


REV = nil
# UNCOMMENT IF REQUIRED:
# REV = YAML.load(`svn info`)['Revision']
VERS = Snitch::VERSION::STRING + (REV ? ".#{REV}" : "")
RDOC_OPTS = ['--quiet', '--title', 'snitch documentation',
"--opname", "index.html",
"--line-numbers",
"--main", "README",
"--inline-source"]

class Hoe
def extra_deps
@extra_deps.reject! { |x| Array(x).first == 'hoe' }
@extra_deps
end
end

# Generate all the Rake tasks
# Run 'rake -T' to see list of generated tasks (from gem root directory)
$hoe = Hoe.new(GEM_NAME, VERS) do |p|
p.developer(AUTHOR, EMAIL)
p.description = DESCRIPTION
p.summary = DESCRIPTION
p.url = HOMEPATH
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
p.test_globs = ["test/**/test_*.rb"]
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.

# == Optional
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
p.extra_deps = EXTRA_DEPENDENCIES
p.extra_dev_deps = EXTRA_DEV_DEPENDENCIES

p.spec_extras = {} # A hash of extra values to set in the gemspec.
end

CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
$hoe.rsync_args = '-av --delete --ignore-errors'
$hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
15 changes: 15 additions & 0 deletions config/requirements.rb
@@ -0,0 +1,15 @@
require 'fileutils'
include FileUtils

require 'rubygems'
%w[rake hoe newgem rubigen].each do |req_gem|
begin
require req_gem
rescue LoadError
puts "This Rakefile requires the '#{req_gem}' RubyGem."
puts "Installation: gem install #{req_gem} -y"
exit
end
end

$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
2 changes: 1 addition & 1 deletion lib/snitch/version.rb
Expand Up @@ -2,7 +2,7 @@ module Snitch #:nodoc:
module VERSION #:nodoc:
MAJOR = 0
MINOR = 1
TINY = 4
TINY = 5

STRING = [MAJOR, MINOR, TINY].join('.')
end
Expand Down
10 changes: 10 additions & 0 deletions script/console
@@ -0,0 +1,10 @@
#!/usr/bin/env ruby
# File: script/console
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'

libs = " -r irb/completion"
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
libs << " -r #{File.dirname(__FILE__) + '/../lib/snitch.rb'}"
puts "Loading snitch gem"
exec "#{irb} #{libs} --simple-prompt"
14 changes: 14 additions & 0 deletions script/destroy
@@ -0,0 +1,14 @@
#!/usr/bin/env ruby
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))

begin
require 'rubigen'
rescue LoadError
require 'rubygems'
require 'rubigen'
end
require 'rubigen/scripts/destroy'

ARGV.shift if ['--help', '-h'].include?(ARGV[0])
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
RubiGen::Scripts::Destroy.new.run(ARGV)
14 changes: 14 additions & 0 deletions script/generate
@@ -0,0 +1,14 @@
#!/usr/bin/env ruby
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))

begin
require 'rubigen'
rescue LoadError
require 'rubygems'
require 'rubigen'
end
require 'rubigen/scripts/generate'

ARGV.shift if ['--help', '-h'].include?(ARGV[0])
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
RubiGen::Scripts::Generate.new.run(ARGV)
82 changes: 82 additions & 0 deletions script/txt2html
@@ -0,0 +1,82 @@
#!/usr/bin/env ruby

GEM_NAME = 'snitch' # what ppl will type to install your gem
RUBYFORGE_PROJECT = 'snitch'

require 'rubygems'
begin
require 'newgem'
require 'rubyforge'
rescue LoadError
puts "\n\nGenerating the website requires the newgem RubyGem"
puts "Install: gem install newgem\n\n"
exit(1)
end
require 'redcloth'
require 'syntax/convertors/html'
require 'erb'
require File.dirname(__FILE__) + "/../lib/#{GEM_NAME}/version.rb"

version = Snitch::VERSION::STRING
download = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"

def rubyforge_project_id
RubyForge.new.configure.autoconfig["group_ids"][RUBYFORGE_PROJECT]
end

class Fixnum
def ordinal
# teens
return 'th' if (10..19).include?(self % 100)
# others
case self % 10
when 1: return 'st'
when 2: return 'nd'
when 3: return 'rd'
else return 'th'
end
end
end

class Time
def pretty
return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}"
end
end

def convert_syntax(syntax, source)
return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'')
end

if ARGV.length >= 1
src, template = ARGV
template ||= File.join(File.dirname(__FILE__), '/../website/template.html.erb')
else
puts("Usage: #{File.split($0).last} source.txt [template.html.erb] > output.html")
exit!
end

template = ERB.new(File.open(template).read)

title = nil
body = nil
File.open(src) do |fsrc|
title_text = fsrc.readline
body_text_template = fsrc.read
body_text = ERB.new(body_text_template).result(binding)
syntax_items = []
body_text.gsub!(%r!<(pre|code)[^>]*?syntax=['"]([^'"]+)[^>]*>(.*?)</\1>!m){
ident = syntax_items.length
element, syntax, source = $1, $2, $3
syntax_items << "<#{element} class='syntax'>#{convert_syntax(syntax, source)}</#{element}>"
"syntax-temp-#{ident}"
}
title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip
body = RedCloth.new(body_text).to_html
body.gsub!(%r!(?:<pre><code>)?syntax-temp-(\d+)(?:</code></pre>)?!){ syntax_items[$1.to_i] }
end
stat = File.stat(src)
created = stat.ctime
modified = stat.mtime

$stdout << template.result(binding)
42 changes: 42 additions & 0 deletions snitch.gemspec
@@ -0,0 +1,42 @@
Gem::Specification.new do |s|
s.name = %q{snitch}
s.version = "0.1.5"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["John Nunemaker"]
s.date = %q{2008-10-25}
s.default_executable = %q{snitch}
s.description = %q{Drop dead easy subversion commit notifications.}
s.email = ["nunemaker@gmail.com"]
s.executables = ["snitch"]
s.extra_rdoc_files = ["CHANGELOG.txt", "History.txt", "Manifest.txt", "PostInstall.txt", "README.txt", "TODO.txt"]
s.files = ["CHANGELOG.txt", "History.txt", "MIT-LICENSE", "Manifest.txt", "PostInstall.txt", "README.txt", "Rakefile", "TODO.txt", "bin/snitch", "config/hoe.rb", "config/requirements.rb", "lib/snitch.rb", "lib/snitch/base.rb", "lib/snitch/config.rb", "lib/snitch/exceptions.rb", "lib/snitch/gitcommit.rb", "lib/snitch/message.rb", "lib/snitch/patches/hash.rb", "lib/snitch/patches/tinder.rb", "lib/snitch/service.rb", "lib/snitch/services/campfire.rb", "lib/snitch/services/email.rb", "lib/snitch/services/twitter.rb", "lib/snitch/svnlook.rb", "lib/snitch/version.rb", "script/console", "script/destroy", "script/generate", "script/txt2html", "setup.rb", "tasks/deployment.rake", "tasks/environment.rake", "tasks/website.rake", "test/snitch_config", "test/test_helper.rb", "test/unit/base_test.rb", "test/unit/gitcommit_test.rb", "test/unit/service_test.rb", "test/unit/services/campfire_test.rb", "test/unit/services/email_test.rb", "test/unit/services/twitter_test.rb", "test/unit/svnlook_test.rb", "website/css/common.css", "website/images/campfire.gif", "website/images/twitter.gif", "website/index.html"]
s.has_rdoc = true
s.homepage = %q{http://snitch.rubyforge.org}
s.post_install_message = %q{}
s.rdoc_options = ["--main", "README.txt"]
s.require_paths = ["lib"]
s.rubyforge_project = %q{snitch}
s.rubygems_version = %q{1.2.0}
s.summary = %q{Drop dead easy subversion commit notifications.}
s.test_files = ["test/test_helper.rb"]

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 2

if current_version >= 3 then
s.add_runtime_dependency(%q<activesupport>, [">= 1.3.1"])
s.add_runtime_dependency(%q<mojombo-grit>, [">= 0.9.0"])
s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
else
s.add_dependency(%q<activesupport>, [">= 1.3.1"])
s.add_dependency(%q<mojombo-grit>, [">= 0.9.0"])
s.add_dependency(%q<hoe>, [">= 1.8.0"])
end
else
s.add_dependency(%q<activesupport>, [">= 1.3.1"])
s.add_dependency(%q<mojombo-grit>, [">= 0.9.0"])
s.add_dependency(%q<hoe>, [">= 1.8.0"])
end
end

0 comments on commit 4d62251

Please sign in to comment.