Module: Jog
- Includes:
- Config
- Defined in:
- lib/jog.rb,
lib/jog/cli.rb,
lib/jog/config.rb,
lib/jog/version.rb
Defined Under Namespace
Modules: Config
Classes: CLI
Constant Summary
collapse
- VERSION =
"0.0.3"
Class Method Summary
collapse
Class Method Details
.edit(path) ⇒ Object
29
30
31
|
# File 'lib/jog.rb', line 29
def edit( path )
system "#{Jog.config[:editor]} #{path}"
end
|
.get_or_create_file(time) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/jog.rb', line 10
def get_or_create_file( time )
subpath = time.strftime( Jog.config[:path_format] )
full_path = File.expand_path( File.join( Jog.config[:root], subpath ) )
unless File.exists?( full_path )
FileUtils.mkdir_p( File.dirname( full_path ) )
if Jog.template
File.open( full_path, 'w' ) do |file|
text = ERB.new( Jog.template ).result
file.write( text )
end
else
FileUtils.touch( full_path )
end
end
full_path
end
|