Class: Bundler::Thankyou::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/bundler/thankyou/cli.rb

Constant Summary collapse

MINIMUM_AMOUNT =

minimum amount in sats for each recipient

100
CONFIG_FILE =
File.join(ENV['HOME'], '.bundle-thankyou.yml')

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



13
14
15
# File 'lib/bundler/thankyou/cli.rb', line 13

def amount
  @amount
end

#recipientsObject

Returns the value of attribute recipients.



13
14
15
# File 'lib/bundler/thankyou/cli.rb', line 13

def recipients
  @recipients
end

Instance Method Details

#fund(*names) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/bundler/thankyou/cli.rb', line 33

def fund(*names)
  if names.empty?
    invoke :gemfile
  else
    self.recipients = Bundler::Thankyou.recipients_from_rubygems(names)
    disburse!
  end
end

#gemfileObject



21
22
23
24
25
26
27
# File 'lib/bundler/thankyou/cli.rb', line 21

def gemfile
  say "Analyzing Gemfile: #{Bundler.default_gemfile}"
  say '...'

  self.recipients = Bundler::Thankyou.recipients_from_bundler(options)
  disburse!
end

#setupObject



43
44
45
46
47
48
49
50
51
52
# File 'lib/bundler/thankyou/cli.rb', line 43

def setup
  say 'Connecting your LND node'
  config = {}
  config['address'] = ask('Address of your LND node (e.g. localhost:10009):')
  config['macaroon_path'] = ask('Macaroon file path: (e.g. /path/to/admin.macaroon):', path: true)
  config['credentials_path'] = ask('Credentials file path: (e.g. /path/to/tls.cert):', path: true)
  add_file(CONFIG_FILE, YAML.dump(config))
  node_info = lnd_client.lightning.get_info
  say "Successfully connected to #{node_info['alias']} #{node_info['identity_pubkey']}"
end