stencil 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -24,6 +24,26 @@ Rake::GemPackageTask.new(GEM_SPEC) do |pkg|
24
24
  pkg.gem_spec = GEM_SPEC
25
25
  end
26
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
+
27
47
  desc "Run specs"
28
48
  Spec::Rake::SpecTask.new do |t|
29
49
  t.rcov = true
data/gemspec.rb CHANGED
@@ -14,5 +14,5 @@ GEM_SPEC = Gem::Specification.new do |s|
14
14
  s.name = GEM_NAME
15
15
  s.platform = Gem::Platform::RUBY
16
16
  s.require_path = "lib"
17
- s.version = "0.1.2"
17
+ s.version = "0.1.3"
18
18
  end
data/lib/stencil.rb CHANGED
@@ -10,7 +10,7 @@ class Stencil
10
10
 
11
11
  # If template, do a template merge
12
12
  if Config.exists?(:templates, path)
13
- Merge.template(path)
13
+ Merge.template(path, args.include?('push'))
14
14
 
15
15
  # If project
16
16
  elsif Config.exists?(:projects, path)
data/lib/stencil/merge.rb CHANGED
@@ -28,10 +28,10 @@ class Stencil
28
28
  end
29
29
  end
30
30
 
31
- def template(path)
31
+ def template(path, push)
32
32
  Branches.grouped(path).each do |branches|
33
33
  branches.unshift('master')
34
- progressive(path, branches)
34
+ progressive(path, branches, push)
35
35
  end
36
36
  Cmd.run path, "git checkout master"
37
37
  end
@@ -85,16 +85,19 @@ class Stencil
85
85
  origin.match(/URL:\s+(\S+)/)[1]
86
86
  end
87
87
 
88
- def progressive(path, branches)
88
+ def progressive(path, branches, push)
89
89
  merger = branches.shift
90
90
  mergee = branches.first
91
91
  if merger && mergee
92
- Msg.merging_x_into_y merger, mergee
93
- output = Cmd.run path, "git checkout #{mergee}"
94
- Msg.error(output) if output.downcase.include?('error')
95
- output = Cmd.run path, "git merge #{merger}"
96
- Msg.error(output) if output.downcase.include?('conflict')
97
- progressive(path, branches)
92
+ unless merger.empty? || mergee.empty?
93
+ output = Cmd.run path, "git checkout #{mergee}"
94
+ Msg.error(output) if output.downcase.include?('error')
95
+ Msg.merging_x_into_y merger, mergee
96
+ output = Cmd.run path, "git merge #{merger}"
97
+ Msg.error(output) if output.downcase.include?('conflict')
98
+ Cmd.run(path, "git push origin #{mergee}") if push
99
+ end
100
+ progressive(path, branches, push)
98
101
  end
99
102
  end
100
103
  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.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Winton Welsh
@@ -36,7 +36,6 @@ files:
36
36
  - README.markdown
37
37
  - spec/spec.opts
38
38
  - spec/spec_helper.rb
39
- - stencil.gemspec
40
39
  has_rdoc: true
41
40
  homepage: http://github.com/winton/stencil
42
41
  licenses: []
data/stencil.gemspec DELETED
@@ -1,29 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- Gem::Specification.new do |s|
4
- s.name = %q{stencil}
5
- s.version = "0.1.2"
6
-
7
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Winton Welsh"]
9
- s.date = %q{2009-11-09}
10
- s.default_executable = %q{stencil}
11
- s.email = %q{mail@wintoni.us}
12
- s.executables = ["stencil"]
13
- s.extra_rdoc_files = ["README.markdown"]
14
- s.files = ["bin", "bin/stencil", "gemspec.rb", "lib", "lib/stencil", "lib/stencil/branches.rb", "lib/stencil/cmd.rb", "lib/stencil/config.rb", "lib/stencil/hash.rb", "lib/stencil/merge.rb", "lib/stencil/msg.rb", "lib/stencil.rb", "MIT-LICENSE", "Rakefile", "README.markdown", "spec", "spec/spec.opts", "spec/spec_helper.rb", "stencil.gemspec"]
15
- s.homepage = %q{http://github.com/winton/stencil}
16
- s.require_paths = ["lib"]
17
- s.rubygems_version = %q{1.3.5}
18
- s.summary = %q{Project template manager}
19
-
20
- if s.respond_to? :specification_version then
21
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
22
- s.specification_version = 3
23
-
24
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
25
- else
26
- end
27
- else
28
- end
29
- end