Skip to content

Commit 8bc45a2

Browse files
committed
fix Utils
1 parent d5a5bd0 commit 8bc45a2

4 files changed

Lines changed: 9 additions & 8 deletions

File tree

lib/compiler.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def init_options
119119

120120
if @options[:npm_package]
121121
@options[:npm_package_version] ||= 'latest'
122-
@npm_package = NpmPackage.new(@options)
122+
@npm_package = NpmPackage.new(@options, @utils)
123123
end
124124

125125
if @options[:auto_update_url] || @options[:auto_update_base]

lib/compiler/npm_package.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@ class NpmPackage
1515
attr_reader :work_dir
1616
attr_reader :package_json
1717

18-
def initialize(options)
18+
def initialize(options, utils)
1919
@module_name = options[:npm_package]
2020
@module_version = options[:npm_package_version]
2121
@work_dir = File.expand_path("#{@module_name}-#{@module_version}", options[:tmpdir])
22+
@utils = utils
2223
end
2324

2425
def stuff_tmpdir
25-
Utils.rm_rf(@work_dir)
26-
Utils.mkdir_p(@work_dir)
27-
Utils.chdir(@work_dir) do
26+
@utils.rm_rf(@work_dir)
27+
@utils.mkdir_p(@work_dir)
28+
@utils.chdir(@work_dir) do
2829
File.open("package.json", "w") do |f|
2930
package = %Q({"dependencies": {"#{@module_name}": "#{@module_version}"}})
3031
f.puts package

lib/compiler/utils.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ def mkdir_p(x)
6868
def remove_dynamic_libs(path)
6969
['dll', 'dylib', 'so'].each do |extname|
7070
Dir["#{path}/**/*.#{extname}"].each do |x|
71-
Utils.rm_f(x)
71+
self.rm_f(x)
7272
end
7373
end
7474
end
7575

7676
def copy_static_libs(path, target)
7777
['lib', 'a'].each do |extname|
7878
Dir["#{path}/*.#{extname}"].each do |x|
79-
Utils.cp(x, target)
79+
self.cp(x, target)
8080
end
8181
end
8282
end

tests/node-compiler-ram

0 commit comments

Comments
 (0)