Sha256: a585b10d24ce382701189759b106005cbc7c5f95e3af7d3003cf850457e3b544

Contents?: true

Size: 1.56 KB

Versions: 2

Compression:

Stored size: 1.56 KB

Contents

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

puts "\nthe `frankout' command is deprecated and will be removed in 0.5, use `frank export' or the alias `frank out'"

begin
  # try to use bundler if its available
  require 'bundler'
  begin
    Bundler.require
  rescue Bundler::GemfileNotFound
    # revert to using local frank install
    $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
  end
rescue LoadError
  # revert to using local frank install
  $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
end

require 'frank'

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|
    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
  Frank.production! if production
  Frank.bootstrap(Dir.pwd)
  Frank::Output.new do
    set :environment, :output
    set :output_folder, output_folder
  end.dump(production)

rescue Errno::ENOENT
  puts "Frank could not find setup.rb"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
frank-0.4.1 bin/frankout
frank-0.4.0 bin/frankout