Sha256: e5a836236771375b7a0de6dfd75d202bcbedd39720e11cdd6cf5b30b9cb4417d

Contents?: true

Size: 1.01 KB

Versions: 6

Compression:

Stored size: 1.01 KB

Contents

#!/usr/bin/env ruby

require 'flok'
require 'thor'
require 'fileutils'
require 'closure-compiler'

class FlokCLI < Thor
  desc "new <path>", "Create a new flok project and/or module, you may supply an absolute path or relative, the last entry in the path will be the module name and folder name of the project"
  def new path
    name = File.basename(path)
    Dir.chdir File.dirname(path) do
      `bundle gem #{name}`

      Dir.chdir name do
        Dir.mkdir "app"
        Dir.mkdir "config"
      end
    end
  end

  option :compress, type: :boolean
  desc "build", "Build a flok project, you must be in the root of the project"
  def build
    Dir.mkdir("./public") unless File.exists?("./public")
    FileUtils.touch "./public/application.js"

    src = Flok::MergeSource.merge_all

    #Compress by writing to a temporary dir, run closure, and then put back
    if options["compress"] == true
      src = Closure::Compiler.new.compile(src)
    end

    File.write("./public/application.js", src)
  end
end

FlokCLI.start(ARGV)

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
flok-0.0.10 bin/flok
flok-0.0.9 bin/flok
flok-0.0.8 bin/flok
flok-0.0.7 bin/flok
flok-0.0.6 bin/flok
flok-0.0.4 bin/flok