Class: GetCatalog
- Inherits:
-
Object
- Object
- GetCatalog
- Defined in:
- lib/commands/get-catalog.rb
Instance Method Summary collapse
- #checkout(tag = nil) ⇒ Object
- #do(tag = nil) ⇒ Object
-
#initialize ⇒ GetCatalog
constructor
A new instance of GetCatalog.
- #state ⇒ Object
Constructor Details
#initialize ⇒ GetCatalog
Returns a new instance of GetCatalog.
8 9 10 |
# File 'lib/commands/get-catalog.rb', line 8 def initialize () @log = Logger.new(Canzea::config[:logging_root] + '/plans.log') end |
Instance Method Details
#checkout(tag = nil) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/commands/get-catalog.rb', line 29 def checkout(tag = nil) catalogLocation = Canzea::config[:catalog_location] catalogLocation = Pathname.new(catalogLocation).parent().realpath g = Git.open(Canzea::config[:catalog_location]) if (tag != nil) puts "-- (RESET) For tag #{tag}" g.checkout(tag) else g.checkout(g.branch(Canzea::config[:catalog_branch])) end branch = g.current_branch puts "-- (RESET) Branch '#{branch}' Commit #{g.log[0]}" puts "-- (RESET) Source #{catalogLocation}/catalog" end |
#do(tag = nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/commands/get-catalog.rb', line 12 def do(tag = nil) catalogLocation = Canzea::config[:catalog_location] FileUtils.rm_rf "#{catalogLocation}" FileUtils.mkdir_p "#{catalogLocation}" catalogLocation = Pathname.new(catalogLocation).parent().realpath g = Git.clone(Canzea::config[:catalog_git], "catalog", :path => catalogLocation) if (tag != nil) puts "-- (RESET) For tag #{tag}" g.checkout(tag) else g.checkout(g.branch(Canzea::config[:catalog_branch])) end branch = g.current_branch puts "-- (RESET) Branch '#{branch}' Commit #{g.log[0]}" puts "-- (RESET) Source #{catalogLocation}/catalog" end |
#state ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/commands/get-catalog.rb', line 44 def state() g = Git.open(Canzea::config[:catalog_location]) branch = g.current_branch commit = g.log[0] g..each do | c | # Doesn't seem to link tag to the branch so excluding for now # ENV.store('CATALOG_TAG', c.name) # puts "-- Tag #{c.name}" end ENV.store('CATALOG_BRANCH', branch) ENV.store('CATALOG_COMMIT', "#{g.log[0]}") # puts "-- Branch '#{ENV['CATALOG_BRANCH']}' Commit #{ENV['CATALOG_COMMIT']}" end |