Sha256: d4ace9965c7c92068b45c48b28dc3e55711b5dd9fe18b8e9bbcc0e647f2e28fb

Contents?: true

Size: 1.01 KB

Versions: 18

Compression:

Stored size: 1.01 KB

Contents

#!/usr/bin/env ruby
require 'thor'
require 'tapyrus'
require 'daemon_spawn'

class TapyrusDaemon < DaemonSpawn::Base

  def start(args)
    puts "Tapyrusrb daemon start : #{Time.now}"
    conf = Tapyrus::Node::Configuration.new(network: args.first[:network])
    node = Tapyrus::Node::SPV.new(conf)
    node.run
  end

end

class Tapyrusrbd < Thor

  class_option :network, aliases: '-n', default: :prod

  desc 'start', 'start tapyrusrb daemon.'
  def start
    network = options['network'] ? options['network'].to_sym : :prod
    Tapyrus.chain_params = network
    FileUtils.mkdir_p(Tapyrus.base_dir)
    execute_daemon(['start', network: network])
  end

  private

  def execute_daemon(cmd_args)
    TapyrusDaemon.spawn!({working_dir: Tapyrus.base_dir,
                          log_file: "#{Tapyrus.base_dir}/log/tapyrusrbd.log",
                          pid_file: "#{Tapyrus.base_dir}/tapyrusrbd.pid",
                          sync_log: true,
                          singleton: true}, cmd_args)
  end

end

Tapyrusrbd.start(ARGV)

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
tapyrus-0.3.4 exe/tapyrusrbd
tapyrus-0.3.3 exe/tapyrusrbd
tapyrus-0.3.2 exe/tapyrusrbd
tapyrus-0.3.1 exe/tapyrusrbd
tapyrus-0.3.0 exe/tapyrusrbd
tapyrus-0.2.13 exe/tapyrusrbd
tapyrus-0.2.12 exe/tapyrusrbd
tapyrus-0.2.10 exe/tapyrusrbd
tapyrus-0.2.9 exe/tapyrusrbd
tapyrus-0.2.8 exe/tapyrusrbd
tapyrus-0.2.7 exe/tapyrusrbd
tapyrus-0.2.6 exe/tapyrusrbd
tapyrus-0.2.5 exe/tapyrusrbd
tapyrus-0.2.4 exe/tapyrusrbd
tapyrus-0.2.3 exe/tapyrusrbd
tapyrus-0.2.2 exe/tapyrusrbd
tapyrus-0.2.1 exe/tapyrusrbd
tapyrus-0.2.0 exe/tapyrusrbd