stencil 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +41 -1
- data/Rakefile +2 -52
- data/bin/stencil +0 -0
- data/lib/stencil/merge.rb +2 -6
- data/require.rb +30 -0
- data/spec/spec_helper.rb +3 -14
- metadata +3 -3
- data/spec/spec.opts +0 -1
data/README.markdown
CHANGED
@@ -1,4 +1,44 @@
|
|
1
1
|
Stencil
|
2
2
|
=======
|
3
3
|
|
4
|
-
Project template manager.
|
4
|
+
Project template manager.
|
5
|
+
|
6
|
+
Requirements
|
7
|
+
------------
|
8
|
+
|
9
|
+
<pre>
|
10
|
+
sudo gem install stencil
|
11
|
+
</pre>
|
12
|
+
|
13
|
+
Setup the template
|
14
|
+
------------------
|
15
|
+
|
16
|
+
You only have to do this once.
|
17
|
+
|
18
|
+
<pre>
|
19
|
+
git clone git@github.com:winton/gem_template.git
|
20
|
+
cd gem_template
|
21
|
+
stencil
|
22
|
+
</pre>
|
23
|
+
|
24
|
+
Setup a new project
|
25
|
+
-------------------
|
26
|
+
|
27
|
+
Do this for every new project.
|
28
|
+
|
29
|
+
<pre>
|
30
|
+
mkdir my_project
|
31
|
+
cd my_project
|
32
|
+
git init
|
33
|
+
stencil gem_template [BRANCH, BRANCH, ...]
|
34
|
+
rake rename
|
35
|
+
</pre>
|
36
|
+
|
37
|
+
The last command does a find-replace (gem\_template -> my\_project) on files and filenames.
|
38
|
+
|
39
|
+
Commit from project to template
|
40
|
+
-------------------------------
|
41
|
+
|
42
|
+
<pre>
|
43
|
+
stencil ^ [COMMIT HASH]
|
44
|
+
</pre>
|
data/Rakefile
CHANGED
@@ -1,52 +1,2 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
require 'rake/gempackagetask'
|
4
|
-
require 'spec/rake/spectask'
|
5
|
-
require 'gemspec'
|
6
|
-
|
7
|
-
desc "Generate gemspec"
|
8
|
-
task :gemspec do
|
9
|
-
File.open("#{Dir.pwd}/#{GEM_NAME}.gemspec", 'w') do |f|
|
10
|
-
f.write(GEM_SPEC.to_ruby)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
desc "Install gem"
|
15
|
-
task :install do
|
16
|
-
Rake::Task['gem'].invoke
|
17
|
-
`sudo gem uninstall #{GEM_NAME} -x`
|
18
|
-
`sudo gem install pkg/#{GEM_NAME}*.gem`
|
19
|
-
`rm -Rf pkg`
|
20
|
-
end
|
21
|
-
|
22
|
-
desc "Package gem"
|
23
|
-
Rake::GemPackageTask.new(GEM_SPEC) do |pkg|
|
24
|
-
pkg.gem_spec = GEM_SPEC
|
25
|
-
end
|
26
|
-
|
27
|
-
desc "Rename project"
|
28
|
-
task :rename do
|
29
|
-
name = ENV['NAME'] || File.basename(Dir.pwd)
|
30
|
-
begin
|
31
|
-
dir = Dir['**/gem_template*']
|
32
|
-
from = dir.pop
|
33
|
-
if from
|
34
|
-
rb = from.include?('.rb')
|
35
|
-
to = File.dirname(from) + "/#{name}#{'.rb' if rb}"
|
36
|
-
FileUtils.mv(from, to)
|
37
|
-
end
|
38
|
-
end while dir.length > 0
|
39
|
-
Dir["**/*"].each do |path|
|
40
|
-
next if path.include?('Rakefile')
|
41
|
-
if File.file?(path)
|
42
|
-
`sed -i "" 's/gem_template/#{name}/g' #{path}`
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
desc "Run specs"
|
48
|
-
Spec::Rake::SpecTask.new do |t|
|
49
|
-
t.rcov = true
|
50
|
-
t.spec_opts = ["--format", "specdoc", "--colour"]
|
51
|
-
t.spec_files = FileList["spec/**/*_spec.rb"]
|
52
|
-
end
|
1
|
+
require "#{File.dirname(__FILE__)}/require"
|
2
|
+
Require.rakefile!
|
data/bin/stencil
CHANGED
File without changes
|
data/lib/stencil/merge.rb
CHANGED
@@ -36,11 +36,10 @@ class Stencil
|
|
36
36
|
Cmd.run path, "git checkout master"
|
37
37
|
end
|
38
38
|
|
39
|
-
def upstream(name, commit=nil, branches
|
39
|
+
def upstream(name, commit=nil, *branches)
|
40
40
|
# Project variables
|
41
41
|
project = Config.read[:projects][name]
|
42
|
-
|
43
|
-
branch = branch[branch.index('*') + 1]
|
42
|
+
branches = project[:branches] if branches.empty?
|
44
43
|
|
45
44
|
# Template variables
|
46
45
|
template = Config.read[:templates][project[:template].intern]
|
@@ -58,9 +57,6 @@ class Stencil
|
|
58
57
|
commit = Cmd.run(template[:path], cmd).strip
|
59
58
|
end
|
60
59
|
|
61
|
-
# Cherry pick into master if no branches specified
|
62
|
-
branches = %w(master) if branches.empty?
|
63
|
-
|
64
60
|
# Cherry pick commit into branches
|
65
61
|
branches.each do |branch|
|
66
62
|
output = Cmd.run path, "git checkout #{branch}"
|
data/require.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
gem 'require'
|
3
|
+
require 'require'
|
4
|
+
|
5
|
+
Require do
|
6
|
+
gem :require, '=0.2.7'
|
7
|
+
gem(:rake, '=0.8.7') { require 'rake' }
|
8
|
+
gem :rspec, '=1.3.0'
|
9
|
+
|
10
|
+
gemspec do
|
11
|
+
author 'Winton Welsh'
|
12
|
+
email 'mail@wintoni.us'
|
13
|
+
name 'stencil'
|
14
|
+
homepage "http://github.com/winton/#{name}"
|
15
|
+
summary "Project template manager"
|
16
|
+
version '0.1.4'
|
17
|
+
end
|
18
|
+
|
19
|
+
rakefile do
|
20
|
+
gem(:rake) { require 'rake/gempackagetask' }
|
21
|
+
gem(:rspec) { require 'spec/rake/spectask' }
|
22
|
+
require 'require/tasks'
|
23
|
+
end
|
24
|
+
|
25
|
+
spec_helper do
|
26
|
+
require 'require/spec_helper'
|
27
|
+
require 'lib/gem_template'
|
28
|
+
require 'pp'
|
29
|
+
end
|
30
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,16 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
$:.unshift File.expand_path("#{SPEC}/../lib")
|
4
|
-
|
5
|
-
require 'stencil'
|
6
|
-
require 'pp'
|
1
|
+
require File.expand_path("#{File.dirname(__FILE__)}/../require")
|
2
|
+
Require.spec_helper!
|
7
3
|
|
8
4
|
Spec::Runner.configure do |config|
|
9
|
-
end
|
10
|
-
|
11
|
-
# For use with rspec textmate bundle
|
12
|
-
def debug(object)
|
13
|
-
puts "<pre>"
|
14
|
-
puts object.pretty_inspect.gsub('<', '<').gsub('>', '>')
|
15
|
-
puts "</pre>"
|
16
|
-
end
|
5
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stencil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Winton Welsh
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-05-28 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -34,7 +34,7 @@ files:
|
|
34
34
|
- MIT-LICENSE
|
35
35
|
- Rakefile
|
36
36
|
- README.markdown
|
37
|
-
-
|
37
|
+
- require.rb
|
38
38
|
- spec/spec_helper.rb
|
39
39
|
has_rdoc: true
|
40
40
|
homepage: http://github.com/winton/stencil
|
data/spec/spec.opts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|