Module: HackerNote::Utils

Defined in:
lib/hackernote/utils.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

banner



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/hackernote/utils.rb', line 34

def self.banner
  version = "v#{HackerNote::VERSION}".underline.reset
  %Q{
                             ______            ____                                                 ______              ____
 |         |      .'.      .~      ~.|    ..''|          |`````````,         ..'''' |..          |.~      ~.`````|`````|
 |_________|    .''```.   |          |..''    |______    |'''|'''''       .''       |  ``..      |          |    |     |______
 |         |  .'       `. |          |``..    |          |    `.       ..'          |      ``..  |          |    |     |
 |         |.'           `.`.______.'|    ``..|__________|      `....''             |          ``|`.______.'     |     |___________
                                                                                                                             #{version}
  }.bold
end

.logoObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/hackernote/utils.rb', line 10

def self.
  slogan = 'The Cyber Daemons - '.reset + 'TechArch'.bold
  %Q{
          ______
    '!!""""""""""""*!!'
 .u$"!'            .!!"$"
 *$!        'z`        ($!
 +$-       .$$&`       !$!
 +$-      `$$$$3       !$!
 +$'   !!  '!$!   !!   !$!
 +$'  ($$.  !$!  '$$!  !$!
 +$'  $$$$  !$!  $$$$  !$!
 +$'  .$"   !$!   3$   !$!
 ($!  `$%`  !3!  .$%   ($!
  ($(` '"$!    `*$"` ."$!
   `($(` '"$!.($". ."$!
     `($(` !$$%. ."$!
       `!$%$! !$%$!
          `     `
                 #{slogan}
  }.red.bold
end

Instance Method Details

#ask(question, expected_answer) ⇒ Object

ask method for interactive session with user



47
48
49
50
51
52
53
54
# File 'lib/hackernote/utils.rb', line 47

def ask(question, expected_answer)
  answer = ''
  until answer.match?(expected_answer)
    answer = Readline.readline(question, true)
  end

  answer
end

#fix_project_naming(project) ⇒ String

fix target/project name if the target is a URL (eg. example.com/app1/route2/)

Returns:

  • (String)


6
7
8
# File 'lib/hackernote/utils.rb', line 6

def fix_project_naming(project)
  project.gsub(/http[:|s]+\/\//, '').gsub('/', '-').gsub(/-*$/, '')
end