Class: Konstruct::Cli

Inherits:
Object
  • Object
show all
Defined in:
lib/cli/skeleton.rb,
lib/cli/documentation.rb

Instance Method Summary collapse

Instance Method Details

#documentationObject



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

def documentation
    
    # B.1. INITIALISE FUNCTIONS -------------------------------------------------------------------------------
    
    msg = Util::Message.new()
    
    # B.1. END ------------------------------------------------------------------------------------------------
    
    msg.heading("KONSTRUCT DOCUMENTATION")
    
    # B.2. IS YOUR DIRECTORY EMPTY? ---------------------------------------------------------------------------

    puts Paint["Opening documentation in your default browser!", "999999"]
    puts ""
    
    Launchy.open( "http://konstruct.github.io/" )
    
    exit(0)
    
    # B.3. END ------------------------------------------------------------------------------------------------
    
end

#skeleton(path) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/cli/skeleton.rb', line 15

def skeleton(path)
    
    # B.1. INITIALISE FUNCTIONS -------------------------------------------------------------------------------
    
    msg = Util::Message.new()
    fs = Util::FS.new()
    
    # B.1. END ------------------------------------------------------------------------------------------------
    
    msg.heading("CREATING SKELETON PROJECT STRUCTURE")
    
    # B.2. IS YOUR DIRECTORY EMPTY? ---------------------------------------------------------------------------

    puts fs.clear_directory(path)

    # B.2. END ------------------------------------------------------------------------------------------------
    
    # B.3. CREATE SKELETON ------------------------------------------------------------------------------------
    
    # B.3.1. FOLDER STRUCTURE
    
    structure = ['1--ci', '2--design', '3--working', '4--www']

    # B.3.1. END
    
    # B.3.2. CONFIRM BUILD
    
    puts Paint["The following directory structure will be created for you:", "999999"]
    
    puts ""
    
    structure.each { |f| 
        
        puts Paint["-- #{ f }", "999999"]
        
    }
    
    puts ""
    
    choice = choose("Do you want to install the structure above?", :yes, :no)
    
    # B.3.2. END
    
    # B.3.3. BUILD STRUCTURE

    if choice == :yes 

        structure.each { |f| 
        
            Dir.mkdir "#{ path }/#{ f }"

        }
        
        msg.success('Successfully created your skeleton. Go do something awesome!')
        
        exit(0)

    else

        exit(0)

    end

    # B.3.7. END
    
    # B.3. END ------------------------------------------------------------------------------------------------
    
end