Skip to content
Browse files

add basic COPYING, gemspec, and Rakefile

  • Loading branch information...
1 parent 4897926 commit 4cfed8a93b82e5d2cecec052fa27f92e06708147 @rtomayko rtomayko committed Nov 4, 2009
Showing with 134 additions and 0 deletions.
  1. +21 −0 COPYING
  2. +73 −0 Rakefile
  3. +1 −0 lib/ron.rb
  4. +39 −0 ron.gemspec
View
21 COPYING
@@ -0,0 +1,21 @@
+ Copyright (C) 2009 Ryan Tomayko <tomayko.com/about>
+
+Permission is hereby granted, free of charge, to any person ob-
+taining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restric-
+tion, including without limitation the rights to use, copy, modi-
+fy, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is fur-
+nished 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 NONIN-
+FRINGEMENT. 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
73 Rakefile
@@ -0,0 +1,73 @@
+require 'rake/clean'
+require 'rake/testtask'
+
+task :default => :test
+task :spec => :test
+
+# SPECS ===============================================================
+
+Rake::TestTask.new(:test) do |t|
+ t.test_files = FileList['test/*_test.rb']
+ t.ruby_opts = ['-rubygems'] if defined? Gem
+end
+
+# PACKAGING ============================================================
+
+require 'rubygems/specification'
+$spec = eval(File.read('ron.gemspec'))
+
+def package(ext='')
+ "pkg/ron-#{$spec.version}" + ext
+end
+
+desc 'Build packages'
+task :package => %w[.gem .tar.gz].map { |ext| package(ext) }
+
+desc 'Build and install as local gem'
+task :install => package('.gem') do
+ sh "gem install #{package('.gem')}"
+end
+
+directory 'pkg/'
+CLOBBER.include('pkg')
+
+file package('.gem') => %w[pkg/ ron.gemspec] + $spec.files do |f|
+ sh "gem build ron.gemspec"
+ mv File.basename(f.name), f.name
+end
+
+file package('.tar.gz') => %w[pkg/] + $spec.files do |f|
+ sh <<-SH
+ git archive --prefix=ron-#{source_version}/ --format=tar HEAD |
+ gzip > #{f.name}
+ SH
+end
+
+# Gemspec Helpers ====================================================
+
+def source_version
+ line = File.read('lib/ron.rb')[/^\s*VERSION = .*/]
+ line.match(/.*VERSION = '(.*)'/)[1]
+end
+
+task 'ron.gemspec' => FileList['{lib,test}/**','Rakefile'] do |f|
+ # read spec file and split out manifest section
+ spec = File.read(f.name)
+ head, manifest, tail = spec.split(" # = MANIFEST =\n")
+ # replace version and date
+ head.sub!(/\.version = '.*'/, ".version = '#{source_version}'")
+ head.sub!(/\.date = '.*'/, ".date = '#{Date.today.to_s}'")
+ # determine file list from git ls-files
+ files = `git ls-files`.
+ split("\n").
+ sort.
+ reject{ |file| file =~ /^\./ }.
+ reject { |file| file =~ /^doc/ }.
+ map{ |file| " #{file}" }.
+ join("\n")
+ # piece file back together and write...
+ manifest = " s.files = %w[\n#{files}\n ]\n"
+ spec = [head,manifest,tail].join(" # = MANIFEST =\n")
+ File.open(f.name, 'w') { |io| io.write(spec) }
+ puts "updated #{f.name}"
+end
View
1 lib/ron.rb
@@ -3,6 +3,7 @@
require 'nokogiri'
class Ron
+ VERSION = '0.1'
attr_reader :filename, :data, :basename, :name, :section, :tagline
def initialize(filename, &block)
View
39 ron.gemspec
@@ -0,0 +1,39 @@
+Gem::Specification.new do |s|
+ s.specification_version = 2 if s.respond_to? :specification_version=
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+
+ s.name = 'ron'
+ s.version = '0.1'
+ s.date = '2009-11-04'
+
+ s.description = "The opposite of roff"
+ s.summary = "The opposite of roff"
+
+ s.authors = ["Ryan Tomayko"]
+ s.email = "rtomayko@gmail.com"
+
+ # = MANIFEST =
+ s.files = %w[
+ COPYING
+ Rakefile
+ bin/ron
+ lib/ron.rb
+ lib/ron/layout.html
+ man/ron.1.ron
+ man/ron.5.ron
+ ron.gemspec
+ ]
+ # = MANIFEST =
+
+ s.test_files = s.files.select { |path| path =~ /^test\/.*_test.rb/ }
+
+ s.extra_rdoc_files = %w[LICENSE]
+ s.add_dependency 'nokogiri', '~> 1.4'
+ s.add_dependency 'rdiscount', '~> 1.3'
+
+ s.has_rdoc = true
+ s.homepage = "http://github.com/rtomayko/ron/"
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Ron"]
+ s.require_paths = %w[lib]
+ s.rubygems_version = '1.1.1'
+end

0 comments on commit 4cfed8a

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