Class: MultiRepo::Helpers::License

Inherits:
Object
  • Object
show all
Defined in:
lib/multi_repo/helpers/license.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repo, dry_run: false) ⇒ License

Returns a new instance of License.



5
6
7
8
9
# File 'lib/multi_repo/helpers/license.rb', line 5

def initialize(repo, dry_run: false, **)
  @repo    = repo
  @dry_run = dry_run
  reload
end

Instance Attribute Details

#dry_runObject (readonly)

Returns the value of attribute dry_run.



3
4
5
# File 'lib/multi_repo/helpers/license.rb', line 3

def dry_run
  @dry_run
end

#repoObject (readonly)

Returns the value of attribute repo.



3
4
5
# File 'lib/multi_repo/helpers/license.rb', line 3

def repo
  @repo
end

Instance Method Details

#contentObject



18
19
20
# File 'lib/multi_repo/helpers/license.rb', line 18

def content
  @license.text
end

#licenseObject



22
23
24
# File 'lib/multi_repo/helpers/license.rb', line 22

def license
  @license.key
end

#license=(value) ⇒ Object



26
27
28
# File 'lib/multi_repo/helpers/license.rb', line 26

def license=(value)
  @license = Licensee::License.new(value)
end

#save!Object



11
12
13
14
15
16
# File 'lib/multi_repo/helpers/license.rb', line 11

def save!
  save_license!
  save_readme_license!
  reload unless dry_run
  true
end