Sha256: 16c6662be599f2e6553697bcd0c5f69e9c276b94a430d442695a8c135c91de7f

Contents?: true

Size: 1.31 KB

Versions: 40

Compression:

Stored size: 1.31 KB

Contents

#!/usr/bin/env ruby

require 'rubygems'
require 'redcloth'
require 'syntax/convertors/html'
require 'erb'
require 'active_support'
require File.dirname(__FILE__) + '/../lib/composite_primary_keys/version.rb'

version  = CompositePrimaryKeys::VERSION::STRING
download = 'http://rubyforge.org/projects/compositekeys'

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.dirname(__FILE__) + '/../website/template.js'
else
  puts("Usage: #{File.split($0).last} source.txt [template.js] > 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 = fsrc.read
  title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip
  body = RedCloth.new(body_text)
end
stat = File.stat(src)
created = stat.ctime
modified = stat.mtime

$stdout << template.result(binding)

Version data entries

40 entries across 40 versions & 5 rubygems

Version Path
kovyrin-composite_primary_keys-2.3.2 scripts/txt2js
mingusbabcock-composite_primary_keys-2.2.2.1 scripts/txt2js
tyler-composite_primary_keys-1.1.0 scripts/txt2js
tyler-composite_primary_keys-1.1.1 scripts/txt2js
tyler-composite_primary_keys-1.1.2 scripts/txt2js
tyler-composite_primary_keys-1.1.3 scripts/txt2js
tyler-composite_primary_keys-1.1.4 scripts/txt2js
composite_primary_keys-3.0.4 scripts/txt2js
composite_primary_keys-3.0.3 scripts/txt2js
composite_primary_keys-3.0.0.b3 scripts/txt2js
composite_primary_keys-3.0.0.b2 scripts/txt2js
globe-composite_primary_keys-3.0.1 scripts/txt2js
composite_primary_keys-2.3.5.1 scripts/txt2js
composite_primary_keys-2.3.5 scripts/txt2js
composite_primary_keys-2.3.2 scripts/txt2js
composite_primary_keys-0.8.0 scripts/txt2js
composite_primary_keys-0.8.2 scripts/txt2js
composite_primary_keys-0.8.5 scripts/txt2js
composite_primary_keys-1.0.10 scripts/txt2js
composite_primary_keys-1.0.3 scripts/txt2js