Class: LicenseFinder::ErlangmkPackage

Inherits:
Package
  • Object
show all
Defined in:
lib/license_finder/packages/erlangmk_package.rb

Instance Attribute Summary collapse

Attributes inherited from Package

#authors, #children, #description, #groups, #homepage, #install_path, #license_names_from_spec, #logger, #manual_approval, #name, #package_url, #parents, #summary, #version

Instance Method Summary collapse

Methods inherited from Package

#<=>, #activations, #approved?, #approved_manually!, #approved_manually?, #decide_on_license, #eql?, #hash, #license_files, license_names_from_standard_spec, #licenses, #licenses_from_spec, #licensing, #log_activation, #missing?, #notice_files, #permitted!, #permitted?, #restricted!, #restricted?

Constructor Details

#initialize(dep_string_from_query_deps) ⇒ ErlangmkPackage

Returns a new instance of ErlangmkPackage.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/license_finder/packages/erlangmk_package.rb', line 17

def initialize(dep_string_from_query_deps)
  @dep_parent,
  @dep_name,
  @dep_fetch_method,
  @dep_repo_unformatted,
  @dep_version_unformatted,
  @dep_absolute_path = dep_string_from_query_deps.split

  raise_invalid(dep_string_from_query_deps) unless all_parts_valid?

  super(
    dep_name,
    dep_version,
    homepage: dep_repo,
    install_path: dep_absolute_path
  )
end

Instance Attribute Details

#dep_absolute_pathObject (readonly)

Returns the value of attribute dep_absolute_path.



10
11
12
# File 'lib/license_finder/packages/erlangmk_package.rb', line 10

def dep_absolute_path
  @dep_absolute_path
end

#dep_fetch_methodObject (readonly)

Returns the value of attribute dep_fetch_method.



10
11
12
# File 'lib/license_finder/packages/erlangmk_package.rb', line 10

def dep_fetch_method
  @dep_fetch_method
end

#dep_nameObject (readonly)

Returns the value of attribute dep_name.



10
11
12
# File 'lib/license_finder/packages/erlangmk_package.rb', line 10

def dep_name
  @dep_name
end

#dep_parentObject (readonly)

Returns the value of attribute dep_parent.



10
11
12
# File 'lib/license_finder/packages/erlangmk_package.rb', line 10

def dep_parent
  @dep_parent
end

#dep_repo_unformattedObject (readonly)

Returns the value of attribute dep_repo_unformatted.



10
11
12
# File 'lib/license_finder/packages/erlangmk_package.rb', line 10

def dep_repo_unformatted
  @dep_repo_unformatted
end

#dep_version_unformattedObject (readonly)

Returns the value of attribute dep_version_unformatted.



10
11
12
# File 'lib/license_finder/packages/erlangmk_package.rb', line 10

def dep_version_unformatted
  @dep_version_unformatted
end

Instance Method Details

#all_parts_valid?Boolean

Returns:

  • (Boolean)


57
58
59
60
61
62
63
64
# File 'lib/license_finder/packages/erlangmk_package.rb', line 57

def all_parts_valid?
  dep_part_valid?(dep_parent) &&
    dep_part_valid?(dep_name) &&
    set?(dep_fetch_method) &&
    dep_repo_valid? &&
    dep_version_valid? &&
    set?(dep_absolute_path)
end

#dep_repoObject



45
46
47
48
49
# File 'lib/license_finder/packages/erlangmk_package.rb', line 45

def dep_repo
  @dep_repo ||= dep_repo_unformatted
                .chomp('.git')
                .sub('[email protected]:', 'https://github.com/')
end

#dep_versionObject



39
40
41
42
43
# File 'lib/license_finder/packages/erlangmk_package.rb', line 39

def dep_version
  @dep_version ||= begin
    dep_version_unformatted.sub(version_prefix_re, '')
  end
end

#package_managerObject



35
36
37
# File 'lib/license_finder/packages/erlangmk_package.rb', line 35

def package_manager
  'Erlangmk'
end

#raise_invalid(dep_string) ⇒ Object



51
52
53
54
55
# File 'lib/license_finder/packages/erlangmk_package.rb', line 51

def raise_invalid(dep_string)
  invalid_dep_message = "'#{dep_string}' does not look like a valid Erlank.mk dependency"
  valid_dep_example = "A valid dependency example: 'lager: goldrush git https://github.com/DeadZen/goldrush.git 0.1.9 /absolute/path/to/dep'"
  raise(InvalidErlangmkPackageError, "#{invalid_dep_message}. #{valid_dep_example}")
end