add error handling and some output for the user
This commit is contained in:
parent
4c1700429f
commit
c0b22e1a33
9
Rakefile
9
Rakefile
@ -46,12 +46,19 @@ end
|
||||
|
||||
task :add, :sld, :tld, :name do |t, args|
|
||||
file_path = "#{File.expand_path(__FILE__+'/..')}/lib/domains/#{args.tld}/#{args.sld}"
|
||||
unless File.exists?(file_path)
|
||||
if File.exists?(file_path)
|
||||
puts "already exists"
|
||||
elsif
|
||||
begin
|
||||
FileUtils.mkdir_p(File.dirname(file_path))
|
||||
File.open( file_path, "w" ) do |contents|
|
||||
contents.print args.name
|
||||
end
|
||||
`git add #{file_path}`
|
||||
`git commit -m "Add #{args.name}"`
|
||||
puts "commit successful"
|
||||
rescue
|
||||
puts "commit failed"
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in New Issue
Block a user