Sha256: 5c064bb283198b29d4587df0f0d680ae80b85997d1097a1574e9a2d1f25ad9f7

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

require "thor"

module Schnitzelpress
  class Cli < Thor
    include Thor::Actions

    source_root(File.expand_path('../../templates', __FILE__))

    desc "create NAME", "Creates a new Schnitzelpress blog."
    method_option :git, :aliases => "-g", :default => false, :type => :boolean,
      :desc => "Initialize a git repository in your blog's directory."

    def create(name)
      @name = name
      self.destination_root = name
      directory 'new_blog', '.'

      in_root do
        if options[:git]
          run "git init"
          run "git add ."
          run "git commit -m 'Created new Schnitzelpress blog'"
        end
      end
    end

    desc "update", "Update your blog's bundled Schnitzelpress version."
    def update
      run "bundle update schnitzelpress"
    end

    desc "console", "Run the Schnitzelpress console."
    def console
      require 'schnitzelpress'
      require 'pry'
      Schnitzelpress.init!
      ARGV.clear
      pry Schnitzelpress
    end

    desc "mongo_pull", "Pulls contents of remote MongoDB into your local MongoDB"
    def mongo_pull
      abort "Please set MONGO_URL." unless ENV['MONGO_URL']
      system "heroku mongo:pull"
    end

    desc "mongo_push", "Pushes contents of your local MongoDB to remote MongoDB"
    def mongo_push
      abort "Please set MONGO_URL." unless ENV['MONGO_URL']
      system "heroku mongo:push"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
schnitzelpress-0.2.1 lib/schnitzelpress/cli.rb