Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added push option for stencil call from template

  • Loading branch information...
commit 6b54b201ee573fe4436e60a73260630de08751ec 1 parent 66cc78b
@winton authored
View
2  gemspec.rb
@@ -14,5 +14,5 @@
s.name = GEM_NAME
s.platform = Gem::Platform::RUBY
s.require_path = "lib"
- s.version = "0.1.2"
+ s.version = "0.1.3"
end
View
2  lib/stencil.rb
@@ -10,7 +10,7 @@ def initialize(args)
# If template, do a template merge
if Config.exists?(:templates, path)
- Merge.template(path)
+ Merge.template(path, args.include?('push'))
# If project
elsif Config.exists?(:projects, path)
View
21 lib/stencil/merge.rb
@@ -28,10 +28,10 @@ def project(name, path)
end
end
- def template(path)
+ def template(path, push)
Branches.grouped(path).each do |branches|
branches.unshift('master')
- progressive(path, branches)
+ progressive(path, branches, push)
end
Cmd.run path, "git checkout master"
end
@@ -85,16 +85,19 @@ def get_origin(path)
origin.match(/URL:\s+(\S+)/)[1]
end
- def progressive(path, branches)
+ def progressive(path, branches, push)
merger = branches.shift
mergee = branches.first
if merger && mergee
- Msg.merging_x_into_y merger, mergee
- output = Cmd.run path, "git checkout #{mergee}"
- Msg.error(output) if output.downcase.include?('error')
- output = Cmd.run path, "git merge #{merger}"
- Msg.error(output) if output.downcase.include?('conflict')
- progressive(path, branches)
+ unless merger.empty? || mergee.empty?
+ output = Cmd.run path, "git checkout #{mergee}"
+ Msg.error(output) if output.downcase.include?('error')
+ Msg.merging_x_into_y merger, mergee
+ output = Cmd.run path, "git merge #{merger}"
+ Msg.error(output) if output.downcase.include?('conflict')
+ Cmd.run(path, "git push origin #{mergee}") if push
+ end
+ progressive(path, branches, push)
end
end
end
View
29 stencil.gemspec
@@ -1,29 +0,0 @@
-# -*- encoding: utf-8 -*-
-
-Gem::Specification.new do |s|
- s.name = %q{stencil}
- s.version = "0.1.1"
-
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["Winton Welsh"]
- s.date = %q{2009-11-09}
- s.default_executable = %q{stencil}
- s.email = %q{mail@wintoni.us}
- s.executables = ["stencil"]
- s.extra_rdoc_files = ["README.markdown"]
- 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"]
- s.homepage = %q{http://github.com/winton/stencil}
- s.require_paths = ["lib"]
- s.rubygems_version = %q{1.3.5}
- s.summary = %q{Project template manager}
-
- if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
- s.specification_version = 3
-
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
- else
- end
- else
- end
-end
Please sign in to comment.
Something went wrong with that request. Please try again.