Class: Bosh::Cli::Resources::License
- Defined in:
- lib/cli/resources/license.rb
Instance Attribute Summary collapse
-
#release_base ⇒ Object
readonly
Returns the value of attribute release_base.
Class Method Summary collapse
Instance Method Summary collapse
- #additional_fingerprints ⇒ Object
- #dependencies ⇒ Object
- #files ⇒ Object
- #format_fingerprint(digest, filename, name, file_mode) ⇒ Object
-
#initialize(release_base) ⇒ License
constructor
A new instance of License.
- #name ⇒ Object
- #plural_type ⇒ Object
- #run_script(script_name, *args) ⇒ Object
- #singular_type ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(release_base) ⇒ License
Returns a new instance of License.
10 11 12 |
# File 'lib/cli/resources/license.rb', line 10 def initialize(release_base) @release_base = Pathname.new(release_base) end |
Instance Attribute Details
#release_base ⇒ Object (readonly)
Returns the value of attribute release_base.
8 9 10 |
# File 'lib/cli/resources/license.rb', line 8 def release_base @release_base end |
Class Method Details
.discover(release_base) ⇒ Object
4 5 6 |
# File 'lib/cli/resources/license.rb', line 4 def self.discover(release_base) [new(release_base)] end |
Instance Method Details
#additional_fingerprints ⇒ Object
40 41 42 |
# File 'lib/cli/resources/license.rb', line 40 def additional_fingerprints [] end |
#dependencies ⇒ Object
44 45 46 |
# File 'lib/cli/resources/license.rb', line 44 def dependencies [] end |
#files ⇒ Object
26 27 28 |
# File 'lib/cli/resources/license.rb', line 26 def files Dir[File.join(release_base, "{LICENSE,NOTICE}{,.*}")].map { |entry| [entry, File.basename(entry)] } end |
#format_fingerprint(digest, filename, name, file_mode) ⇒ Object
36 37 38 |
# File 'lib/cli/resources/license.rb', line 36 def format_fingerprint(digest, filename, name, file_mode) "%s%s" % [File.basename(filename), digest] end |
#name ⇒ Object
22 23 24 |
# File 'lib/cli/resources/license.rb', line 22 def name 'license' end |
#plural_type ⇒ Object
18 19 20 |
# File 'lib/cli/resources/license.rb', line 18 def plural_type '' end |
#run_script(script_name, *args) ⇒ Object
48 49 50 |
# File 'lib/cli/resources/license.rb', line 48 def run_script(script_name, *args) # no-op end |
#singular_type ⇒ Object
14 15 16 |
# File 'lib/cli/resources/license.rb', line 14 def singular_type 'license' end |
#validate! ⇒ Object
30 31 32 33 34 |
# File 'lib/cli/resources/license.rb', line 30 def validate! if files.empty? raise Bosh::Cli::MissingLicense, "Missing LICENSE or NOTICE in #{release_base.to_s}" end end |