Class: Zewo::App

Inherits:
Thor
  • Object
show all
Defined in:
lib/zewo.rb

Defined Under Namespace

Classes: Repo

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ App

Returns a new instance of App.



315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/zewo.rb', line 315

def initialize(*args)
  super
  @top_node = Repo.new('Flux', 'Zewo')
  Repo.repos['Zewo/Flux'] = @top_node

  command_name = nil

  args.each do |a|
    next unless a.is_a? Hash

    if a.key? :current_command
      command_name = a[:current_command].name
      break
    end
  end

  if !command_name.nil? && command_name.to_sym != :init
    unless has_dotfile
      puts 'zewodev has not been initialized in this directory. Run `zewodev init` do to so.'.red
      exit
    end
  end

  top_node.clone_dependencies
end

Instance Attribute Details

#top_nodeObject (readonly)

Returns the value of attribute top_node.



313
314
315
# File 'lib/zewo.rb', line 313

def top_node
  @top_node
end

Instance Method Details

#initObject



342
343
344
345
# File 'lib/zewo.rb', line 342

def init
  create_dotfile
  invoke :rebuild_projects
end

#pullObject



369
370
371
372
373
374
375
376
377
378
379
380
381
382
# File 'lib/zewo.rb', line 369

def pull
  puts "Pulling changes for all repositories..."
  each_repo_async(false) do |key, repo|
    begin
      output = repo.pull
      str = "#{key}:\n".green
      str += output
      str += "\n\n"
      puts str
    rescue Exception => e
      puts "#{key}: #{e.message.red}"
    end
  end
end

#rebuild_projectsObject



348
349
350
351
# File 'lib/zewo.rb', line 348

def rebuild_projects
  top_node.setup_xcode_projects
  top_node.configure_xcode_projects
end

#statusObject



354
355
356
357
358
359
360
361
362
363
364
365
366
# File 'lib/zewo.rb', line 354

def status
  each_repo do |key, repo|
    str = key
    branch = repo.branch
    str += " (#{repo.tag}) - #{repo.uncommited_changes? ? branch.red : branch.green}"

    if repo.tag_lock
      str += " Locked to #{repo.tag_lock}".yellow
    end

    puts str
  end
end