initial commit
This commit is contained in:
commit
7904e67e08
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
*.gem
|
||||||
|
.bundle
|
||||||
|
Gemfile.lock
|
||||||
|
pkg/*
|
4
Gemfile
Normal file
4
Gemfile
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
source "http://rubygems.org"
|
||||||
|
|
||||||
|
# Specify your gem's dependencies in penchant.gemspec
|
||||||
|
gemspec
|
18
bin/penchant
Executable file
18
bin/penchant
Executable 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
3
lib/penchant.rb
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module Penchant
|
||||||
|
# Your code goes here...
|
||||||
|
end
|
3
lib/penchant/version.rb
Normal file
3
lib/penchant/version.rb
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module Penchant
|
||||||
|
VERSION = "0.0.1"
|
||||||
|
end
|
21
penchant.gemspec
Normal file
21
penchant.gemspec
Normal 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
11
template/script/gemfile
Executable 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}"
|
||||||
|
|
5
template/script/hooks/pre-commit
Executable file
5
template/script/hooks/pre-commit
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
bundle exec rake
|
||||||
|
if [ $? -ne 0 ]; then exit $?; fi
|
||||||
|
|
21
template/script/initialize-environment
Executable file
21
template/script/initialize-environment
Executable 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!"
|
||||||
|
|
6
template/script/install-git-hooks
Executable file
6
template/script/install-git-hooks
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
for hook in script/hooks/* ; do
|
||||||
|
ln -sf $PWD/$hook .git/hooks/${hook##*/}
|
||||||
|
done
|
||||||
|
|
Loading…
Reference in New Issue
Block a user