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



26
27
28
29
30
# File 'lib/project_group/command.rb', line 26

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

#gitObject



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

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



32
33
34
35
36
37
# File 'lib/project_group/command.rb', line 32

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

#openObject



39
40
41
42
43
# File 'lib/project_group/command.rb', line 39

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

#parse!(args) ⇒ Object



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

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



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

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



22
23
24
# File 'lib/project_group/command.rb', line 22

def run!
  send(cmd)
end