Skip to content

Instantly share code, notes, and snippets.

@jarosite
jarosite / teamcity.rb
Last active August 29, 2015 14:07 — forked from agross/teamcity.rb
class TeamCity
def self.running?
ENV.include? 'TEAMCITY_PROJECT_NAME'
end
def self.method_missing(method, *args, &block)
return unless running?
message_name = camel_case method.to_s
publish message_name, args[0]
@jarosite
jarosite / install_puppet.sh
Last active June 24, 2019 10:37
Install puppet on amazon linux, after ami lost back compatibility to centos 6.5
#!/bin/bash
yum install ruby18 rubygems18 -y
alternatives --set ruby /usr/bin/ruby1.8
rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm
yum install puppet-3.7.3 -y --disableplugin=priorities
@jarosite
jarosite / puppet_syntax_check.rb
Last active August 29, 2015 14:07
Hook for mercurial server. Will check syntax of puppet files, yaml files for hiera and erb template files. Add on serrver to .hg/hgrc [hooks] pretxnchangegroup = .hg/puppet_syntax_check.rb
#!/usr/bin/ruby
def chk(file_to_check, cmd)
puts "checking '#{file_to_check}'"
if !system("hg cat -r tip '#{file_to_check}' | #{cmd} 2>&1")
print('!!! Syntax error in file: ' + file_to_check + "\n")
exit(1)
end
end