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.
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 52 53 54 55 56 |
# File 'lib/rake/release/spec.rb', line 25 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.
17 18 19 |
# File 'lib/rake/release/spec.rb', line 17 def gemspec @gemspec end |
#gemspec_path ⇒ Object (readonly)
Returns the value of attribute gemspec_path.
18 19 20 |
# File 'lib/rake/release/spec.rb', line 18 def gemspec_path @gemspec_path end |
#namespace ⇒ Object
Returns the value of attribute namespace.
22 23 24 |
# File 'lib/rake/release/spec.rb', line 22 def namespace @namespace end |
#push_host ⇒ Object Also known as: host
Returns the value of attribute push_host.
19 20 21 |
# File 'lib/rake/release/spec.rb', line 19 def push_host @push_host end |
#sign_tag ⇒ Object
Returns the value of attribute sign_tag.
21 22 23 |
# File 'lib/rake/release/spec.rb', line 21 def sign_tag @sign_tag end |
#version_tag ⇒ Object
Returns the value of attribute version_tag.
23 24 25 |
# File 'lib/rake/release/spec.rb', line 23 def version_tag @version_tag end |
Class Method Details
.load(*args, &block) ⇒ Object
82 83 84 85 86 |
# File 'lib/rake/release/spec.rb', line 82 def load(*args, &block) new(*args, &block) rescue RuntimeError nil end |
.scan(path = Task.pwd.join('*.gemspec')) ⇒ Object
88 89 90 91 92 93 |
# File 'lib/rake/release/spec.rb', line 88 def scan(path = Task.pwd.join('*.gemspec')) Pathname .glob(path) .map {|m| Rake::Release::Spec.load(m) } .reject(&:nil?) end |
Instance Method Details
#pkg_file_name ⇒ Object
73 74 75 |
# File 'lib/rake/release/spec.rb', line 73 def pkg_file_name @pkg_file_name ||= "#{name}-#{version}.gem" end |
#pkg_file_path ⇒ Object
77 78 79 |
# File 'lib/rake/release/spec.rb', line 77 def pkg_file_path @pkg_file_path ||= pkg_path.join pkg_file_name end |
#pkg_path ⇒ Object
69 70 71 |
# File 'lib/rake/release/spec.rb', line 69 def pkg_path @pkg_path ||= base.join 'pkg' end |
#push_host_name ⇒ Object
65 66 67 |
# File 'lib/rake/release/spec.rb', line 65 def push_host_name push_host.host.to_s end |