Changes
This commit is contained in:
6
lib/ensure_dir_exists.rb
Normal file
6
lib/ensure_dir_exists.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
def ensure_dir_exists(directory_path)
|
||||
unless Dir.exist?(directory_path)
|
||||
FileUtils.mkdir_p(directory_path)
|
||||
spawn_toast 'Directory Created', %(Poaster created #{directory_path}.), 10
|
||||
end
|
||||
end
|
3
lib/spawn_input_box.rb
Normal file
3
lib/spawn_input_box.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
def spawn_input_box(title, text)
|
||||
`kdialog --title "#{title}" --inputbox "#{text}"`
|
||||
end
|
7
lib/spawn_radio_list.rb
Normal file
7
lib/spawn_radio_list.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
def spawn_radio_list(title, text, options_arr)
|
||||
command = %(kdialog --title "#{title}" --radiolist "#{text}")
|
||||
options_arr.each_with_index do |option, i|
|
||||
command += %( #{i} "#{option}" off)
|
||||
end
|
||||
`#{command}`
|
||||
end
|
3
lib/spawn_toast.rb
Normal file
3
lib/spawn_toast.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
def spawn_toast(title, text, seconds)
|
||||
`kdialog --title "#{title}" --passivepopup "#{text}" #{seconds}`
|
||||
end
|
5
lib/write_file.rb
Normal file
5
lib/write_file.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
def write_file(directory, name, extension, content)
|
||||
post_file = File.new(%(#{directory}/#{name}.#{extension}), 'w+')
|
||||
post_file.syswrite(content)
|
||||
post_file.close
|
||||
end
|
Reference in New Issue
Block a user