literate_maruku 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/config/hoe.rb DELETED
@@ -1,70 +0,0 @@
1
- require 'literate_maruku/version'
2
-
3
- AUTHOR = 'Gregor Schmidt' # can also be an array of Authors
4
- EMAIL = "ruby@schmidtwisser.de"
5
- DESCRIPTION = "Literate programming for ruby based on maruku"
6
- GEM_NAME = 'literate_maruku' # what ppl will type to install your gem
7
- RUBYFORGE_PROJECT = 'rug-b' # The unix name for your project
8
- HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org/#{GEM_NAME}"
9
- DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
10
-
11
- @config_file = "~/.rubyforge/user-config.yml"
12
- @config = nil
13
- RUBYFORGE_USERNAME = "unknown"
14
- def rubyforge_username
15
- unless @config
16
- begin
17
- @config = YAML.load(File.read(File.expand_path(@config_file)))
18
- rescue
19
- puts <<-EOS
20
- ERROR: No rubyforge config file found: #{@config_file}
21
- Run 'rubyforge setup' to prepare your env for access to Rubyforge
22
- - See http://newgem.rubyforge.org/rubyforge.html for more details
23
- EOS
24
- exit
25
- end
26
- end
27
- RUBYFORGE_USERNAME.replace @config["username"]
28
- end
29
-
30
-
31
- REV = nil
32
- # UNCOMMENT IF REQUIRED:
33
- # REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
34
- VERS = LiterateMaruku::VERSION::STRING + (REV ? ".#{REV}" : "")
35
- RDOC_OPTS = ['--quiet', '--title', 'literate_maruku documentation',
36
- "--opname", "index.html",
37
- "--line-numbers",
38
- "--main", "README",
39
- "--inline-source"]
40
-
41
- class Hoe
42
- def extra_deps
43
- @extra_deps.reject! { |x| Array(x).first == 'hoe' }
44
- @extra_deps
45
- end
46
- end
47
-
48
- # Generate all the Rake tasks
49
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
50
- hoe = Hoe.new(GEM_NAME, VERS) do |p|
51
- p.author = AUTHOR
52
- p.description = DESCRIPTION
53
- p.email = EMAIL
54
- p.summary = DESCRIPTION
55
- p.url = HOMEPATH
56
- p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
57
- p.test_globs = ["test/**/test_*.rb"]
58
- p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
59
-
60
- # == Optional
61
- p.changes = p.paragraphs_of("History.txt", 0..1).join("\\n\\n")
62
- #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
63
-
64
- #p.spec_extras = {} # A hash of extra values to set in the gemspec.
65
-
66
- end
67
-
68
- CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
69
- PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
70
- hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
@@ -1,17 +0,0 @@
1
- require 'fileutils'
2
- include FileUtils
3
-
4
- require 'rubygems'
5
- %w[rake hoe newgem rubigen].each do |req_gem|
6
- begin
7
- require req_gem
8
- rescue LoadError
9
- puts "This Rakefile requires the '#{req_gem}' RubyGem."
10
- puts "Installation: gem install #{req_gem} -y"
11
- exit
12
- end
13
- end
14
-
15
- $:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
16
-
17
- require 'literate_maruku'
@@ -1,9 +0,0 @@
1
- module LiterateMaruku #:nodoc:
2
- module VERSION #:nodoc:
3
- MAJOR = 0
4
- MINOR = 1
5
- TINY = 1
6
-
7
- STRING = [MAJOR, MINOR, TINY].join('.')
8
- end
9
- end
data/log/debug.log DELETED
File without changes
data/script/destroy DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.join(File.dirname(__FILE__), '..')
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/destroy'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme]
14
- RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.join(File.dirname(__FILE__), '..')
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/generate'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme]
14
- RubiGen::Scripts::Generate.new.run(ARGV)
data/script/txt2html DELETED
@@ -1,74 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- begin
5
- require 'newgem'
6
- rescue LoadError
7
- puts "\n\nGenerating the website requires the newgem RubyGem"
8
- puts "Install: gem install newgem\n\n"
9
- exit(1)
10
- end
11
- require 'redcloth'
12
- require 'syntax/convertors/html'
13
- require 'erb'
14
- require File.dirname(__FILE__) + '/../lib/literate_maruku/version.rb'
15
-
16
- version = LiterateMaruku::VERSION::STRING
17
- download = 'http://rubyforge.org/projects/literate_maruku'
18
-
19
- class Fixnum
20
- def ordinal
21
- # teens
22
- return 'th' if (10..19).include?(self % 100)
23
- # others
24
- case self % 10
25
- when 1: return 'st'
26
- when 2: return 'nd'
27
- when 3: return 'rd'
28
- else return 'th'
29
- end
30
- end
31
- end
32
-
33
- class Time
34
- def pretty
35
- return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}"
36
- end
37
- end
38
-
39
- def convert_syntax(syntax, source)
40
- return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'')
41
- end
42
-
43
- if ARGV.length >= 1
44
- src, template = ARGV
45
- template ||= File.join(File.dirname(__FILE__), '/../website/template.rhtml')
46
-
47
- else
48
- puts("Usage: #{File.split($0).last} source.txt [template.rhtml] > output.html")
49
- exit!
50
- end
51
-
52
- template = ERB.new(File.open(template).read)
53
-
54
- title = nil
55
- body = nil
56
- File.open(src) do |fsrc|
57
- title_text = fsrc.readline
58
- body_text = fsrc.read
59
- syntax_items = []
60
- body_text.gsub!(%r!<(pre|code)[^>]*?syntax=['"]([^'"]+)[^>]*>(.*?)</\1>!m){
61
- ident = syntax_items.length
62
- element, syntax, source = $1, $2, $3
63
- syntax_items << "<#{element} class='syntax'>#{convert_syntax(syntax, source)}</#{element}>"
64
- "syntax-temp-#{ident}"
65
- }
66
- title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip
67
- body = RedCloth.new(body_text).to_html
68
- body.gsub!(%r!(?:<pre><code>)?syntax-temp-(\d+)(?:</code></pre>)?!){ syntax_items[$1.to_i] }
69
- end
70
- stat = File.stat(src)
71
- created = stat.ctime
72
- modified = stat.mtime
73
-
74
- $stdout << template.result(binding)