hanna 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,38 @@
1
+ require 'hanna/template_helpers'
2
+
3
+ RDoc::TemplatePage.class_eval do
4
+
5
+ include Hanna::TemplateHelpers
6
+
7
+ # overwrite the original method
8
+ alias :old_write_html_on :write_html_on # suppresses the overwrite warning
9
+ def write_html_on(io, values)
10
+ result = @templates.reverse.inject(nil) do |previous, template|
11
+ case template
12
+ when Haml::Engine
13
+ silence_warnings do
14
+ template.to_html(binding, :values => values) { previous }
15
+ end
16
+ when Sass::Engine
17
+ silence_warnings { template.to_css }
18
+ when String
19
+ ERB.new(template).result(get_binding(values){ previous })
20
+ when nil
21
+ previous
22
+ else
23
+ raise "don't know how to handle a template of class '#{template.class.name}'"
24
+ end
25
+ end
26
+
27
+ io.write result
28
+ rescue
29
+ $stderr.puts "error while writing to #{io.inspect}"
30
+ raise
31
+ end
32
+
33
+ private
34
+
35
+ def get_binding(values = nil)
36
+ binding
37
+ end
38
+ end
@@ -0,0 +1,19 @@
1
+ module Hanna
2
+
3
+ VERSION = '0.1.12'
4
+
5
+ # The version of RDoc that Hanna should use
6
+ RDOC_VERSION = '2.3.0'
7
+ RDOC_VERSION_REQUIREMENT = "~> #{RDOC_VERSION}"
8
+
9
+ # Load the correct version of RDoc
10
+ def self.require_rdoc(terminate = true)
11
+ begin
12
+ gem 'rdoc', RDOC_VERSION_REQUIREMENT
13
+ rescue Gem::LoadError
14
+ $stderr.puts "Hanna requires the RDoc #{RDOC_VERSION} gem"
15
+ exit 1 if terminate
16
+ end
17
+ end
18
+
19
+ end
@@ -0,0 +1,28 @@
1
+ unless defined?(::Hanna) or defined?(::RDoc)
2
+ require 'rubygems/doc_manager'
3
+ require 'rubygems/requirement'
4
+
5
+ # define the Hanna namespace to prevent actions of rubygems_plugin from older versions
6
+ module ::Hanna; end
7
+
8
+ class << Gem::DocManager
9
+ alias load_rdoc_without_version_constraint load_rdoc
10
+
11
+ # overwrite load_rdoc to load the exact version of RDoc that Hanna works with
12
+ def load_rdoc
13
+ unless defined? ::Hanna::VERSION
14
+ load File.expand_path(File.join(File.dirname(__FILE__), 'hanna', 'version.rb'))
15
+ end
16
+
17
+ Hanna::require_rdoc(false) # don't terminate if failed
18
+
19
+ # call the original method
20
+ load_rdoc_without_version_constraint
21
+ requirement = Gem::Requirement.create Hanna::RDOC_VERSION_REQUIREMENT
22
+
23
+ unless requirement.satisfied_by? rdoc_version
24
+ raise Gem::DocumentError, "ERROR: RDoc version #{requirement} not installed"
25
+ end
26
+ end
27
+ end
28
+ end
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hanna
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.12
5
+ platform: ruby
6
+ authors:
7
+ - "Mislav Marohni\xC4\x87"
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-10-16 00:00:00 +02:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rdoc
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: 2.3.0
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: haml
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 2.2.8
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: rake
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 0.8.2
44
+ version:
45
+ description: Hanna is an RDoc implemented in Haml, making its source clean and maintainable. It's built with simplicity, beauty and ease of browsing in mind.
46
+ email: mislav.marohnic@gmail.com
47
+ executables:
48
+ - hanna
49
+ extensions: []
50
+
51
+ extra_rdoc_files: []
52
+
53
+ files:
54
+ - Rakefile
55
+ - bin/hanna
56
+ - lib/hanna/hanna.rb
57
+ - lib/hanna/rdoctask.rb
58
+ - lib/hanna/template_files/class_index.haml
59
+ - lib/hanna/template_files/file_index.haml
60
+ - lib/hanna/template_files/index.haml
61
+ - lib/hanna/template_files/layout.haml
62
+ - lib/hanna/template_files/method_index.haml
63
+ - lib/hanna/template_files/method_list.haml
64
+ - lib/hanna/template_files/method_search.js
65
+ - lib/hanna/template_files/page.haml
66
+ - lib/hanna/template_files/prototype-1.6.0.3.js
67
+ - lib/hanna/template_files/sections.haml
68
+ - lib/hanna/template_files/styles.sass
69
+ - lib/hanna/template_helpers.rb
70
+ - lib/hanna/template_page_patch.rb
71
+ - lib/hanna/version.rb
72
+ - lib/hanna.rb
73
+ - lib/rubygems_plugin.rb
74
+ - README.markdown
75
+ has_rdoc: true
76
+ homepage: http://github.com/mislav/hanna
77
+ licenses: []
78
+
79
+ post_install_message:
80
+ rdoc_options: []
81
+
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: "0"
89
+ version:
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: "0"
95
+ version:
96
+ requirements: []
97
+
98
+ rubyforge_project:
99
+ rubygems_version: 1.3.5
100
+ signing_key:
101
+ specification_version: 3
102
+ summary: An RDoc template that scales
103
+ test_files: []
104
+