Class: ProjectGroup::Command

Inherits:
Object
  • Object
show all
Includes:
FromHash
Defined in:
lib/project_group/command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cmdObject

Returns the value of attribute cmd.



4
5
6
# File 'lib/project_group/command.rb', line 4

def cmd
  @cmd
end

#group_nameObject

Returns the value of attribute group_name.



4
5
6
# File 'lib/project_group/command.rb', line 4

def group_name
  @group_name
end

Instance Method Details

#cycleObject



24
25
26
27
28
# File 'lib/project_group/command.rb', line 24

def cycle
  group.singles.each do |proj|
    puts "#{proj.path} #{proj.status.inspect} #{proj.spec_output}"
  end 
end

#gitObject



51
52
53
54
55
56
57
58
59
# File 'lib/project_group/command.rb', line 51

def git
  group.singles.each do |proj|
    if proj.repo.changes?
      ec "gittower #{proj.path}"
      puts "Enter to Continue"
      STDIN.gets
    end
  end
end

#infoObject



30
31
32
33
34
35
# File 'lib/project_group/command.rb', line 30

def info
  puts "Group #{group.name}"
  group.singles.each do |proj|
    puts "#{proj.name} #{proj.path}"
  end
end

#openObject



37
38
39
40
41
# File 'lib/project_group/command.rb', line 37

def open
  proj = SublimeProject.new(:group => group)
  proj.write!
  ec "subl --project #{proj.path}"
end

#parse!(args) ⇒ Object



61
62
63
64
65
66
67
68
69
70
# File 'lib/project_group/command.rb', line 61

def parse!(args)
  self.cmd = args.first
  OptionParser.new do |opts|
    opts.banner = "Usage: example.rb [options]"

    opts.on("-n", "--name name", "Group Name") do |v|
      self.group_name = v
    end
  end.parse!(args)
end

#pushObject



43
44
45
46
47
48
49
# File 'lib/project_group/command.rb', line 43

def push
  group.singles.each do |proj|
    if !proj.repo.pushed?
      ec "cd #{proj.path} && git push origin master:master"
    end
  end
end

#run!Object



20
21
22
# File 'lib/project_group/command.rb', line 20

def run!
  send(cmd)
end