Sha256: 633ad64c1c45d5aadf21e28c3823b3a7c01889a98316426997d90651d53ab2ba

Contents?: true

Size: 1.69 KB

Versions: 3

Compression:

Stored size: 1.69 KB

Contents

module AssLauncher
  module Cmd
    class Main
      module SubCommands
        # @api private
        class MakeIb < Abstract::SubCommand
          include Abstract::Parameter::IB_PATH_NAME
          include Abstract::Option::Dbms
          include Abstract::Option::Dbsrv
          include Abstract::Option::Esrv
          include Abstract::Option::Pattern
          include Abstract::Option::Version
          include Abstract::Option::DryRun
          include Abstract::Option::SearchPath
          include Abstract::BinaryWrapper

          def self.command_name
            'makeib'
          end

          def self._banner
            'Make new information base'
          end

          # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
          def connection_string
            return cs_file(file: ib_path) if dbms == 'File'
            cs = cs_srv(srvr: esrv_host, ref: ib_path)
            cs.dbms = dbms
            cs.dbsrvr = dbsrv_host
            cs.db = ib_path
            cs.dbuid = dbsrv_user
            cs.dbpwd = dbsrv_pass
            cs.crsqldb = 'Y'
            cs.susr = esrv_user
            cs.spwd = esrv_pass
            cs
          end
          # rubocop:enable Metrics/MethodLength, Metrics/AbcSize

          def make_command
            cs = connection_string
            template = pattern
            binary_wrapper.command(:createinfobase) do
              connection_string cs
              useTemplate template if template
            end
          end

          def execute
            cmd = run_enterprise(make_command)
            puts Colorize.green(cmd.process_holder.result.assout) unless\
              dry_run?
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ass_launcher-0.3.2 lib/ass_launcher/cmd/makeib.rb
ass_launcher-0.3.1 lib/ass_launcher/cmd/makeib.rb
ass_launcher-0.3.0 lib/ass_launcher/cmd/makeib.rb