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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4d3096ea3f1adec65ee0636128a9b4ed1b15cd1
4
- data.tar.gz: cad88f51ec22da19af61dbf38bbe76844c88c766
3
+ metadata.gz: a2e73181dc855e960e76b3b2ff54ff78f89b6f94
4
+ data.tar.gz: 73d0131e82493cbcd5c2188209767750e07ace27
5
5
  SHA512:
6
- metadata.gz: 21ceb83b6e0eadcc577ca943e2ef3195dd647d0712b2dfdf5f33e64ac6f0cb4869a6acf7bf0a9c92109f28415be8d8596c837aee7542316a04431db955777356
7
- data.tar.gz: 6952522234f41566154e513b99e01490b3908f4c34d5c05526f0f855d9b8ae950eec8afc8060a860c7c00e45c6b6fba71fee32cd748733e58af0cf8af7bddd9b
6
+ metadata.gz: a3fb65e7061cd3c110765ec631032c2ec65eca45ea6e1a0bbf0cf7ba6b3c2a233b8f65bfc94aa94a2663f63dcfd1253a2577ec2ac6fb0aa06eb58b31f9f8c6e0
7
+ data.tar.gz: 170e80b5948a151b161126627bf990eea0f603324b843891ed8dc1a445123d4a2616cbe232be4b9593113f116d7aa58ab17ff3b42ee0e7786614ceb9f6e8dfe8
@@ -34,8 +34,9 @@ module JsSourcemap
34
34
  puts ">>> Directory #{env.sources_dir} doesn't exist"
35
35
  return
36
36
  end
37
- count = Find.find(env.sources_dir).count
38
- Find.find(env.sources_dir).each_with_index do |file, i|
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
- create_min_map_gz(smo,uglified,source_map)
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)*1000} milliseconds"
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" and !(file=~/-original\.js/))
58
+ return (File.extname(file) == ".js")
57
59
  end
58
60
 
59
- def create_min_map_gz(smo, min_content,sourcem_content)
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
- gz_file = "#{smo["minified_file_path"]}"
71
- puts "=> gzip minified file: #{gzname(gz_file)}"
72
- %x(gzip -c -9 "#{gz_file}" > "#{gzname(gz_file)}") if compress?(gz_file)
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)
@@ -1,3 +1,3 @@
1
1
  module JsSourcemap
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
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.5
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-14 00:00:00.000000000 Z
11
+ date: 2015-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: uglifier