Skip to content

Instantly share code, notes, and snippets.

View stellimatt's full-sized avatar

Matthew Adams stellimatt

View GitHub Profile
def execute_jslint(working_directory:)
Dir.chdir(working_directory) do
puts "Running jslint on #{working_directory}..."
results = `find . -name "*.js" -print0 | xargs -0 jslint`
puts results
end
end
module Build
module Commit
class ExtendedStaticAnalysis < StaticAnalysis
def initialize(store:)
# execute base class logic first
super(store: store)
# execute custom logic
execute_jslint(working_directory: store.get(attrib_name: "params")[:working_directory])
end
end
@stellimatt
stellimatt / blog_refactor_gem.rake
Last active September 26, 2016 22:26
gems rakefile
@meta[:steps].each do |step|
task_sym = "#{@meta[:pipeline]}:#{step[:phase]}:#{step[:name]}".to_sym
define_task(step[:description], task_sym) do |t, args|
# derive worker class namespace::name
pipeline = @meta[:pipeline].capitalize
phase = step[:phase].capitalize
job = step[:name].split('_').collect(&:capitalize).join
class_ref = "#{pipeline}::#{phase}::#{job}"
@stellimatt
stellimatt / blog_refactor_app.rake
Last active September 26, 2016 22:19
Application's Rakefile to relay information to the gem's Rakefile.
require 'yaml'
require 'blog_refactor_gem'
# Read in the application's pipeline metadata
meta_path = File.join(File.expand_path(File.dirname(__FILE__)), 'pipeline-meta.yml')
@meta = YAML.load(IO.read(meta_path))
# Define where our pipeline will keep its parameter store,
# responsible for passing parameters from task to task during the execution of the pipeline.
@store_path = File.join(File.expand_path(File.dirname(__FILE__)), 'store.json')
@stellimatt
stellimatt / cfn_parameters.txt
Created September 1, 2016 00:26
Sample CFN parameters
"DbPassword": {
"Type": "String",
"Description": "Password for the database",
"NoEcho": true
},
"DbUsername": {
"Type": "String",
"Description": "Username for the database"
},
"DbUrl": {
@stellimatt
stellimatt / userdata.sh
Last active September 1, 2016 00:59
example userdata
#!/bin/bash
apt-get update
apt-get install git -y
git clone git://github.com/stelligent/blog_refactor_php /opt/greeter
if [ ":" == ":$(dpkg -l | grep chefdk)" ]; then
pushd /tmp
wget --quiet https://packages.chef.io/stable/ubuntu/12.04/chefdk_0.16.28-1_amd64.deb
dpkg -i chefdk_0.16.28-1_amd64.deb
mkdir /tmp/cookbooks
fi