doc_to_dash 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +11 -0
- data/doc_to_dash.gemspec +7 -0
- data/lib/doc_to_dash.rb +15 -4
- data/lib/doc_to_dash/version.rb +1 -1
- data/rakelib/docset.rake +26 -0
- data/rakelib/rdoc.rake +48 -0
- data/rakelib/rspec.rake +51 -0
- data/rakelib/settings.rake +7 -0
- data/rakelib/settings.rb +29 -0
- data/rakelib/version.rake +51 -0
- data/rakelib/version.rb +70 -0
- data/rakelib/yard.rake +113 -0
- data/spec/doc_to_dash_spec.rb +51 -0
- data/spec/spec_helper.rb +5 -0
- metadata +118 -3
data/Rakefile
CHANGED
@@ -1 +1,12 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
+
|
3
|
+
# define our project's environment by overriding the Settings defaults
|
4
|
+
require File.expand_path('rakelib/settings.rb', Rake.application.original_dir)
|
5
|
+
|
6
|
+
Settings[:app_name] = 'doc_to_dash'
|
7
|
+
Settings[:doc_dir] = 'doc'
|
8
|
+
Settings[:rdoc_output_dir] = 'doc/rdoc'
|
9
|
+
Settings[:yard_output_dir] = 'doc/ydoc'
|
10
|
+
Settings[:source_dirs] = %w{ lib }
|
11
|
+
Settings[:coverage_dirs] = %w{ lib spec }
|
12
|
+
Settings[:test_dirs] = %w{ spec }
|
data/doc_to_dash.gemspec
CHANGED
@@ -20,5 +20,12 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.add_dependency "nokogiri"
|
21
21
|
gem.add_dependency "sqlite3"
|
22
22
|
|
23
|
+
gem.add_development_dependency('versionomy')
|
24
|
+
gem.add_development_dependency('rdoc')
|
25
|
+
gem.add_development_dependency('yard')
|
26
|
+
gem.add_development_dependency('redcarpet')
|
27
|
+
gem.add_development_dependency('rspec')
|
28
|
+
gem.add_development_dependency('rake')
|
29
|
+
|
23
30
|
gem.executables << 'doc_to_dash'
|
24
31
|
end
|
data/lib/doc_to_dash.rb
CHANGED
@@ -19,6 +19,7 @@ module DocToDash
|
|
19
19
|
:doc_input_path => nil, # This is the actual docs to copy over to the Docset.
|
20
20
|
:doc_save_folder => 'docs', # This is the directory name it will store under /Contents/Resources/Documents/{this}
|
21
21
|
:verbose => true,
|
22
|
+
:index_file => nil,
|
22
23
|
:parser => DocToDash::YardParser
|
23
24
|
}.merge(options)
|
24
25
|
|
@@ -138,7 +139,10 @@ module DocToDash
|
|
138
139
|
end
|
139
140
|
|
140
141
|
def default_plist
|
141
|
-
|
142
|
+
index_filenames = [@options[:index_file], 'frames.html', 'index.html'].compact
|
143
|
+
index_file = index_filenames.select{|fn| File.exist?(File.join(@options[:doc_input_path], fn))}.first
|
144
|
+
|
145
|
+
return <<-XML
|
142
146
|
<?xml version="1.0" encoding="UTF-8"?>
|
143
147
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
144
148
|
<plist version="1.0">
|
@@ -151,11 +155,18 @@ module DocToDash
|
|
151
155
|
<string>{DOCSET_NAME}</string>
|
152
156
|
<key>isDashDocset</key>
|
153
157
|
<true/>
|
154
|
-
|
155
|
-
<string>#{@options[:doc_save_folder]}/index.html</string>
|
158
|
+
#{index_key(index_file)}
|
156
159
|
</dict>
|
157
160
|
</plist>
|
158
|
-
XML
|
161
|
+
XML
|
162
|
+
end
|
163
|
+
|
164
|
+
def index_key(index_file)
|
165
|
+
return '' if index_file.nil?
|
166
|
+
return <<-END_INDEX_KEY
|
167
|
+
<key>dashIndexFilePath</key>
|
168
|
+
<string>#{@options[:doc_save_folder]}/#{index_file.to_s}</string>
|
169
|
+
END_INDEX_KEY
|
159
170
|
end
|
160
171
|
end
|
161
172
|
end
|
data/lib/doc_to_dash/version.rb
CHANGED
data/rakelib/docset.rake
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
begin
|
3
|
+
require 'doc_to_dash'
|
4
|
+
|
5
|
+
require "doc_to_dash/parsers/rdoc_darkfish_parser" # Required because it defaults to this.
|
6
|
+
|
7
|
+
desc 'Generate a docset for Dash from rdoc'
|
8
|
+
task :rdoc_docset => [:rdoc] do
|
9
|
+
DocToDash::DocsetGenerator.new(:docset_name => "#{Settings[:app_name]} Docset",
|
10
|
+
:docset_output_path => Settings[:doc_dir],
|
11
|
+
:doc_input_path => Settings[:rdoc_output_dir],
|
12
|
+
:parser => DocToDash::RdocDarkfishParser
|
13
|
+
).run
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'Generate a docset for Dash from yard'
|
17
|
+
task :yard_docset => [:doc] do
|
18
|
+
DocToDash::DocsetGenerator.new(:docset_name => "#{Settings[:app_name]} Docset",
|
19
|
+
:docset_output_path => Settings[:doc_dir],
|
20
|
+
:doc_input_path => Settings[:yard_output_dir],
|
21
|
+
:parser => DocToDash::YardParser
|
22
|
+
).run
|
23
|
+
end
|
24
|
+
rescue LoadError
|
25
|
+
warn "doc_to_dash not available, docset tasks not provided."
|
26
|
+
end
|
data/rakelib/rdoc.rake
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# RDoc http://rdoc.rubyforge.org/
|
2
|
+
# Ruby Documentation System
|
3
|
+
|
4
|
+
# Will generate documentation from all .rb files under RDOC_SOURCE_DIRS and
|
5
|
+
# any README* files and any *.rdoc files.
|
6
|
+
# If a VERSION or version.rb file exists, will use the version found in the file in the documentation.
|
7
|
+
# Note, a VERSION file should be a file that contains just a version,
|
8
|
+
# while version.rb should contain a 'VERSION = "\d\S+"' line.
|
9
|
+
|
10
|
+
require File.expand_path('rakelib/settings.rb', Rake.application.original_dir)
|
11
|
+
# Uses these settings:
|
12
|
+
# * Settings[:app_name]
|
13
|
+
# * Settings[:source_dirs]
|
14
|
+
|
15
|
+
# Will output HTML to the ./rdoc directory
|
16
|
+
|
17
|
+
# rake clobber_rdoc # Remove RDoc HTML files
|
18
|
+
# rake rdoc # Build RDoc HTML files
|
19
|
+
# rake rerdoc # Rebuild RDoc HTML files
|
20
|
+
|
21
|
+
# add to your .gemspec:
|
22
|
+
# gem.add_development_dependency('rdoc')
|
23
|
+
# or add to your Gemfile:
|
24
|
+
# gem 'rdoc'
|
25
|
+
|
26
|
+
|
27
|
+
begin
|
28
|
+
require 'rdoc/task'
|
29
|
+
require File.expand_path('version.rb', File.dirname(__FILE__))
|
30
|
+
|
31
|
+
desc 'Remove the generated documentation'
|
32
|
+
task :clean do
|
33
|
+
puts "removing rdoc documentation"
|
34
|
+
FileUtils.rm_rf File.expand_path(Settings[:rdoc_output_dir], Rake.application.original_dir)
|
35
|
+
end
|
36
|
+
|
37
|
+
Rake::RDocTask.new do |rdoc|
|
38
|
+
rdoc.rdoc_dir = Settings[:rdoc_output_dir]
|
39
|
+
rdoc.title = "#{Settings[:app_name]} #{Version.version_get}".strip
|
40
|
+
rdoc.rdoc_files.include('README*')
|
41
|
+
rdoc.rdoc_files.include('**/*.rdoc')
|
42
|
+
rdoc.rdoc_files.include("{#{Settings[:source_dirs].join(',')}}/**/*.rb")
|
43
|
+
end
|
44
|
+
rescue LoadError
|
45
|
+
warn "rdoc not available, rdoc tasks not provided."
|
46
|
+
rescue Exception => ex
|
47
|
+
warn "#{ex.to_s}, rdoc tasks not provided."
|
48
|
+
end
|
data/rakelib/rspec.rake
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# RSpec http://rspec.info/
|
2
|
+
|
3
|
+
require File.expand_path('rakelib/settings.rb', Rake.application.original_dir)
|
4
|
+
# Uses these settings:
|
5
|
+
# * Settings[:test_dirs]
|
6
|
+
# * Settings[:coverage_output_dir]
|
7
|
+
|
8
|
+
# rake rcov # Run RSpec code examples
|
9
|
+
# rake spec # Run RSpec code examples
|
10
|
+
|
11
|
+
# for ruby < 1.9
|
12
|
+
# add to your .gemspec:
|
13
|
+
# gem.add_development_dependency('rspec')
|
14
|
+
# gem.add_development_dependency('rcov')
|
15
|
+
# or add to your Gemfile:
|
16
|
+
# gem 'rspec'
|
17
|
+
# gem 'rcov'
|
18
|
+
#
|
19
|
+
# for ruby >= 1.9
|
20
|
+
# gem.add_development_dependency('rspec')
|
21
|
+
# gem.add_development_dependency('simplecov')
|
22
|
+
# or add to your Gemfile:
|
23
|
+
# gem 'rspec'
|
24
|
+
# gem 'simplecov'
|
25
|
+
|
26
|
+
begin
|
27
|
+
require 'rspec/core'
|
28
|
+
require 'rspec/core/rake_task'
|
29
|
+
|
30
|
+
desc 'Remove the generated documentation'
|
31
|
+
task :clean do
|
32
|
+
puts "removing coverage documentation"
|
33
|
+
FileUtils.rm_rf File.expand_path(Settings[:coverage_output_dir], Rake.application.original_dir)
|
34
|
+
end
|
35
|
+
|
36
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
37
|
+
spec.rspec_opts = ["-c", "-f progress"] #, "-r ./spec/spec_helper.rb"]
|
38
|
+
spec.pattern = FileList["{#{Settings[:test_dirs].join(',')}}/**/*_spec.rb"]
|
39
|
+
end
|
40
|
+
|
41
|
+
begin
|
42
|
+
require 'rcov'
|
43
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
44
|
+
spec.pattern = FileList["{#{Settings[:test_dirs].join(',')}}/**/*_spec.rb"]
|
45
|
+
spec.rcov = true
|
46
|
+
end
|
47
|
+
rescue LoadError
|
48
|
+
end
|
49
|
+
rescue LoadError
|
50
|
+
warn "rspec not available, spec and rcov tasks not provided."
|
51
|
+
end
|
data/rakelib/settings.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
unless defined? Settings
|
2
|
+
|
3
|
+
# The Settings hash shared among the rake tasks. Keys are:
|
4
|
+
#
|
5
|
+
# * :app_name => [String] the application name
|
6
|
+
# * :source_dirs => [Array<String>] the directories that may contain source files to be documented
|
7
|
+
# * :test_dirs => [Array<String>] the directories that may contain test code that should not be documented
|
8
|
+
# * :coverage_dirs => [Array<String>] the directories used for code coverage metrics (usually source_dirs + test_dirs)
|
9
|
+
# * :yard_output_dir => [String] relative path to the directory to write yard documentation to
|
10
|
+
# * :rdoc_output_dir => [String] relative path to the directory to write rdoc documentation to
|
11
|
+
# * :doc_dir => [String] relative path to the document directory
|
12
|
+
# * :coverage_output_dir => [String] relative path to the directory to write coverage info to
|
13
|
+
# * :db_dir => [String] relative path to the directory where your database lives
|
14
|
+
# * :db_config_file => [String] relative path to the database config file
|
15
|
+
# * :db_migration_dir => [String] relative path to the directory where the database migration files belong
|
16
|
+
Settings = {
|
17
|
+
:app_name => 'Application Name',
|
18
|
+
:source_dirs => %w{ lib app controller model },
|
19
|
+
:test_dirs => %w{ features spec },
|
20
|
+
:coverage_dirs => %w{ lib app controller model spec },
|
21
|
+
:yard_output_dir => 'ydoc',
|
22
|
+
:rdoc_output_dir => 'rdoc',
|
23
|
+
:doc_dir => 'doc',
|
24
|
+
:coverage_output_dir => 'coverage',
|
25
|
+
:db_dir => 'db',
|
26
|
+
:db_config_file => 'db/config.rb',
|
27
|
+
:db_migration_dir => 'db/migrations'
|
28
|
+
}
|
29
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# Version bump tasks
|
2
|
+
#
|
3
|
+
# These tasks are for interacting with your version file. The version file may be either
|
4
|
+
# the bundler standard of version.rb (which defines a constant VERSION within a module)
|
5
|
+
# or the jeweler standard of VERSION (which contains just a version number).
|
6
|
+
|
7
|
+
# rake version:bump:patch # bump the patch version
|
8
|
+
|
9
|
+
# add to your .gemspec:
|
10
|
+
# gem.add_development_dependency('versionomy')
|
11
|
+
# or add to your Gemfile:
|
12
|
+
# gem 'versionomy'
|
13
|
+
|
14
|
+
begin
|
15
|
+
require File.expand_path('version.rb', File.dirname(__FILE__))
|
16
|
+
|
17
|
+
namespace :version do
|
18
|
+
desc 'reset version to 0.0.1'
|
19
|
+
task :reset do
|
20
|
+
puts Version.version_set '0.0.1'
|
21
|
+
end
|
22
|
+
|
23
|
+
desc 'get the current version'
|
24
|
+
task :get do
|
25
|
+
puts Version.version_get
|
26
|
+
end
|
27
|
+
|
28
|
+
namespace :bump do
|
29
|
+
desc 'bump the major version'
|
30
|
+
task :major do
|
31
|
+
old_version = Version.version_get
|
32
|
+
new_version = Version.version_bump {|version| version.bump(:major)}
|
33
|
+
puts "updated version from #{old_version} to #{new_version}"
|
34
|
+
end
|
35
|
+
desc 'bump the minor version'
|
36
|
+
task :minor do
|
37
|
+
old_version = Version.version_get
|
38
|
+
new_version = Version.version_bump {|version| version.bump(:minor)}
|
39
|
+
puts "updated version from #{old_version} to #{new_version}"
|
40
|
+
end
|
41
|
+
desc 'bump the patch version'
|
42
|
+
task :patch do
|
43
|
+
old_version = Version.version_get
|
44
|
+
new_version = Version.version_bump {|version| version.bump(:tiny)}
|
45
|
+
puts "updated version from #{old_version} to #{new_version}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
rescue LoadError => ex
|
50
|
+
warn "versionomy not available, version bump tasks not provided. #{ex.to_s}"
|
51
|
+
end
|
data/rakelib/version.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
|
2
|
+
require 'versionomy'
|
3
|
+
require File.expand_path('rakelib/settings.rb', Rake.application.original_dir)
|
4
|
+
|
5
|
+
# This module provides methods for interacting with your version file. The version
|
6
|
+
# file may be either the bundler standard of version.rb (which defines a constant VERSION within a module)
|
7
|
+
# or the jeweler standard of VERSION (which contains just a version number).
|
8
|
+
#
|
9
|
+
# Uses these settings:
|
10
|
+
#
|
11
|
+
# * Settings[:source_dirs]
|
12
|
+
module Version
|
13
|
+
# The regex for extracting the version from a version.rb file
|
14
|
+
VERSION_REGEX = /VERSION\s*=\s*[\"\']?(\d[^\"\']*)[\"\']?/m
|
15
|
+
|
16
|
+
# Get the paths to all the version.rb files
|
17
|
+
# @return [Array<String>] relative paths to version.rb files
|
18
|
+
def self.versionrb_filenames
|
19
|
+
Dir["#{Rake.application.original_dir}/{#{Settings[:source_dirs].join(',')}}/**/version.rb"]
|
20
|
+
end
|
21
|
+
|
22
|
+
# Get the paths to all the VERSION files
|
23
|
+
# @return [Array<String>] relative paths to VERSION files
|
24
|
+
def self.version_filenames
|
25
|
+
Dir["#{Rake.application.original_dir}**/VERSION"]
|
26
|
+
end
|
27
|
+
|
28
|
+
# Get the application's version from either version.rb or VERSION file
|
29
|
+
# @return [String] the version
|
30
|
+
def self.version_get
|
31
|
+
versionrb_filenames.each do |version_file|
|
32
|
+
str = IO.read(version_file)
|
33
|
+
if str =~ VERSION_REGEX
|
34
|
+
return $1
|
35
|
+
end
|
36
|
+
end
|
37
|
+
version_filenames.each do |version_file|
|
38
|
+
return IO.read(version_file).strip
|
39
|
+
end
|
40
|
+
'not found'
|
41
|
+
end
|
42
|
+
|
43
|
+
# Set the application version to the given version. Will try to set version.rb and VERSION files.
|
44
|
+
# @param [String] new_version the new version for the application
|
45
|
+
# @return [String] the application's new version
|
46
|
+
def self.version_set(new_version)
|
47
|
+
versionrb_filenames.each do |version_file|
|
48
|
+
str = IO.read(version_file)
|
49
|
+
if str =~ VERSION_REGEX
|
50
|
+
old_version = $1
|
51
|
+
File.open(version_file, 'w') {|f| f.puts str.gsub(old_version, new_version)}
|
52
|
+
end
|
53
|
+
end
|
54
|
+
version_filenames.each do |version_file|
|
55
|
+
File.open(version_file, 'w') {|f| f.puts new_version}
|
56
|
+
end
|
57
|
+
new_version
|
58
|
+
end
|
59
|
+
|
60
|
+
# Bump the application's version. The block is given the current version that it then bumps and returns.
|
61
|
+
# The returned value is then used to set the version in all the version.rb and VERSION files in the project.
|
62
|
+
# @param [Proc] block is pass the current version and returns the new version.
|
63
|
+
# @return [String] the application's new version
|
64
|
+
def self.version_bump(&block)
|
65
|
+
old_version = Versionomy.parse version_get
|
66
|
+
new_version = block.call(old_version).to_s
|
67
|
+
version_set new_version
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
data/rakelib/yard.rake
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
require File.expand_path('rakelib/settings.rb', Rake.application.original_dir)
|
2
|
+
|
3
|
+
# YARD documentation http://yardoc.org/
|
4
|
+
#
|
5
|
+
# These tasks are for using the yard documentation system.
|
6
|
+
# The source files are .rb files in the YARD_SOURCE_DIRS directories.
|
7
|
+
# The output is placed into your project's doc/app/ directory.
|
8
|
+
# Any .md.erb files are processed with ERB to create .md files before running yard.
|
9
|
+
# If you have a README.md file (maybe generated from a README.md.erb file), it is used as the documentations README
|
10
|
+
#
|
11
|
+
# rake clean # remove the generated documentation
|
12
|
+
# rake doc # generate documentation
|
13
|
+
# rake markdown_erb # convert .md.erb documentation to .md
|
14
|
+
# rake yard # Generate YARD Documentation
|
15
|
+
#
|
16
|
+
# add to your .gemspec:
|
17
|
+
# gem.add_development_dependency('yard')
|
18
|
+
# gem.add_development_dependency('redcarpet')
|
19
|
+
# or add to your Gemfile:
|
20
|
+
# gem 'yard'
|
21
|
+
# gem 'redcarpet'
|
22
|
+
#
|
23
|
+
# if you want syntax highlighting via pygments (http://pygments.org)
|
24
|
+
#
|
25
|
+
# * install pygments
|
26
|
+
# * add the following to your .gemspec
|
27
|
+
# gem.add_development_dependency('yard-pygmentsrb')
|
28
|
+
# gem.add_development_dependency('pygments.rb')
|
29
|
+
# or add to your Gemfile:
|
30
|
+
# gem 'yard-pygmentsrb'
|
31
|
+
# gem 'pygments.rb'
|
32
|
+
#
|
33
|
+
# then your markdown can include code fragments like:
|
34
|
+
# ``` ruby
|
35
|
+
# puts 'Howdy!'
|
36
|
+
# ```
|
37
|
+
#
|
38
|
+
# Uses these settings:
|
39
|
+
#
|
40
|
+
# * Settings[:app_name]
|
41
|
+
# * Settings[:source_dirs]
|
42
|
+
# * Settings[:yard_output_dir]
|
43
|
+
|
44
|
+
|
45
|
+
begin
|
46
|
+
require 'yard'
|
47
|
+
#require 'yard-cucumber'
|
48
|
+
#require 'yard-rspec' # doesn't work
|
49
|
+
#require 'yard-notes' # doesn't work
|
50
|
+
require File.expand_path('version.rb', File.dirname(__FILE__))
|
51
|
+
|
52
|
+
desc 'Remove the generated documentation'
|
53
|
+
task :clean do
|
54
|
+
puts "removing yard documentation"
|
55
|
+
FileUtils.rm_rf File.expand_path(Settings[:yard_output_dir], Rake.application.original_dir)
|
56
|
+
FileUtils.rm_rf File.expand_path('.yardoc', Rake.application.original_dir)
|
57
|
+
end
|
58
|
+
|
59
|
+
begin
|
60
|
+
require 'erb'
|
61
|
+
desc 'Convert .md.erb documentation to .md'
|
62
|
+
task :markdown_erb do
|
63
|
+
Dir['**/*.md.erb'].each do |fn|
|
64
|
+
output_file = File.expand_path(fn.gsub(/\.md\.erb$/, '.md'), File.dirname(__FILE__))
|
65
|
+
puts "processing: #{fn} to #{output_file}"
|
66
|
+
template = ERB.new IO.read(fn)
|
67
|
+
File.open(output_file, 'w') {|f| f.puts template.result(binding)}
|
68
|
+
end
|
69
|
+
end
|
70
|
+
rescue LoadError
|
71
|
+
task :markdown_erb do
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
YARD::Rake::YardocTask.new do |t|
|
76
|
+
t.files = (Dir["{#{Settings[:source_dirs].join(',')}}/**/*.rb"] +
|
77
|
+
Dir["{#{Settings[:test_dirs].join(',')}}/**/*_spec.rb"] +
|
78
|
+
Dir["{#{Settings[:test_dirs].join(',')}}/**/*.feature"] +
|
79
|
+
Dir["{#{Settings[:test_dirs].join(',')}}/**/support/**/*.rb"]).uniq
|
80
|
+
|
81
|
+
t.options = ['--title', "#{Settings[:app_name]} #{Version.version_get}".strip,
|
82
|
+
'--output-dir', Settings[:yard_output_dir],
|
83
|
+
'--protected', '--private', '--embed-mixins',
|
84
|
+
'--markup', 'markdown',
|
85
|
+
'--readme', 'README.md']
|
86
|
+
#puts "t.files => #{t.files.pretty_inspect}"
|
87
|
+
end
|
88
|
+
|
89
|
+
require 'digest/md5'
|
90
|
+
task :yard_config do
|
91
|
+
FileUtils.mkdir_p File.expand_path('~/.yard')
|
92
|
+
config_file = File.expand_path("~/.yard/config")
|
93
|
+
config = SymbolHash.new
|
94
|
+
config = YAML.load IO.read(config_file) if File.exist? config_file
|
95
|
+
config_sha1 = Digest::MD5.hexdigest(config.to_s)
|
96
|
+
config[:'yard-cucumber'] ||= {"menus"=>["features", "tags", "steps", "step definitions", "specifications"],
|
97
|
+
"language"=>{"step_definitions"=>["Given", "When", "Then", "And"]}}
|
98
|
+
config[:'load_plugins'] ||= true
|
99
|
+
config[:'ignored_plugins'] ||= []
|
100
|
+
config[:'autoload_plugins'] ||= []
|
101
|
+
config[:'safe_mode'] ||= false
|
102
|
+
unless config_sha1 == Digest::MD5.hexdigest(config.to_s)
|
103
|
+
File.open(config_file, 'w') {|f| f.puts YAML.dump(config)}
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
task :yard => [:yard_config]
|
108
|
+
|
109
|
+
desc 'Generate Documentation from .md.erb, .md, .rb'
|
110
|
+
task :doc => [:markdown_erb, :yard]
|
111
|
+
rescue LoadError
|
112
|
+
warn "yard or erb not available, yard documentation tasks not provided."
|
113
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'doc_to_dash' do
|
4
|
+
|
5
|
+
# test the default plist generation based on the presence of index.html or frames.html
|
6
|
+
describe 'default_plist' do
|
7
|
+
before :all do
|
8
|
+
FileUtils.mkdir_p 'tmp'
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should generate plist without index.html or frames.html' do
|
12
|
+
FileUtils.rm_f "tmp/index.html"
|
13
|
+
FileUtils.rm_f "tmp/frames.html"
|
14
|
+
dg = DocToDash::DocsetGenerator.new({:doc_input_path => 'tmp', :doc_save_folder => 'tmp', :index_file => nil})
|
15
|
+
plist = dg.send 'default_plist'
|
16
|
+
plist.should_not match(%r{<key>dashIndexFilePath</key>})
|
17
|
+
plist.should_not match(%r{<string>tmp/index.html</string>})
|
18
|
+
plist.should_not match(%r{<string>tmp/frames.html</string>})
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should generate plist with index.html when only index.html exists' do
|
22
|
+
FileUtils.touch "tmp/index.html"
|
23
|
+
FileUtils.rm_f "tmp/frames.html"
|
24
|
+
dg = DocToDash::DocsetGenerator.new({:doc_input_path => 'tmp', :doc_save_folder => 'tmp', :index_file => 'index.html'})
|
25
|
+
plist = dg.send 'default_plist'
|
26
|
+
plist.should match(%r{<key>dashIndexFilePath</key>})
|
27
|
+
plist.should match(%r{<string>tmp/index.html</string>})
|
28
|
+
plist.should_not match(%r{<string>tmp/frames.html</string>})
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should generate plist with frames.html when only frames.html exists' do
|
32
|
+
FileUtils.rm_f "tmp/index.html"
|
33
|
+
FileUtils.touch "tmp/frames.html"
|
34
|
+
dg = DocToDash::DocsetGenerator.new({:doc_input_path => 'tmp', :doc_save_folder => 'tmp', :index_file => 'frames.html'})
|
35
|
+
plist = dg.send 'default_plist'
|
36
|
+
plist.should match(%r{<key>dashIndexFilePath</key>})
|
37
|
+
plist.should match(%r{<string>tmp/frames.html</string>})
|
38
|
+
plist.should_not match(%r{<string>tmp/index.html</string>})
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should generate plist with frames.html when both index.html and frames.html exist' do
|
42
|
+
FileUtils.rm_f "tmp/index.html"
|
43
|
+
FileUtils.touch "tmp/frames.html"
|
44
|
+
dg = DocToDash::DocsetGenerator.new({:doc_input_path => 'tmp', :doc_save_folder => 'tmp', :index_file => 'frames.html'})
|
45
|
+
plist = dg.send 'default_plist'
|
46
|
+
plist.should match(%r{<key>dashIndexFilePath</key>})
|
47
|
+
plist.should match(%r{<string>tmp/frames.html</string>})
|
48
|
+
plist.should_not match(%r{<string>tmp/index.html</string>})
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doc_to_dash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -43,6 +43,102 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: versionomy
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rdoc
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: yard
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: redcarpet
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rspec
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: rake
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
46
142
|
description: Converts documentation to a Dash Docset
|
47
143
|
email:
|
48
144
|
- me@caleb.io
|
@@ -65,6 +161,16 @@ files:
|
|
65
161
|
- lib/doc_to_dash/parsers/yard_parser.rb
|
66
162
|
- lib/doc_to_dash/trollop.rb
|
67
163
|
- lib/doc_to_dash/version.rb
|
164
|
+
- rakelib/docset.rake
|
165
|
+
- rakelib/rdoc.rake
|
166
|
+
- rakelib/rspec.rake
|
167
|
+
- rakelib/settings.rake
|
168
|
+
- rakelib/settings.rb
|
169
|
+
- rakelib/version.rake
|
170
|
+
- rakelib/version.rb
|
171
|
+
- rakelib/yard.rake
|
172
|
+
- spec/doc_to_dash_spec.rb
|
173
|
+
- spec/spec_helper.rb
|
68
174
|
homepage: https://rubygems.org/gems/doc_to_dash
|
69
175
|
licenses: []
|
70
176
|
post_install_message:
|
@@ -77,16 +183,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
77
183
|
- - ! '>='
|
78
184
|
- !ruby/object:Gem::Version
|
79
185
|
version: '0'
|
186
|
+
segments:
|
187
|
+
- 0
|
188
|
+
hash: -3709015716933822513
|
80
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
190
|
none: false
|
82
191
|
requirements:
|
83
192
|
- - ! '>='
|
84
193
|
- !ruby/object:Gem::Version
|
85
194
|
version: '0'
|
195
|
+
segments:
|
196
|
+
- 0
|
197
|
+
hash: -3709015716933822513
|
86
198
|
requirements: []
|
87
199
|
rubyforge_project:
|
88
200
|
rubygems_version: 1.8.24
|
89
201
|
signing_key:
|
90
202
|
specification_version: 3
|
91
203
|
summary: Documentation to Dash Docset Converter
|
92
|
-
test_files:
|
204
|
+
test_files:
|
205
|
+
- spec/doc_to_dash_spec.rb
|
206
|
+
- spec/spec_helper.rb
|
207
|
+
has_rdoc:
|