Class: Bosh::Cli::Resources::License

Inherits:
Object
  • Object
show all
Defined in:
lib/cli/resources/license.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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_baseObject (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

Parameters:

  • directory (String)

    base Release directory



4
5
6
# File 'lib/cli/resources/license.rb', line 4

def self.discover(release_base)
  [new(release_base)]
end

Instance Method Details

#additional_fingerprintsObject



40
41
42
# File 'lib/cli/resources/license.rb', line 40

def additional_fingerprints
  []
end

#dependenciesObject



44
45
46
# File 'lib/cli/resources/license.rb', line 44

def dependencies
  []
end

#filesObject



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

#nameObject



22
23
24
# File 'lib/cli/resources/license.rb', line 22

def name
  'license'
end

#plural_typeObject



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_typeObject



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