Permalink
Browse files

adding comment to the top of the built file. There might be a better …

…solution but it's working just fine.
  • Loading branch information...
fabiomcosta committed Jul 26, 2010
1 parent 83bde9a commit 4ac82e3cc0768f1e57e258b7a574065c0b6590c5
Showing with 41 additions and 10 deletions.
  1. +6 −6 Build/Meio.Mask.js
  2. +18 −0 Build/Meio.Mask.min.js
  3. +17 −4 build.py
View
@@ -303,7 +303,7 @@ Meio.Mask.extend({
return rules;
})());
-
+
/*
---
@@ -557,7 +557,7 @@ Meio.Mask.createMasks('Fixed', {
'Time' : {mask: '2h:59'},
'Cc' : {mask: '9999 9999 9999 9999'}
});
-
+
/*
---
@@ -735,7 +735,7 @@ Meio.Mask.createMasks('Reverse', {
'Reais' : {symbol: 'R$ ' },
'Dollar' : {symbol: 'US$ ', thousands: ',', decimal: '.'}
});
-
+
/*
---
@@ -802,7 +802,7 @@ Meio.Mask.Repeat = new Class({
}
});
-
+
/*
---
@@ -879,7 +879,7 @@ Meio.Mask.createMasks('Regexp', {
'Ip' : {regex: /^(\d{0,3}\.){0,3}(\d{0,3})?$/},
'Email' : {regex: /^[\w.!#$%&'*+=?~^_`{|}\/-]*@?[.\w-]*$/}
});
-
+
/*
---
@@ -992,4 +992,4 @@ provides: [Meio.Mask.Extras]
};
})();
-
+
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-import os
+import os, re
from zipfile import ZipFile, BadZipfile
class Builder:
@@ -24,13 +24,13 @@ def add_files(self, list_name, files, root='', path='', extension=''):
getattr(self, list_name).append((files, root + path + files + extension))
def read_file(self, _file):
- f = open(_file,'r')
+ f = open(_file, 'r')
ret = []
try:
ret = f.readlines()
finally:
f.close()
- ret.append('\r\n')
+ ret.append('\n')
return ret
def create_built_file(self):
@@ -43,10 +43,23 @@ def create_built_file(self):
built_file.close()
print '** Succesfully created "' + file_name + '" file. **'
+ def add_comment(self, compressed_file):
+ try:
+ os.remove(compressed_file)
+ except os.error:
+ pass # might have been yet removed
+ compressed_built_file = open(compressed_file, 'w+')
+ try:
+ compressed_built_file.write(re.search(r'\/\*(.*?)\*\/', ''.join(self.read_file(self.javascript_files[0][1])), re.S | re.U).group(0))
+ compressed_built_file.write('\n')
+ finally:
+ compressed_built_file.close()
+
def create_minified_file(self):
uncompressed_file = self.build_folder + self.file_name + self.extension
compressed_file = self.build_folder + self.file_name + '.' + self.minify_posfix + self.extension
- os.system('java -jar Assets/yui.jar --warn --charset utf8 %(uncompressed)s > %(compressed)s' % {
+ self.add_comment(compressed_file)
+ os.system('java -jar Assets/yui.jar --warn --charset utf8 %(uncompressed)s >> %(compressed)s' % {
'uncompressed': uncompressed_file,
'compressed': compressed_file
})

0 comments on commit 4ac82e3

Please sign in to comment.