Class: Backlog::Open

Inherits:
Object
  • Object
show all
Defined in:
lib/backlog/open.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args, date) ⇒ Open

Returns a new instance of Open.



4
5
6
7
8
9
10
11
12
13
# File 'lib/backlog/open.rb', line 4

def initialize(args, date)

  if not date
    puts "Invalid date file"
    return
  end

  @date = date

end

Class Method Details

.helpObject



39
40
41
42
43
44
45
# File 'lib/backlog/open.rb', line 39

def self.help

  return <<-eos
  Open:\tedit backlog entries
  eos

end

Instance Method Details

#execute!Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/backlog/open.rb', line 15

def execute!

  if not @date
    return
  end

  entry = Entry.new(@date)

  # make sure that the file is created 
  if not entry.exists
    entry.create
  end

  if Date.today == @date.date
    symlink
  end

  # save date as needed
  Save.save_date_on_open(@date.date)

  # open file
  Kernel::exec "cd #{Config.base_dir} && #{ENV['EDITOR']} #{@date.relative_path}"
end