Sha256: ea2a730c185564e99de2df792fca5482e53bdf983fa1fc819fb5664a4c2434cc

Contents?: true

Size: 975 Bytes

Versions: 5

Compression:

Stored size: 975 Bytes

Contents

module Clearsight
  class Middleman
    include Methadone::CLILogging
    include Methadone::SH

    attr_accessor :args

    def initialize(args)
      @args = args
    end

    def run
      if @args.first == "new"
        create @args[1]
      else
        pass
      end
    end

    def pass
      sh "middleman #{@args.join(' ')}"
    end

    def setup
      File.exist?("#{ENV['HOME']}/.middleman/clearsight") ? update : clone
    end

    def clone
      print "Cloning ClearSight middleman template..."
      sh "git clone git@bitbucket.org:clearsightstudio/middleman-template.git ~/.middleman/clearsight"
      puts "done."
    end

    def update
      print "Updating ClearSight middleman template..."
      sh "cd ~/.middleman/clearsight && git pull && cd -"
      puts "done."
    end

    def create(project)
      setup
      print "Setting up new middleman project..."
      sh "middleman init -T=clearsight #{project}"
      puts "done."
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
clearsight-1.2.0 lib/clearsight/middleman.rb
clearsight-1.2.0.rc2 lib/clearsight/middleman.rb
clearsight-1.2.0.rc1 lib/clearsight/middleman.rb
clearsight-1.1.0 lib/clearsight/middleman.rb
clearsight-1.0.0 lib/clearsight/middleman.rb