Class: Toys::Templates::GemBuild
- Inherits:
-
Object
- Object
- Toys::Templates::GemBuild
- Includes:
- Toys::Template
- Defined in:
- lib/toys/templates/gem_build.rb
Overview
A template for tools that build, install, and release gems
Constant Summary collapse
- DEFAULT_TOOL_NAME =
Default tool name.
"build"
- DEFAULT_OUTPUT_FLAGS =
Default output flags. If
output_flags
is set totrue
, this is the value used. ["-o", "--output"].freeze
- DEFAULT_PUSH_REMOTE =
Default remote for pushing tags.
"origin"
Instance Attribute Summary collapse
-
#context_directory ⇒ String
writeonly
Custom context directory for this tool.
-
#gem_name ⇒ String?
writeonly
Name of the gem to build.
-
#install_gem ⇒ Boolean
writeonly
Whether the tool should install the built gen locally.
-
#name ⇒ String
writeonly
Name of the tool to create.
-
#output ⇒ String?
writeonly
Path to the gem package to generate.
-
#output_flags ⇒ Array<String>, ...
writeonly
Flags that set the output path on the generated tool.
-
#push_gem ⇒ Boolean
writeonly
Whether the tool should push the gem to Rubygems.
-
#push_tag ⇒ Boolean, String
writeonly
Whether to push the new tag to a git remote.
-
#tag ⇒ Boolean
writeonly
Whether to tag the git repo with the gem version.
Instance Method Summary collapse
-
#initialize(name: nil, gem_name: nil, output: nil, output_flags: nil, push_gem: false, install_gem: false, tag: false, push_tag: false, context_directory: nil) ⇒ GemBuild
constructor
Create the template settings for the GemBuild template.
Methods included from Toys::Template
Constructor Details
#initialize(name: nil, gem_name: nil, output: nil, output_flags: nil, push_gem: false, install_gem: false, tag: false, push_tag: false, context_directory: nil) ⇒ GemBuild
Create the template settings for the GemBuild template.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/toys/templates/gem_build.rb', line 55 def initialize(name: nil, gem_name: nil, output: nil, output_flags: nil, push_gem: false, install_gem: false, tag: false, push_tag: false, context_directory: nil) @name = name @gem_name = gem_name @output = output @output_flags = output_flags @push_gem = push_gem @install_gem = install_gem @tag = tag @push_tag = push_tag @context_directory = context_directory end |
Instance Attribute Details
#context_directory=(value) ⇒ String
Custom context directory for this tool.
150 151 152 |
# File 'lib/toys/templates/gem_build.rb', line 150 def context_directory=(value) @context_directory = value end |
#gem_name=(value) ⇒ String?
Name of the gem to build. If nil
, searches the context and current
directories and uses the first gemspec file it finds.
90 91 92 |
# File 'lib/toys/templates/gem_build.rb', line 90 def gem_name=(value) @gem_name = value end |
#install_gem=(value) ⇒ Boolean
Whether the tool should install the built gen locally.
124 125 126 |
# File 'lib/toys/templates/gem_build.rb', line 124 def install_gem=(value) @install_gem = value end |
#name=(value) ⇒ String
Name of the tool to create.
81 82 83 |
# File 'lib/toys/templates/gem_build.rb', line 81 def name=(value) @name = value end |
#output=(value) ⇒ String?
Path to the gem package to generate. If nil
, defaults to a file name
based on the gem name and version, under "pkg" in the current directory.
99 100 101 |
# File 'lib/toys/templates/gem_build.rb', line 99 def output=(value) @output = value end |
#output_flags=(value) ⇒ Array<String>, ...
Flags that set the output path on the generated tool. If nil
, no
flags are generated. If set to true
, DEFAULT_OUTPUT_FLAGS is used.
108 109 110 |
# File 'lib/toys/templates/gem_build.rb', line 108 def output_flags=(value) @output_flags = value end |
#push_gem=(value) ⇒ Boolean
Whether the tool should push the gem to Rubygems.
116 117 118 |
# File 'lib/toys/templates/gem_build.rb', line 116 def push_gem=(value) @push_gem = value end |
#push_tag=(value) ⇒ Boolean, String
Whether to push the new tag to a git remote. This may be set to the
name of the remote as a string, to true
to use DEFAULT_PUSH_REMOTE
by default, or to false
to disable pushing.
142 143 144 |
# File 'lib/toys/templates/gem_build.rb', line 142 def push_tag=(value) @push_tag = value end |
#tag=(value) ⇒ Boolean
Whether to tag the git repo with the gem version.
132 133 134 |
# File 'lib/toys/templates/gem_build.rb', line 132 def tag=(value) @tag = value end |