Class: Statique::CLI::Init

Inherits:
Object
  • Object
show all
Defined in:
lib/statique/cli/init.rb

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Init

Returns a new instance of Init.



8
9
10
# File 'lib/statique/cli/init.rb', line 8

def initialize(name)
  @dest_dir = Pathname.pwd.join(name || ".")
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/statique/cli/init.rb', line 12

def run
  create_directory(@dest_dir)

  write_file(@dest_dir.join("public/robots.txt"), "User-agent: *\nAllow: /")
  write_file(@dest_dir.join("assets/css/app.css"), %(@import url("https://cdn.jsdelivr.net/npm/water.css@2/out/water.css");))
  write_file(@dest_dir.join("assets/js/app.js"), %(console.log("Hello from Statique!")))

  copy_template("index.md", @dest_dir.join("content"))
  copy_template("layout.slim", @dest_dir.join("layouts"))
end