Guest User

Untitled

a guest
Jul 22nd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #!/usr/bin/ruby
  2. require 'pathname'
  3. proj_dir = Pathname.new(ENV['TM_PROJECT_DIRECTORY'])
  4. file_path = Pathname.new(ENV['TM_FILEPATH'])
  5. path = file_path.relative_path_from(proj_dir).to_s
  6. module_name = path.gsub(/\.js$/,'')
  7. class_name = (module_name.split('/').last.capitalize.gsub(/_(\w)/) {|str| $1.upcase})
  8. puts "define('#{module_name}',[],function() {
  9. var #{class_name} = function() {
  10. $1
  11. }
  12. #{class_name}.prototype = {
  13.  
  14. }
  15. return #{class_name}
  16. })"
Add Comment
Please, Sign In to add comment