Sha256: 82742118fd86980a110fb4a2453b7d69038643fcfd3551226046408fb232c7ce

Contents?: true

Size: 1.2 KB

Versions: 6

Compression:

Stored size: 1.2 KB

Contents

#!/usr/bin/env ruby
require 'optparse'
require 'frank'

options = { :production => false }

opts = OptionParser.new do |opts|
  opts.banner = "Usage: frankout [OPTIONS] directory\n",
                "Compiles and dumps a project and it\'s static files to given directory\n",
                "Example: frankout --production html_dump\n\n"
  
  opts.separator 'Options:'
  
  opts.on('--production', 'Production ready dump i.e. ([FOLDER]/index.html)') do |handler|
    options[:production] = true
  end
  
  opts.on( '-h', '--help', 'Display this help' ) do
    puts opts
    exit
  end
end

opts.parse!

if ARGV.empty?
  puts opts
  exit
end

output_folder = ARGV.first

if File.exists? output_folder
  print "'#{output_folder}' \033[31malready exists...\033[0m do you want to overwrite it? (y|n) "
  resp = STDIN.gets.chomp.strip
  exit if resp.downcase.strip != 'y'
  FileUtils.rm_rf(output_folder)
end

begin
  settings = YAML.load_file('settings.yml')
  proj_dir = Dir.pwd
  
  Frank::Output.new do
    settings.each do |name, value|
      set name.to_s, value
    end
    set :output_folder, output_folder
    set :proj_dir, proj_dir
  end.dump(options)
  
rescue Errno::ENOENT
  puts "Frank could not find settings.yml."
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
frank-0.3.1 bin/frankout
frank-0.3.0 bin/frankout
frank-0.3.0.beta2 bin/frankout
frank-0.3.0.beta bin/frankout
frank-0.2.6 bin/frankout
frank-0.2.5 bin/frankout