voloko-sdoc 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,62 @@
1
+ require "rdoc/options"
2
+
3
+ # Add a github_url option to rdoc options
4
+ module SDoc
5
+ class Options < Options
6
+ include Singleton
7
+
8
+ attr_accessor :github_url, :github_path
9
+
10
+ def parse(argv, generators)
11
+ old_argv = ARGV.dup
12
+ begin
13
+ ARGV.replace(argv)
14
+ @github_url = nil
15
+
16
+ generator_set = false
17
+ template_set = false
18
+ @github_path = Dir.pwd
19
+
20
+ go = GetoptLong.new(*OptionList.options)
21
+ go.quiet = true
22
+
23
+ go.each do |opt, arg|
24
+ case opt
25
+ when "--github_url" then @github_url = arg
26
+ when "--fmt" then generator_set = true
27
+ when "--template" then template_set = true
28
+ end
29
+ end
30
+ ensure
31
+ ARGV.replace(old_argv)
32
+ end
33
+ super(argv, generators)
34
+
35
+ unless generator_set
36
+ @generator_name = 'shtml'
37
+ setup_generator(generators)
38
+ end
39
+
40
+ unless template_set
41
+ @template = @generator_name
42
+ end
43
+ end
44
+
45
+ def setup_generator(generators)
46
+ if @generator_name == 'shtml'
47
+ @all_one_file = false
48
+ end
49
+ super(generators)
50
+ end
51
+ end
52
+
53
+ end
54
+
55
+ Options::OptionList::OPTION_LIST << ['--github_url', '-G', 'url', 'Github url prefix like http://github.com/rails/rails']
56
+
57
+ class Options
58
+ def self.instance
59
+ SDoc::Options.instance
60
+ end
61
+ end
62
+
@@ -0,0 +1,33 @@
1
+ require "test_helper"
2
+
3
+ class OptionsTest < Test::Unit::TestCase
4
+ def test_should_add_github_url_option
5
+ o = Options.instance
6
+ o.parse(%w(--github_url http://www.github.com), RDoc::RDoc::GENERATORS)
7
+ assert_not_nil(o.github_url)
8
+ end
9
+
10
+ def test_should_set_default_generator_to_shtml
11
+ o = Options.instance
12
+ o.parse(%w(--github_url http://www.github.com), RDoc::RDoc::GENERATORS)
13
+ assert_equal('shtml', o.generator.key)
14
+ end
15
+
16
+ def test_should_set_default_template_to_shtml
17
+ o = Options.instance
18
+ o.parse(%w(--github_url http://www.github.com), RDoc::RDoc::GENERATORS)
19
+ assert_equal('shtml', o.template)
20
+ end
21
+
22
+ def test_should_set_is_all_in_one_file_to_false
23
+ o = Options.instance
24
+ o.parse(%w(--one-file), RDoc::RDoc::GENERATORS)
25
+ assert(!o.all_one_file, "Should not use all in one file")
26
+ end
27
+
28
+ def test_should_set_is_all_in_one_file_to_false_if_fmt_present
29
+ o = Options.instance
30
+ o.parse(%w(--one-file --fmt shtml), RDoc::RDoc::GENERATORS)
31
+ assert(!o.all_one_file, "Should not use all in one file")
32
+ end
33
+ end
data/test/sdoc_test.rb ADDED
@@ -0,0 +1,7 @@
1
+ require "test_helper"
2
+
3
+ class SDocTest < Test::Unit::TestCase
4
+ def test_should_add_shtml_generator_to_generators_list
5
+ assert(RDoc::RDoc::GENERATORS.has_key?('shtml'), "Should add shtml generator to list.")
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: voloko-sdoc
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Vladimir Kolesnikov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-03-21 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: json
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.1.3
24
+ version:
25
+ description:
26
+ email: voloko@gmail.com
27
+ executables:
28
+ - sdoc
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - README
33
+ files:
34
+ - lib/sdoc/code_objects.rb
35
+ - lib/sdoc/generators/shtml_generator.rb
36
+ - lib/sdoc/generators/template/shtml/resources/css/master-frameset.css
37
+ - lib/sdoc/generators/template/shtml/resources/css/reset.css
38
+ - lib/sdoc/generators/template/shtml/resources/i/arrows.png
39
+ - lib/sdoc/generators/template/shtml/resources/i/results_bg.png
40
+ - lib/sdoc/generators/template/shtml/resources/i/tree_bg.png
41
+ - lib/sdoc/generators/template/shtml/resources/js/jquery-1.3.2.min.js
42
+ - lib/sdoc/generators/template/shtml/resources/js/searchdoc.js
43
+ - lib/sdoc/generators/template/shtml/resources/panel.html
44
+ - lib/sdoc/generators/template/shtml/shtml.rb
45
+ - lib/sdoc/options.rb
46
+ - lib/sdoc.rb
47
+ - bin/sdoc
48
+ - README
49
+ has_rdoc: true
50
+ homepage: http://voloko.ru/sdoc/rails
51
+ post_install_message:
52
+ rdoc_options: []
53
+
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: "0"
61
+ version:
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: "0"
67
+ version:
68
+ requirements: []
69
+
70
+ rubyforge_project:
71
+ rubygems_version: 1.2.0
72
+ signing_key:
73
+ specification_version: 2
74
+ summary: RDoc extensions for searchable html generations
75
+ test_files:
76
+ - test/options_test.rb
77
+ - test/sdoc_test.rb