initial commit

This commit is contained in:
John Bintz 2011-07-14 15:50:51 -04:00
commit 7904e67e08
11 changed files with 98 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.gem
.bundle
Gemfile.lock
pkg/*

4
Gemfile Normal file
View File

@ -0,0 +1,4 @@
source "http://rubygems.org"
# Specify your gem's dependencies in penchant.gemspec
gemspec

2
Rakefile Normal file
View File

@ -0,0 +1,2 @@
require 'bundler'
Bundler::GemHelper.install_tasks

18
bin/penchant Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env ruby
require 'rubygems'
require 'thor'
class Penchant < Thor
include Thor::Actions
source_root File.expand_path('../..', __FILE__)
desc "install", "Copy the common scripts to the project"
method_options :dir => 'script'
def install
directory 'template/script', options[:dir]
Dir[File.join(options[:dir], '**/*')].each { |file| File.chmod(0755, file) }
end
end
Penchant.start

3
lib/penchant.rb Normal file
View File

@ -0,0 +1,3 @@
module Penchant
# Your code goes here...
end

3
lib/penchant/version.rb Normal file
View File

@ -0,0 +1,3 @@
module Penchant
VERSION = "0.0.1"
end

21
penchant.gemspec Normal file
View File

@ -0,0 +1,21 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "penchant/version"
Gem::Specification.new do |s|
s.name = "penchant"
s.version = Penchant::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["TODO: Write your name"]
s.email = ["TODO: Write your email address"]
s.homepage = ""
s.summary = %q{TODO: Write a gem summary}
s.description = %q{TODO: Write a gem description}
s.rubyforge_project = "penchant"
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
end

11
template/script/gemfile Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env ruby
require 'erb'
env = ARGV[0]
File.open('Gemfile', 'w') { |fh| fh.print ERB.new(File.read('Gemfile.erb')).result(binding) }
system %{bundle}
puts "Gemfile switched to #{env}"

View File

@ -0,0 +1,5 @@
#!/bin/bash
bundle exec rake
if [ $? -ne 0 ]; then exit $?; fi

View File

@ -0,0 +1,21 @@
#!/usr/bin/env ruby
pwd = Dir.pwd
Dir.chdir '..' do
File.readlines(File.join(pwd, 'Gemfile.erb')).find_all { |line| line[':git'] }.each do |line|
repo = line[%r{:git => (['"])(.*)\1}, 2]
puts "Installing #{repo}"
system %{git clone #{repo}}
end
end
puts "Bundling for local environment"
system %{script/gemfile local}
puts "Installing git hooks"
system %{script/install-git-hooks}
puts "Done!"

View File

@ -0,0 +1,6 @@
#!/bin/bash
for hook in script/hooks/* ; do
ln -sf $PWD/$hook .git/hooks/${hook##*/}
done