Class: Rake::Release::Spec
- Inherits:
-
Object
- Object
- Rake::Release::Spec
- Extended by:
- Forwardable
- Defined in:
- lib/rake/release/spec.rb
Constant Summary collapse
- EMPTY_STR =
''
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#gemspec ⇒ Object
readonly
Returns the value of attribute gemspec.
-
#gemspec_path ⇒ Object
readonly
Returns the value of attribute gemspec_path.
-
#namespace ⇒ Object
Returns the value of attribute namespace.
-
#push_host ⇒ Object
(also: #host)
Returns the value of attribute push_host.
-
#sign_tag ⇒ Object
Returns the value of attribute sign_tag.
-
#version_tag ⇒ Object
Returns the value of attribute version_tag.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path = nil, namespace: nil, sign_tag: false) {|_self| ... } ⇒ Spec
constructor
A new instance of Spec.
- #pkg_file_name ⇒ Object
- #pkg_file_path ⇒ Object
- #pkg_path ⇒ Object
- #push_host_name ⇒ Object
Constructor Details
#initialize(path = nil, namespace: nil, sign_tag: false) {|_self| ... } ⇒ Spec
Returns a new instance of Spec.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/rake/release/spec.rb', line 20 def initialize(path = nil, namespace: nil, sign_tag: false) path = Task.pwd.join(path.to_s). if path.directory? @base = path gemspecs = Dir[@base.join('*.gemspec')] raise 'Unable to determine gemspec file.' if gemspecs.size != 1 @gemspec_path = Pathname.new gemspecs.first else @base = path.parent @gemspec_path = path end @gemspec = Bundler.load_gemspec @gemspec_path raise 'Cannot load gemspec' unless @gemspec @push_host = URI 'https://rubygems.org' unless @gemspec.['allowed_push_host'].to_s.empty? @push_host = URI @gemspec.['allowed_push_host'] end @sign_tag = sign_tag @namespace = namespace @version_tag = "v#{version}" yield self if block_given? end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
16 17 18 |
# File 'lib/rake/release/spec.rb', line 16 def base @base end |
#gemspec ⇒ Object (readonly)
Returns the value of attribute gemspec.
16 17 18 |
# File 'lib/rake/release/spec.rb', line 16 def gemspec @gemspec end |
#gemspec_path ⇒ Object (readonly)
Returns the value of attribute gemspec_path.
16 17 18 |
# File 'lib/rake/release/spec.rb', line 16 def gemspec_path @gemspec_path end |
#namespace ⇒ Object
Returns the value of attribute namespace.
18 19 20 |
# File 'lib/rake/release/spec.rb', line 18 def namespace @namespace end |
#push_host ⇒ Object Also known as: host
Returns the value of attribute push_host.
16 17 18 |
# File 'lib/rake/release/spec.rb', line 16 def push_host @push_host end |
#sign_tag ⇒ Object
Returns the value of attribute sign_tag.
18 19 20 |
# File 'lib/rake/release/spec.rb', line 18 def sign_tag @sign_tag end |
#version_tag ⇒ Object
Returns the value of attribute version_tag.
18 19 20 |
# File 'lib/rake/release/spec.rb', line 18 def version_tag @version_tag end |
Class Method Details
.load(*args, &block) ⇒ Object
77 78 79 80 81 |
# File 'lib/rake/release/spec.rb', line 77 def load(*args, &block) new(*args, &block) rescue RuntimeError nil end |
Instance Method Details
#pkg_file_name ⇒ Object
68 69 70 |
# File 'lib/rake/release/spec.rb', line 68 def pkg_file_name @pkg_file_name ||= "#{name}-#{version}.gem" end |
#pkg_file_path ⇒ Object
72 73 74 |
# File 'lib/rake/release/spec.rb', line 72 def pkg_file_path @pkg_file_path ||= pkg_path.join pkg_file_name end |
#pkg_path ⇒ Object
64 65 66 |
# File 'lib/rake/release/spec.rb', line 64 def pkg_path @pkg_path ||= base.join 'pkg' end |
#push_host_name ⇒ Object
60 61 62 |
# File 'lib/rake/release/spec.rb', line 60 def push_host_name push_host.host.to_s end |