Class: Nimbu::Command::Init

Inherits:
Base
  • Object
show all
Includes:
Term::ANSIColor
Defined in:
lib/nimbu/command/init.rb

Overview

working directory initialization

Instance Attribute Summary

Attributes inherited from Base

#args, #options

Instance Method Summary collapse

Methods inherited from Base

#initialize, namespace, #nimbu

Methods included from Helpers

#action, #ask, #confirm, #confirm_billing, #confirm_command, #create_git_remote, #deprecate, disable_error_capture, #display, #display_header, #display_object, #display_row, #display_table, enable_error_capture, #error, error_with_failure, error_with_failure=, extended, extended_into, #fail, #format_bytes, #format_date, #format_error, #format_with_bang, #get_terminal_environment, #git, #has_git?, #home_directory, #hprint, #hputs, included, included_into, #json_decode, #json_encode, #launchy, #line_formatter, #longest, #output, #output_with_arrow, #output_with_bang, #quantify, #redisplay, #retry_on_exception, #run_command, #running_on_a_mac?, #running_on_windows?, #set_buffer, #shell, #spinner, #status, #string_distance, #styled_array, #styled_error, #styled_hash, #styled_header, #suggestion, #time_ago, #truncate, #with_tty

Methods included from Helpers::System

#browser_launcher, #command?, #osx?, #tmp_dir, #which, #windows?

Constructor Details

This class inherits a constructor from Nimbu::Command::Base

Instance Method Details

#indexObject

index

initialize your working directory to code a selected theme



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/nimbu/command/init.rb', line 14

def index
  if Nimbu::Auth.read_configuration && Nimbu::Auth.read_credentials
    print green(bold("CONGRATULATIONS!")), ": this directory is already configured as a Nimbu theme."
  else
    credentials = Nimbu::Auth.get_credentials

    display "Initializing the Nimbu configuration file."
    config = Nimbu::Auth.get_configuration

    display "Initializing directories:"
    display " - layouts"
    FileUtils.mkdir_p(File.join(Dir.pwd,'layouts'))
    display " - templates"
    FileUtils.mkdir_p(File.join(Dir.pwd,'templates'))
    display " - stylesheets"
    FileUtils.mkdir_p(File.join(Dir.pwd,'stylesheets'))
    display " - javascripts"
    FileUtils.mkdir_p(File.join(Dir.pwd,'javascripts'))
    display " - images"
    FileUtils.mkdir_p(File.join(Dir.pwd,'images'))
    print green(bold("Done. Happy coding!\n"))
  end
end