Sha256: 611777562478d1aa99b3cde48e0cbe7ff4acfcbf65b10d367108035fdf3ca943

Contents?: true

Size: 973 Bytes

Versions: 2

Compression:

Stored size: 973 Bytes

Contents

#!/usr/bin/env ruby
require 'commander/import'
require 'listen'
require 'plotline/version'
require File.join(Dir.pwd, 'config', 'environment') # load the Rails app

program :name, 'Plotline'
program :version, Plotline::VERSION
program :description, 'Simple CMS based on Ruby, Markdown and Postgres'

command :sync do |c|
  c.syntax = 'plotline sync [options]'
  c.description = 'Sync content files from --path to the database and --media-target directories'
  c.option '--source-path STRING', String, 'Directory with content files'
  c.option '--target STRING', String, 'Rails application directory (defaults to pwd)'
  c.action do |args, options|
    options.default target: Dir.pwd

    importer = Plotline::Import::Runner.new(options.source_path, options.target)
    importer.import_all!

    listener = Listen.to(options.source_path) do |modified, added, removed|
      importer.process_files(removed | modified | added)
    end

    listener.start
    sleep
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
plotline-0.1.1 bin/plotline
plotline-0.1.0 bin/plotline