Class: Hardbound::Book

Inherits:
Object
  • Object
show all
Defined in:
lib/hardbound.rb

Instance Method Summary collapse

Instance Method Details

#new(title) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/hardbound.rb', line 4

def new(title)
  # Main app setup
  Dir.mkdir("./#{title}")
  File.open("./#{title}/app.rb", 'w') {|f| f.write("get '/' do\n  'hello world'\nend") }
  File.open("./#{title}/Gemfile", 'w') {|f| f.write("source :rubygems\ngem 'sinatra'") }
  
  # Chapters
  Dir.mkdir("./#{title}/pages")
  File.open("./#{title}/pages/layout.erb", 'w') {|f| f.write("# Chapter 1:") }
  File.open("./#{title}/pages/cover.erb", 'w') {|f| f.write("# Chapter 1:") }
  File.open("./#{title}/pages/1.md", 'w') {|f| f.write("# Chapter 1:") }
end