js-sourcemap 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/js-sourcemap/api.rb +14 -9
- data/lib/js-sourcemap/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2e73181dc855e960e76b3b2ff54ff78f89b6f94
|
4
|
+
data.tar.gz: 73d0131e82493cbcd5c2188209767750e07ace27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3fb65e7061cd3c110765ec631032c2ec65eca45ea6e1a0bbf0cf7ba6b3c2a233b8f65bfc94aa94a2663f63dcfd1253a2577ec2ac6fb0aa06eb58b31f9f8c6e0
|
7
|
+
data.tar.gz: 170e80b5948a151b161126627bf990eea0f603324b843891ed8dc1a445123d4a2616cbe232be4b9593113f116d7aa58ab17ff3b42ee0e7786614ceb9f6e8dfe8
|
data/lib/js-sourcemap/api.rb
CHANGED
@@ -34,8 +34,9 @@ module JsSourcemap
|
|
34
34
|
puts ">>> Directory #{env.sources_dir} doesn't exist"
|
35
35
|
return
|
36
36
|
end
|
37
|
-
|
38
|
-
|
37
|
+
files = Dir[File.join(env.sources_dir,"**","*.js")]
|
38
|
+
count = files.count
|
39
|
+
files.each_with_index do |file, i|
|
39
40
|
puts "#{i+1} of #{count} - #{file} ..........."
|
40
41
|
if File.file?(file) and correct_file?(file)
|
41
42
|
smo = source_map_options file
|
@@ -43,20 +44,21 @@ module JsSourcemap
|
|
43
44
|
copy_source(smo)
|
44
45
|
#:source_url => "SourceUrl in minified", :source_map_url => "SourceMappingUrl in minified", :source_filename => "original_file_name_in_map", :source_root=> "lol4", :minified_file_path => "lol5", :input_source_map => "lol6"
|
45
46
|
uglified, source_map = Uglifier.new(:source_map_url => smo["source_map_file_absolute_path"], :source_filename => smo["original_file_absolute_path"]).compile_with_map(File.read(file))
|
46
|
-
|
47
|
+
create_min_map(smo,uglified,source_map)
|
47
48
|
end
|
48
49
|
end
|
49
50
|
end
|
51
|
+
create_js_gz
|
50
52
|
end_time = Time.now
|
51
53
|
puts ".... Completed ......"
|
52
|
-
puts "Time elapsed #{(end_time - beginning_time)
|
54
|
+
puts "Time elapsed #{((end_time - beginning_time)/60.0).round(3)} minutes"
|
53
55
|
end
|
54
56
|
|
55
57
|
def correct_file?(file)
|
56
|
-
return (File.extname(file) == ".js"
|
58
|
+
return (File.extname(file) == ".js")
|
57
59
|
end
|
58
60
|
|
59
|
-
def
|
61
|
+
def create_min_map(smo, min_content,sourcem_content)
|
60
62
|
puts "=> writing minified file : #{smo["minified_file_path"]} ..."
|
61
63
|
f = File.open(smo["minified_file_path"], "w")
|
62
64
|
f.write(min_content)
|
@@ -67,9 +69,12 @@ module JsSourcemap
|
|
67
69
|
f.write(sourcem_content)
|
68
70
|
f.close
|
69
71
|
|
70
|
-
|
71
|
-
|
72
|
-
|
72
|
+
end
|
73
|
+
|
74
|
+
def create_js_gz
|
75
|
+
puts "=> gziping js files"
|
76
|
+
%x(for f in `find "#{env.sources_dir}" -name '*.js'`; do gzip -c -9 "$f" > "$f".gz; done)
|
77
|
+
# %x(gzip -c -9 "#{gz_file}" > "#{gzname(gz_file)}") if compress?(gz_file)
|
73
78
|
end
|
74
79
|
|
75
80
|
def compress?(file)
|
data/lib/js-sourcemap/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: js-sourcemap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jayprakash
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uglifier
|