Class: GithubPagesRakeTasks::State
- Inherits:
-
Object
- Object
- GithubPagesRakeTasks::State
- Defined in:
- lib/github_pages_rake_tasks/state.rb
Overview
Keeps all attributes for PublishTask. These attributes control how the task works.
All attributes have sensible defaults which will cause PublishTask
to completely overwrite the project's gh-pages
branch with the contents of the project's
doc
directory.
Most used attributes are #doc_dir, #project_root, #repo_url, and #branch_name.
Instance Attribute Summary collapse
-
#branch_name ⇒ String
The branch to push documentation to.
-
#doc_dir ⇒ String
The directory relative to #project_root containing the documentation.
-
#interface ⇒ GithubPagesRakeTasks::Instance
The object that implements all methods that touch the 'outside' world.
-
#project_root ⇒ String
The absolute path to the project's root directory.
-
#quiet ⇒ Boolean
Silence all output from the
github-pages:publish
task. -
#rake_namespace ⇒ String
The Rake namespace for the
publish
task. -
#remote_name ⇒ String
The name of the Git remote to use for pushing documentation.
-
#repo_url ⇒ String
The URL to the remote repository to push documentation.
-
#staging_dir ⇒ String
The directory where the documentation is staged for pushing to the Git remote.
-
#verbose ⇒ Boolean
Make the
github-pages:publish
emit extra output.
Instance Attribute Details
#branch_name ⇒ String
The branch to push documentation to
The default value is 'gh-pages'.
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/github_pages_rake_tasks/state.rb', line 160 class State def doc_dir @doc_dir ||= 'doc' end attr_writer :doc_dir, :project_root, :repo_url, :branch_name, :staging_dir, :remote_name, :interface, :rake_namespace def project_root @project_root ||= interface.send(:`, 'git rev-parse --show-toplevel').chomp end def repo_url @repo_url ||= Dir.chdir(project_root) do |_path| interface.send(:`, "git config --get remote.#{remote_name}.url").chomp end end def branch_name @branch_name ||= 'gh-pages' end def staging_dir @staging_dir ||= interface.mktmpdir('github-pages-publish-') end def quiet return @quiet if instance_variable_defined?(:@quiet) @quiet = false end def quiet=(value) @quiet = value @verbose = false if quiet end def verbose return @verbose if instance_variable_defined?(:@verbose) @verbose = false end def verbose=(value) @verbose = value @quiet = false if verbose end def remote_name @remote_name ||= 'origin' end def interface @interface ||= Interface.new end def rake_namespace @rake_namespace ||= 'github-pages' end end |
#doc_dir ⇒ String
The directory relative to #project_root containing the documentation
The default value is 'doc'.
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/github_pages_rake_tasks/state.rb', line 160 class State def doc_dir @doc_dir ||= 'doc' end attr_writer :doc_dir, :project_root, :repo_url, :branch_name, :staging_dir, :remote_name, :interface, :rake_namespace def project_root @project_root ||= interface.send(:`, 'git rev-parse --show-toplevel').chomp end def repo_url @repo_url ||= Dir.chdir(project_root) do |_path| interface.send(:`, "git config --get remote.#{remote_name}.url").chomp end end def branch_name @branch_name ||= 'gh-pages' end def staging_dir @staging_dir ||= interface.mktmpdir('github-pages-publish-') end def quiet return @quiet if instance_variable_defined?(:@quiet) @quiet = false end def quiet=(value) @quiet = value @verbose = false if quiet end def verbose return @verbose if instance_variable_defined?(:@verbose) @verbose = false end def verbose=(value) @verbose = value @quiet = false if verbose end def remote_name @remote_name ||= 'origin' end def interface @interface ||= Interface.new end def rake_namespace @rake_namespace ||= 'github-pages' end end |
#interface ⇒ GithubPagesRakeTasks::Instance
#interface is used for mocking during testing of this gem and is probably not useful for users of this gem.
The object that implements all methods that touch the 'outside' world
An object that implements all methods that touch the world outside of the PublishTask class. This includes dealing with the file system, issuing shell commands, etc.
The default value is a new instance of Interface
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/github_pages_rake_tasks/state.rb', line 160 class State def doc_dir @doc_dir ||= 'doc' end attr_writer :doc_dir, :project_root, :repo_url, :branch_name, :staging_dir, :remote_name, :interface, :rake_namespace def project_root @project_root ||= interface.send(:`, 'git rev-parse --show-toplevel').chomp end def repo_url @repo_url ||= Dir.chdir(project_root) do |_path| interface.send(:`, "git config --get remote.#{remote_name}.url").chomp end end def branch_name @branch_name ||= 'gh-pages' end def staging_dir @staging_dir ||= interface.mktmpdir('github-pages-publish-') end def quiet return @quiet if instance_variable_defined?(:@quiet) @quiet = false end def quiet=(value) @quiet = value @verbose = false if quiet end def verbose return @verbose if instance_variable_defined?(:@verbose) @verbose = false end def verbose=(value) @verbose = value @quiet = false if verbose end def remote_name @remote_name ||= 'origin' end def interface @interface ||= Interface.new end def rake_namespace @rake_namespace ||= 'github-pages' end end |
#project_root ⇒ String
The absolute path to the project's root directory
#doc_dir is relative to this directory.
The default value is the value returned from git rev-parse --show-toplevel
when
run in the current working directory.
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/github_pages_rake_tasks/state.rb', line 160 class State def doc_dir @doc_dir ||= 'doc' end attr_writer :doc_dir, :project_root, :repo_url, :branch_name, :staging_dir, :remote_name, :interface, :rake_namespace def project_root @project_root ||= interface.send(:`, 'git rev-parse --show-toplevel').chomp end def repo_url @repo_url ||= Dir.chdir(project_root) do |_path| interface.send(:`, "git config --get remote.#{remote_name}.url").chomp end end def branch_name @branch_name ||= 'gh-pages' end def staging_dir @staging_dir ||= interface.mktmpdir('github-pages-publish-') end def quiet return @quiet if instance_variable_defined?(:@quiet) @quiet = false end def quiet=(value) @quiet = value @verbose = false if quiet end def verbose return @verbose if instance_variable_defined?(:@verbose) @verbose = false end def verbose=(value) @verbose = value @quiet = false if verbose end def remote_name @remote_name ||= 'origin' end def interface @interface ||= Interface.new end def rake_namespace @rake_namespace ||= 'github-pages' end end |
#quiet ⇒ Boolean
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/github_pages_rake_tasks/state.rb', line 160 class State def doc_dir @doc_dir ||= 'doc' end attr_writer :doc_dir, :project_root, :repo_url, :branch_name, :staging_dir, :remote_name, :interface, :rake_namespace def project_root @project_root ||= interface.send(:`, 'git rev-parse --show-toplevel').chomp end def repo_url @repo_url ||= Dir.chdir(project_root) do |_path| interface.send(:`, "git config --get remote.#{remote_name}.url").chomp end end def branch_name @branch_name ||= 'gh-pages' end def staging_dir @staging_dir ||= interface.mktmpdir('github-pages-publish-') end def quiet return @quiet if instance_variable_defined?(:@quiet) @quiet = false end def quiet=(value) @quiet = value @verbose = false if quiet end def verbose return @verbose if instance_variable_defined?(:@verbose) @verbose = false end def verbose=(value) @verbose = value @quiet = false if verbose end def remote_name @remote_name ||= 'origin' end def interface @interface ||= Interface.new end def rake_namespace @rake_namespace ||= 'github-pages' end end |
#rake_namespace ⇒ String
The Rake namespace for the publish
task
The default value is 'github-pages'
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/github_pages_rake_tasks/state.rb', line 160 class State def doc_dir @doc_dir ||= 'doc' end attr_writer :doc_dir, :project_root, :repo_url, :branch_name, :staging_dir, :remote_name, :interface, :rake_namespace def project_root @project_root ||= interface.send(:`, 'git rev-parse --show-toplevel').chomp end def repo_url @repo_url ||= Dir.chdir(project_root) do |_path| interface.send(:`, "git config --get remote.#{remote_name}.url").chomp end end def branch_name @branch_name ||= 'gh-pages' end def staging_dir @staging_dir ||= interface.mktmpdir('github-pages-publish-') end def quiet return @quiet if instance_variable_defined?(:@quiet) @quiet = false end def quiet=(value) @quiet = value @verbose = false if quiet end def verbose return @verbose if instance_variable_defined?(:@verbose) @verbose = false end def verbose=(value) @verbose = value @quiet = false if verbose end def remote_name @remote_name ||= 'origin' end def interface @interface ||= Interface.new end def rake_namespace @rake_namespace ||= 'github-pages' end end |
#remote_name ⇒ String
The name of the Git remote to use for pushing documentation
The default value is 'origin'
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/github_pages_rake_tasks/state.rb', line 160 class State def doc_dir @doc_dir ||= 'doc' end attr_writer :doc_dir, :project_root, :repo_url, :branch_name, :staging_dir, :remote_name, :interface, :rake_namespace def project_root @project_root ||= interface.send(:`, 'git rev-parse --show-toplevel').chomp end def repo_url @repo_url ||= Dir.chdir(project_root) do |_path| interface.send(:`, "git config --get remote.#{remote_name}.url").chomp end end def branch_name @branch_name ||= 'gh-pages' end def staging_dir @staging_dir ||= interface.mktmpdir('github-pages-publish-') end def quiet return @quiet if instance_variable_defined?(:@quiet) @quiet = false end def quiet=(value) @quiet = value @verbose = false if quiet end def verbose return @verbose if instance_variable_defined?(:@verbose) @verbose = false end def verbose=(value) @verbose = value @quiet = false if verbose end def remote_name @remote_name ||= 'origin' end def interface @interface ||= Interface.new end def rake_namespace @rake_namespace ||= 'github-pages' end end |
#repo_url ⇒ String
The URL to the remote repository to push documentation
The default value is the value returned from git config --get remote.origin.url
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/github_pages_rake_tasks/state.rb', line 160 class State def doc_dir @doc_dir ||= 'doc' end attr_writer :doc_dir, :project_root, :repo_url, :branch_name, :staging_dir, :remote_name, :interface, :rake_namespace def project_root @project_root ||= interface.send(:`, 'git rev-parse --show-toplevel').chomp end def repo_url @repo_url ||= Dir.chdir(project_root) do |_path| interface.send(:`, "git config --get remote.#{remote_name}.url").chomp end end def branch_name @branch_name ||= 'gh-pages' end def staging_dir @staging_dir ||= interface.mktmpdir('github-pages-publish-') end def quiet return @quiet if instance_variable_defined?(:@quiet) @quiet = false end def quiet=(value) @quiet = value @verbose = false if quiet end def verbose return @verbose if instance_variable_defined?(:@verbose) @verbose = false end def verbose=(value) @verbose = value @quiet = false if verbose end def remote_name @remote_name ||= 'origin' end def interface @interface ||= Interface.new end def rake_namespace @rake_namespace ||= 'github-pages' end end |
#staging_dir ⇒ String
This directory is deleted at the end of the publish task.
The directory where the documentation is staged for pushing to the Git remote
All files are copied from #doc_dir to #staging_dir where the push to the Git remote is done.
The default value is a temporary directory created with Dir.mktmpdir with the prefix 'github-pages-publish-'
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/github_pages_rake_tasks/state.rb', line 160 class State def doc_dir @doc_dir ||= 'doc' end attr_writer :doc_dir, :project_root, :repo_url, :branch_name, :staging_dir, :remote_name, :interface, :rake_namespace def project_root @project_root ||= interface.send(:`, 'git rev-parse --show-toplevel').chomp end def repo_url @repo_url ||= Dir.chdir(project_root) do |_path| interface.send(:`, "git config --get remote.#{remote_name}.url").chomp end end def branch_name @branch_name ||= 'gh-pages' end def staging_dir @staging_dir ||= interface.mktmpdir('github-pages-publish-') end def quiet return @quiet if instance_variable_defined?(:@quiet) @quiet = false end def quiet=(value) @quiet = value @verbose = false if quiet end def verbose return @verbose if instance_variable_defined?(:@verbose) @verbose = false end def verbose=(value) @verbose = value @quiet = false if verbose end def remote_name @remote_name ||= 'origin' end def interface @interface ||= Interface.new end def rake_namespace @rake_namespace ||= 'github-pages' end end |
#verbose ⇒ Boolean
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/github_pages_rake_tasks/state.rb', line 160 class State def doc_dir @doc_dir ||= 'doc' end attr_writer :doc_dir, :project_root, :repo_url, :branch_name, :staging_dir, :remote_name, :interface, :rake_namespace def project_root @project_root ||= interface.send(:`, 'git rev-parse --show-toplevel').chomp end def repo_url @repo_url ||= Dir.chdir(project_root) do |_path| interface.send(:`, "git config --get remote.#{remote_name}.url").chomp end end def branch_name @branch_name ||= 'gh-pages' end def staging_dir @staging_dir ||= interface.mktmpdir('github-pages-publish-') end def quiet return @quiet if instance_variable_defined?(:@quiet) @quiet = false end def quiet=(value) @quiet = value @verbose = false if quiet end def verbose return @verbose if instance_variable_defined?(:@verbose) @verbose = false end def verbose=(value) @verbose = value @quiet = false if verbose end def remote_name @remote_name ||= 'origin' end def interface @interface ||= Interface.new end def rake_namespace @rake_namespace ||= 'github-pages' end end |