lib/stencil.rb in stencil-0.1.0 vs lib/stencil.rb in stencil-0.1.1
- old
+ new
@@ -3,42 +3,44 @@
end
class Stencil
def initialize(args)
- @path = Dir.pwd
- @name = File.basename(@path).intern
+ path = Dir.pwd
+ name = File.basename(path).intern
# If template, do a template merge
- if Config.exists?(:templates, @path)
- Merge.template(@path)
+ if Config.exists?(:templates, path)
+ Merge.template(path)
# If project
- elsif Config.exists?(:projects, @path)
+ elsif Config.exists?(:projects, path)
# If upstream commit, merge upstream
- if args.first('<')
- Merge.upstream args[1..-1]
+ if args.first == '^'
+ Merge.upstream *args[1..-1].unshift(name) and return
# If template specified, update config
elsif args.first
Config.update(:projects => {
- @name => {
- :template => template,
- :branches => branches
+ name => {
+ :template => args.shift,
+ :branches => args
}
})
+
+ end
# Do a project merge
- Merge.project(@path)
+ Merge.project(name, path)
# If not configured
else
# Update config
- Msg.is_template_or_project?(@name)
+ Msg.is_template_or_project?(name)
Config.update((STDIN.gets[0..0].downcase == 't' ? :templates : :projects) => {
- @name => { :path => @path }
+ name => { :path => path }
})
# Re-run
initialize args
\ No newline at end of file