Module: Done

Includes:
Config
Defined in:
lib/done.rb,
lib/done/cli.rb,
lib/done/config.rb,
lib/done/version.rb

Defined Under Namespace

Modules: Config Classes: CLI

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.edit(path) ⇒ Object



18
19
20
# File 'lib/done.rb', line 18

def edit( path )
  system "#{Done.config.editor} #{path}"
end

.get_or_create_file(time) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/done.rb', line 9

def get_or_create_file( time )
  subpath = time.strftime( Done.config.path_format )
  full_path = File.expand_path( File.join( Done.config.root, subpath ) )
  path, _ = File.split( full_path )
  FileUtils.mkdir_p( path )
  FileUtils.touch( full_path ) unless File.exists?( full_path )
  full_path
end