Sha256: 0c78b876f382a6461160608887cc5161c929e4042d280a47580d6c74025eea3d

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

require 'commander'
require 'flutterby'

Commander.configure do
  program :name, 'Flutterby'
  program :version, Flutterby::VERSION
  program :description, 'There are many static site generators. This one is mine.'

  command :build do |c|
    c.syntax = 'flutterby build [options]'
    c.description = "Build your website."

    c.option '--in DIR', String, "Directory containing your source files"
    c.option '--out DIR', String, "Target directory"

    c.action do |args, options|
      options.default in: "./site/", out: "./_build/"

      root = Flutterby.from(options.in, name: "/")
      root.export(options.out)
    end
  end
  alias_command :b, :build

  command :serve do |c|
    c.syntax = 'flutterby serve [options]'
    c.description = "Serve your website for development."

    c.option '--in DIR', String, "Directory containing your source files"

    c.action do |args, options|
      options.default in: "./site/"

      root = Flutterby.from(options.in, name: "/")
      server = Flutterby::Server.new(root)
      server.run!
    end
  end
  alias_command :server, :serve
  alias_command :s, :serve
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flutterby-0.0.9 lib/flutterby/cli.rb
flutterby-0.0.8 lib/flutterby/cli.rb