Class: Toys::Templates::GemBuild
- Inherits:
-
Object
- Object
- Toys::Templates::GemBuild
- Includes:
- 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
-
#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) ⇒ GemBuild
constructor
Create the template settings for the GemBuild 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) ⇒ GemBuild
Create the template settings for the GemBuild template.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/toys/templates/gem_build.rb', line 53 def initialize(name: nil, gem_name: nil, output: nil, output_flags: nil, push_gem: false, install_gem: false, tag: false, push_tag: false) @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 end |
Instance Attribute Details
#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.
86 87 88 |
# File 'lib/toys/templates/gem_build.rb', line 86 def gem_name=(value) @gem_name = value end |
#install_gem=(value) ⇒ Boolean
Whether the tool should install the built gen locally.
120 121 122 |
# File 'lib/toys/templates/gem_build.rb', line 120 def install_gem=(value) @install_gem = value end |
#name=(value) ⇒ String
Name of the tool to create.
77 78 79 |
# File 'lib/toys/templates/gem_build.rb', line 77 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.
95 96 97 |
# File 'lib/toys/templates/gem_build.rb', line 95 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.
104 105 106 |
# File 'lib/toys/templates/gem_build.rb', line 104 def output_flags=(value) @output_flags = value end |
#push_gem=(value) ⇒ Boolean
Whether the tool should push the gem to Rubygems.
112 113 114 |
# File 'lib/toys/templates/gem_build.rb', line 112 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.
138 139 140 |
# File 'lib/toys/templates/gem_build.rb', line 138 def push_tag=(value) @push_tag = value end |
#tag=(value) ⇒ Boolean
Whether to tag the git repo with the gem version.
128 129 130 |
# File 'lib/toys/templates/gem_build.rb', line 128 def tag=(value) @tag = value end |