lib/jog.rb in jog-0.0.2 vs lib/jog.rb in jog-0.0.3
- old
+ new
@@ -8,22 +8,22 @@
class << self
def get_or_create_file( time )
subpath = time.strftime( Jog.config[:path_format] )
full_path = File.expand_path( File.join( Jog.config[:root], subpath ) )
- path, _ = File.split( full_path )
unless File.exists?( full_path )
- FileUtils.mkdir_p( 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( path )
+ FileUtils.touch( full_path )
end
end
+
full_path
end
def edit( path )
system "#{Jog.config[:editor]} #{path}"