Skip to content

Instantly share code, notes, and snippets.

require 'pusher'
Pusher.url = "xxx"
workflow_id=''
Pusher[workflow_id].trigger('status', state: 'STARTED')
@skierkowski
skierkowski / heroku-build-deploy.rb
Last active August 29, 2015 14:01
Sample app to build a buildpack/slug and deploy to Heroku programmatically
require 'restclient'
require 'awesome_print'
require 'json'
def build(app_id,slug_url,token)
payload={'source_blob' => {'url' => slug_url}}
headers={
'Accept' => 'application/vnd.heroku+json; version=3',
'Content-Type' => 'application/json',
'Authorization' => "Bearer #{token}"
@skierkowski
skierkowski / staticgen-deploy.rb
Created May 5, 2014 19:35
Redeploy staticgen.com every 2 hours to BitBalloon.
listen 'timer','cron', crontab:"* */2 * * *" do |timer_info|
run 'github','download_repo',username:'bitballoon', repo:'staticgen' do |repo_info|
env_vars={'GIST_ID'=>'3bd8a19ab42ca9f32ae8','GITHUB_TOKEN'=>'xxx'}
run 'middleman','build',resource_id:repo_info['resource']['id'],env_vars:env_vars do |build_info|
run 'bitballoon','deploy',resource_id:build_info['resource']['id'], site:'middleman-site' do |build|
run 'hipchat','send',room:'Factor',message:"Staticgen deploy complete at #{Time.now}"
end
end
end
end
{"jsantell/poet":{"16195":{"size":1126,"stargazers_count":330,"watchers_count":330,"forks_count":131,"open_issues_count":25,"forks":131,"open_issues":25,"watchers":330,"network_count":131,"subscribers_count":27}},"getnikola/nikola":{"16195":{"size":25297,"stargazers_count":514,"watchers_count":514,"forks_count":164,"open_issues_count":81,"forks":164,"open_issues":81,"watchers":514,"network_count":164,"subscribers_count":39}},"liquidz/misaki":{"16195":{"size":4053,"stargazers_count":228,"watchers_count":228,"forks_count":27,"open_issues_count":9,"forks":27,"open_issues":9,"watchers":228,"network_count":27,"subscribers_count":19}},"piranha/gostatic":{"16195":{"size":2007,"stargazers_count":202,"watchers_count":202,"forks_count":15,"open_issues_count":3,"forks":15,"open_issues":3,"watchers":202,"network_count":15,"subscribers_count":13}},"braceio/tags":{"16195":{"size":480,"stargazers_count":166,"watchers_count":166,"forks_count":10,"open_issues_count":1,"forks":10,"open_issues":1,"watchers":166,"network_count":
listen 'github','release', repo:'skierkowski/hello' do |repo_info|
# work here for when the release trigger happens
end
listen 'hipchat','room_message',room:'Factor',filter:'on ([A-Za-z0-9\-]*)/([A-Za-z0-9\-\.]*) run (.*)' do |message|
user,repo,command = message['matches']
run 'github','download_repo',username:user, repo:repo do |repo_info|
run 'docker','run',commands:[command], resource_id:repo_info['resource']['id'] do |run_response|
run 'hipchat','send',room:'Factor',message:run_response['stdout'].join("\n")
end
end
end
@skierkowski
skierkowski / hipchat-middleman-bitballoon.rb
Last active August 29, 2015 14:00
This Factor.io workflows listens in the Hipchat Room 'Factor' for someone to say "middleman deploy abc/def to xyz". This will download the repo github.com/abc/def.git from Github, build it using Middleman, then deploy it to BitBalloon to the site 'xyz'. Along the way it posts status updates to the same Hipchat room.
regex_filter='middleman deploy ([A-Za-z0-9\-]*)/([A-Za-z0-9\-\.]*) to ([A-Za-z0-9\-]*)'
listen 'hipchat','room_message', room:'Factor', filter:regex_filter do |message|
user,repo,site = message['matches']
run 'hipchat','send',room:'Factor',message:"Going to download #{user}/#{repo} and deploy to #{site}"
run 'github','download_repo',username:user, repo:repo do |repo_info|
run 'hipchat','send',room:'Factor',message:"Building #{user}/#{repo} with Middleman"
run 'middleman','build',resource_id:repo_info['resource']['id'] do |build_info|
run 'hipchat','send',room:'Factor',message:"Deploy #{user}/#{repo} to #{site}"
run 'bitballoon','deploy',resource_id:build_info['resource']['id'],site:site do |deploy_info|
run 'hipchat','send',room:'Factor',message:"Deploy of #{user}/#{repo} to #{site} complete. Link: #{deploy_info['url']}, Admin: #{deploy_info['admin_url']}"
@skierkowski
skierkowski / github-middleman-bitballoon.rb
Created April 22, 2014 01:10
Wait for git push in Github, then build with Middleman, then deploy to BitBalloon
listen 'github','push', username:'skierkowski', repo:'hello-middleman' do |repo_info|
run 'middleman','build', resource_id:repo_info['resource']['id'] do |build_info|
run 'bitballoon','deploy', resource_id:build_info['resource']['id'], site:'hello-middleman' do |deploy_info|
success "deploy complete with id #{deploy_info['id']}"
end
end
end
@skierkowski
skierkowski / discuss-io-getting-started.md
Last active August 29, 2015 13:58
Discuss.io Getting Started

Discuss.io Getting Started on Factor.io

1. Install factor gem

gem install factor --source https://bsuC2gQBcjvLuqLqztjt@gem.fury.io/skierkowski/

This document was written for version 0.4.11 or higher. You can check the version by running factor --version.

To update you can run the same command replacing install with update.

2. Login