Class: Semverve::DocsPublisher::Task
- Inherits:
-
Object
- Object
- Semverve::DocsPublisher::Task
- Includes:
- Rake::DSL
- Defined in:
- lib/semverve/docs_publisher/task.rb
Overview
Defines Rake tasks for publishing generated documentation.
Instance Attribute Summary collapse
-
#allow_dirty ⇒ Boolean
Whether dirty source working trees are allowed.
-
#branch ⇒ String
Branch that receives generated documentation.
-
#build_task ⇒ String
Rake task that builds documentation before publishing.
-
#commit_message ⇒ String
Commit message for generated documentation updates.
-
#output ⇒ #puts
Output stream for status messages.
-
#push ⇒ Boolean
Whether the publishing branch should be pushed.
-
#remote ⇒ String
Remote used when pushing the publishing branch.
-
#root ⇒ String
Source project root.
-
#source_dir ⇒ String
Directory containing generated documentation.
-
#target_dir ⇒ String
Documentation directory on the publishing branch.
-
#task_namespace ⇒ Symbol, String
Namespace for the generated tasks.
-
#worktree_path ⇒ String?
Optional path for the temporary worktree.
Instance Method Summary collapse
-
#define ⇒ void
Defines the documentation publishing tasks.
-
#initialize {|task| ... } ⇒ Semverve::DocsPublisher::Task
constructor
Initializes and defines documentation publishing tasks.
Constructor Details
#initialize {|task| ... } ⇒ Semverve::DocsPublisher::Task
Initializes and defines documentation publishing tasks.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/semverve/docs_publisher/task.rb', line 92 def initialize @root = Dir.pwd @build_task = "rerdoc" @source_dir = "docs" @target_dir = "docs" @branch = "gh-pages" @remote = "origin" @commit_message = "Update generated documentation" @worktree_path = nil @allow_dirty = false @push = true @output = $stdout @task_namespace = :docs yield self if block_given? define end |
Instance Attribute Details
#allow_dirty ⇒ Boolean
Whether dirty source working trees are allowed.
66 67 68 |
# File 'lib/semverve/docs_publisher/task.rb', line 66 def allow_dirty @allow_dirty end |
#branch ⇒ String
Branch that receives generated documentation.
42 43 44 |
# File 'lib/semverve/docs_publisher/task.rb', line 42 def branch @branch end |
#build_task ⇒ String
Rake task that builds documentation before publishing.
24 25 26 |
# File 'lib/semverve/docs_publisher/task.rb', line 24 def build_task @build_task end |
#commit_message ⇒ String
Commit message for generated documentation updates.
54 55 56 |
# File 'lib/semverve/docs_publisher/task.rb', line 54 def @commit_message end |
#output ⇒ #puts
Output stream for status messages.
78 79 80 |
# File 'lib/semverve/docs_publisher/task.rb', line 78 def output @output end |
#push ⇒ Boolean
Whether the publishing branch should be pushed.
72 73 74 |
# File 'lib/semverve/docs_publisher/task.rb', line 72 def push @push end |
#remote ⇒ String
Remote used when pushing the publishing branch.
48 49 50 |
# File 'lib/semverve/docs_publisher/task.rb', line 48 def remote @remote end |
#root ⇒ String
Source project root.
18 19 20 |
# File 'lib/semverve/docs_publisher/task.rb', line 18 def root @root end |
#source_dir ⇒ String
Directory containing generated documentation.
30 31 32 |
# File 'lib/semverve/docs_publisher/task.rb', line 30 def source_dir @source_dir end |
#target_dir ⇒ String
Documentation directory on the publishing branch.
36 37 38 |
# File 'lib/semverve/docs_publisher/task.rb', line 36 def target_dir @target_dir end |
#task_namespace ⇒ Symbol, String
Namespace for the generated tasks.
84 85 86 |
# File 'lib/semverve/docs_publisher/task.rb', line 84 def task_namespace @task_namespace end |
#worktree_path ⇒ String?
Optional path for the temporary worktree.
60 61 62 |
# File 'lib/semverve/docs_publisher/task.rb', line 60 def worktree_path @worktree_path end |
Instance Method Details
#define ⇒ void
This method returns an undefined value.
Defines the documentation publishing tasks.
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/semverve/docs_publisher/task.rb', line 115 def define namespace namespace_name do desc "Publish generated documentation to #{branch}" task :publish do publish(dry_run: false) end namespace :publish do desc "Show whether generated documentation would change #{branch}" task :dry_run do publish(dry_run: true) end end end end |