Sha256: 560dd07501a7c0b4b78ec876a9b9ffa29144d555bfaf1793c61980065ddaf9a5

Contents?: true

Size: 706 Bytes

Versions: 1

Compression:

Stored size: 706 Bytes

Contents

#!/usr/bin/env ruby
STDOUT.sync = true

require 'trollop'
opts = Trollop.options do
  version 'mgd 0.2.0.alpha.1'
  banner <<-EOS
mgd is an automated deployer of Middleman site to Github Pages

Usage: mgd [options]
EOS

  opt :url, 'Github URL', type: String, default: ''
  opt :branch, 'Destination branch', type: String, default: 'gh-pages'
end

Trollop.die(:branch, 'can\'t be empty') if opts[:branch].empty?
url = opts[:url]
url = `git config --get remote.origin.url`.strip if url.empty?

spec = Gem::Specification.find_by_name('mgd')
root = spec.gem_dir
script = File.join(root, 'bash/deploy.sh')

Trollop.die('deployment failed, see log above') \
  unless system("#{script} #{url} #{opts[:branch]}")

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mgd-0.2.0.alpha.1 bin/mgd