Module: Flg::Shell
- Defined in:
- lib/flg/shell.rb
Instance Method Summary collapse
- #append_to_file(name, str) ⇒ Object
- #copy_dir(name, path) ⇒ Object
- #copy_file(name, path) ⇒ Object
- #create_dir(path) ⇒ Object
- #create_file(path, str) ⇒ Object
- #download_file(url, path) ⇒ Object
- #error(str) ⇒ Object
- #file(path) ⇒ Object
- #ok(str) ⇒ Object
- #prepend_to_file(name, str) ⇒ Object
- #remove_file(path) ⇒ Object
- #say(str) ⇒ Object
- #shell(str, &black) ⇒ Object
- #warn(str) ⇒ Object
Instance Method Details
#append_to_file(name, str) ⇒ Object
60 61 62 |
# File 'lib/flg/shell.rb', line 60 def append_to_file(name, str) TTY::File.append_to_file name, str end |
#copy_dir(name, path) ⇒ Object
43 44 45 46 |
# File 'lib/flg/shell.rb', line 43 def copy_dir(name, path) pathname = "./generators/assets/#{name}" TTY::File.copy_directory pathname, path end |
#copy_file(name, path) ⇒ Object
38 39 40 41 |
# File 'lib/flg/shell.rb', line 38 def copy_file(name, path) pathname = "./generators/assets/#{name}" TTY::File.copy_file pathname, path end |
#create_dir(path) ⇒ Object
52 53 54 |
# File 'lib/flg/shell.rb', line 52 def create_dir(path) TTY::File.create_dir path end |
#create_file(path, str) ⇒ Object
48 49 50 |
# File 'lib/flg/shell.rb', line 48 def create_file(path, str) TTY::File.create_file path, str end |
#download_file(url, path) ⇒ Object
56 57 58 |
# File 'lib/flg/shell.rb', line 56 def download_file(url, path) TTY::File.download_file url, path end |
#error(str) ⇒ Object
33 34 35 36 |
# File 'lib/flg/shell.rb', line 33 def error(str) prompt = TTY::Prompt.new prompt.warn str end |
#file(path) ⇒ Object
12 13 14 15 16 |
# File 'lib/flg/shell.rb', line 12 def file(path) pathname = Pathname.new path FileUtils.mkdir_p pathname.dirname.to_s File.open(path, 'w+') end |
#ok(str) ⇒ Object
23 24 25 26 |
# File 'lib/flg/shell.rb', line 23 def ok(str) prompt = TTY::Prompt.new prompt.ok str end |
#prepend_to_file(name, str) ⇒ Object
64 65 66 |
# File 'lib/flg/shell.rb', line 64 def prepend_to_file(name, str) TTY::File.prepend_to_file name, str end |
#remove_file(path) ⇒ Object
68 69 70 |
# File 'lib/flg/shell.rb', line 68 def remove_file(path) TTY::File.remove_file path end |
#say(str) ⇒ Object
18 19 20 21 |
# File 'lib/flg/shell.rb', line 18 def say(str) prompt = TTY::Prompt.new prompt.say str end |
#shell(str, &black) ⇒ Object
7 8 9 10 |
# File 'lib/flg/shell.rb', line 7 def shell(str, &black) cmd = TTY::Command.new cmd.run str, &black end |
#warn(str) ⇒ Object
28 29 30 31 |
# File 'lib/flg/shell.rb', line 28 def warn(str) prompt = TTY::Prompt.new prompt.warn str end |