lib/middleman-tansu/command.rb in middleman-tansu-0.1.1 vs lib/middleman-tansu/command.rb in middleman-tansu-0.1.2
- old
+ new
@@ -45,15 +45,10 @@
desc: 'The date of Frontmatter (default: Time.zone.now)',
default: nil
method_option 'author',
aliases: '-a',
desc: 'The author name of Frontmatter (default: ENV["USER"])'
- method_option 'current',
- type: :boolean,
- aliases: '-c',
- default: false,
- desc: 'Create file from current direcotry'
method_option 'frontmatter',
desc: 'Additions of Frontmatter ex:"category:sample,tags:frontmatter"',
default: ''
def tansu(path)
paths = path.split('/')
@@ -66,18 +61,15 @@
if Regexp.new(".html.#{ext}$") !~ title
filename = "#{title}.html.#{ext}"
end
- if options[:current]
- file = File.join(filename)
- else
- dir = destination_dir(paths)
- file = File.join(dir, filename)
- FileUtils.mkdir_p dir unless Dir.exist?(dir)
- end
+ dir = destination_dir(paths)
+ file = File.join(dir, filename)
+ FileUtils.mkdir_p dir unless Dir.exist?(dir)
+
if File.exist?(file)
say "#{display_path(file)} is exist"
exit
end
@@ -135,10 +127,10 @@
app = Middleman::Application
File.join(app.root, app.config.source)
end
def display_path(path)
- path.sub(Regexp.new("^#{source}/"), '')
+ path.sub(Regexp.new("^#{source}/"), "")
end
end
end
end
end