Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby
- require 'pathname'
- proj_dir = Pathname.new(ENV['TM_PROJECT_DIRECTORY'])
- file_path = Pathname.new(ENV['TM_FILEPATH'])
- path = file_path.relative_path_from(proj_dir).to_s
- module_name = path.gsub(/\.js$/,'')
- class_name = (module_name.split('/').last.capitalize.gsub(/_(\w)/) {|str| $1.upcase})
- puts "define('#{module_name}',[],function() {
- var #{class_name} = function() {
- $1
- }
- #{class_name}.prototype = {
- }
- return #{class_name}
- })"
Add Comment
Please, Sign In to add comment