-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate.rb
More file actions
executable file
·31 lines (29 loc) · 854 Bytes
/
create.rb
File metadata and controls
executable file
·31 lines (29 loc) · 854 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/ruby
# coding: utf-8
def createFile(outPath, tools = 'm')
oriPath = "/Users/chiba/Dropbox/Script/Module" + File.extname(outPath)
if !File.file?("./#{outPath}")
extName = File.extname(outPath)
if extName == '.v' or \
extName == '.cpp' or \
extName == '.cc' or \
extName == '.py' or \
extName != '.rb'
`cp #{oriPath} #{outPath}`
basename = File.basename(outPath, '.*')
if File.extname(outPath) == '.v'
`echo '' >> #{outPath}`
`echo 'module #{basename}(' >> #{outPath}`
`echo '\t' >> #{outPath}`
`echo ');' >> #{outPath}`
`echo '\t' >> #{outPath}`
`echo 'endmodule' >> #{outPath}`
`echo '' >> #{outPath}`
end
end
end
if tools == 'v'
exec "vim #{outPath}"
end
end
createFile(ARGV[0].to_s, ARGV[1])