Module: HackerNote::Utils
- Defined in:
- lib/hackernote/utils.rb
Class Method Summary collapse
-
.banner ⇒ Object
banner.
- .logo ⇒ Object
Instance Method Summary collapse
-
#ask(question, expected_answer) ⇒ Object
ask method for interactive session with user.
-
#fix_project_naming(project) ⇒ String
fix target/project name if the target is a URL (eg. example.com/app1/route2/).
Class Method Details
.banner ⇒ Object
banner
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/hackernote/utils.rb', line 34 def self. version = "v#{HackerNote::VERSION}".underline.reset %Q{ ______ ____ ______ ____ | | .'. .~ ~.| ..''| |`````````, ..'''' |.. |.~ ~.`````|`````| |_________| .''```. | |..'' |______ |'''|''''' .'' | ``.. | | | |______ | | .' `. | |``.. | | `. ..' | ``.. | | | | | |.' `.`.______.'| ``..|__________| `....'' | ``|`.______.' | |___________ #{version} }.bold end |
.logo ⇒ Object
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.logo 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/)
6 7 8 |
# File 'lib/hackernote/utils.rb', line 6 def fix_project_naming(project) project.gsub(/http[:|s]+\/\//, '').gsub('/', '-').gsub(/-*$/, '') end |