Sha256: fb73132680e9e1a86a8be22ab551236fa5360ce4bb07757f7193978108a65a85

Contents?: true

Size: 686 Bytes

Versions: 2

Compression:

Stored size: 686 Bytes

Contents

require "rerun"
require "pathname"
require "dry/core/inflector"

module Kanji
  class CLI < Thor
    class Server
      def self.start(options = {})
        Rerun::Runner.keep_running(
          "thin -R config.ru -a 127.0.0.1 -p #{options["port"]} -D start",
          default_options
        )
      end

      def self.default_options
        {
          pattern: "**/*.rb",
          signal: "TERM",
          notify: false,
          name: app_name,
          ignore: [],
          dir: ["app", "system"],
          cmd: "rackup config.ru"
        }
      end

      def self.app_name
        Dry::Core::Inflector.camelize(Pathname.getwd.basename.to_s)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kanji-web-0.3.1 lib/kanji/cli/server.rb
kanji-web-0.3.0 lib/kanji/cli/server.rb