Sha256: f129139f18c4f6084fdcbd2dabca1e2d79b7668ed89d7b175672bd35a96367c4

Contents?: true

Size: 1.64 KB

Versions: 1

Compression:

Stored size: 1.64 KB

Contents

#!/usr/bin/env ruby

require 'smallvictories'

def help
  %Q(
  Usage: sv [COMMAND] [OPTIONS]

  Commands:
    bootstrap, bootstrap FOLDER     Setup folder with default files
    compile                         Compile files
    open                            Open index.html in destination folder
    watch                           Watch for changes and compile files
    help                            Prints this help document
    version                         Prints the small victories gem version

  Options:
    -h, --help                      Prints this help document
    -v, --version                   Prints the siteleaf gem version

  See https://github.com/xxix/smallvictories-gem for additional documentation.
  )
end

def bootstrap folder=nil
  config = SmallVictories::Configuration.new
  builder = SmallVictories::Builder.new(config: config)
  builder.setup folder
end

def compile
  config = SmallVictories::Configuration.new
  compiler = SmallVictories::Compiler.new(config: config)
  compiler.compile_css
  compiler.compile_js
  compiler.compile_html
end

def open
  config = SmallVictories::Configuration.new
  system("open #{config.full_destination_path}index.html")
end

def watch
  config = SmallVictories::Configuration.new
  compiler = SmallVictories::Compiler.new(config: config)
  watcher = SmallVictories::Watcher.new(compiler: compiler)
  watcher.watch
end

case ARGV[0]
when '-v', '--version', 'version'
  puts SmallVictories::VERSION
when '-h', '--help', 'help'
  puts help
when 'bootstrap'
  bootstrap ARGV[1]
when 'compile'
  compile
when 'open'
  open
when 'watch'
  watch
else
  puts "`#{ARGV[0]}` command not found.\n"
  puts help
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
smallvictories-0.0.5 bin/sv