Class: Methan::Console

Inherits:
Thor
  • Object
show all
Defined in:
lib/methan/console.rb

Instance Method Summary collapse

Instance Method Details

#new(filename) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/methan/console.rb', line 21

def new(filename)
  now = Time.now.strftime("%Y%m%d%H%M%S")
  pwd = Dir::pwd

  filename = "#{filename}.md" unless filename.split(".").last == "md"
  filename = "#{now}_#{filename}"
  filepath = File.join(pwd, filename)

  src = "# #{options[:title] || ''}\n"
  File.open(filepath, "w") do |io|
    io.write(src)
  end
  show "Create memo `#{filename} at #{pwd}`", :green
end

#serverObject



39
40
41
# File 'lib/methan/console.rb', line 39

def server
  ::Methan::Server.rackup(options.dup)
end

#versionObject



15
16
17
# File 'lib/methan/console.rb', line 15

def version
  show Methan::VERSION
end