Sha256: 8c74c5fd7d6ff2f3cdc698fed84d00175709107fff9241c13c575c4032deb015

Contents?: true

Size: 681 Bytes

Versions: 1

Compression:

Stored size: 681 Bytes

Contents

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

require 'trollop'
opts = Trollop.options do
  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

branch = opts[:branch]

fail 'branch can\'t be empty' if branch.empty?
url = opts[:url]
url = `git config --get remote.origin.url` if url.empty?
url.delete!("\n")

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

fail 'deployment failed, see log above' \
  unless system("#{script} #{url} #{branch}")

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mgd-0.1.0 bin/mgd