Skip to content

Instantly share code, notes, and snippets.

View webervin's full-sized avatar

Ervin Weber webervin

  • pactum.com
  • Estonia, Tallinn
View GitHub Profile
@webervin
webervin / Bash template
Last active August 29, 2015 13:57
This is template for scripted tasks that need to be silent unless error.
#!/usr/bin/env bash
# Copyright (c) 2014, TOGGL LLC
# All rights reserved.
# Published under New BSD license
# Set configuration variables on top
# Error handling and logging
LOG_NAME="`basename $0 .sh`.log"
@webervin
webervin / rspec_and_factory_tasks.rake
Created October 5, 2011 08:51 — forked from tcocca/missing_spec_generator.rb
Generates missing specs and factories. NB assumes you have GenericSpecForModels module defined somewhere (just drop in lib/tasks)
class MissingSpecGenerator
#based on https://gist.github.com/537795 by tcoccara
def spec_file(spec_path, file_name, spec_template, namespace)
spec_name = file_name.gsub('.rb', '') + '_spec.rb'
if File.exist?("#{spec_path}/#{spec_name}")
puts "#{spec_path}/#{spec_name} exists"
else
puts "#{spec_path}/#{spec_name} missing"
puts "\n"
spec_file = ERB.new(spec_template)