Create "add" task for adding new domains to Swot
This commit is contained in:
parent
0b285ce515
commit
b664f4979c
12
Rakefile
12
Rakefile
@ -43,3 +43,15 @@ Rake::RDocTask.new do |rdoc|
|
||||
rdoc.rdoc_files.include('README*')
|
||||
rdoc.rdoc_files.include('lib/**/*.rb')
|
||||
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)
|
||||
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}"`
|
||||
end
|
||||
end
|
||||
Loading…
Reference in New Issue
Block a user