From fcd76d89ee623b12a46e9c55603477bd9cbe785c Mon Sep 17 00:00:00 2001 From: Adam Sanderson Date: Thu, 30 Dec 2010 12:52:16 -0700 Subject: [PATCH] Adding support for node.js --- lib/qwandry/configuration/default.rb | 11 +++++++++++ lib/qwandry/configuration/probe_node.js | 4 ++++ 2 files changed, 15 insertions(+) create mode 100644 lib/qwandry/configuration/probe_node.js diff --git a/lib/qwandry/configuration/default.rb b/lib/qwandry/configuration/default.rb index 615e374..7c6b208 100644 --- a/lib/qwandry/configuration/default.rb +++ b/lib/qwandry/configuration/default.rb @@ -41,6 +41,17 @@ register :python do add python_paths, :class=>Qwandry::LibraryRepository, :reject => /\.(py[oc])|(egg-info)$/ end +# Add node.js repositories: +register :node do + # Execute a node script to find all of the load paths: + node_script_path = File.join(File.dirname(__FILE__),'probe_node.js') + node_paths = `node #{node_script_path}` rescue '' + + node_paths = node_paths.split("\n") + # Add the python paths, instruct Qwandry to skip any compiled files when trying to match a file/library: + add node_paths +end + # Qwandry is a ruby app after all, so activate ruby and gem by default. Other defaults can be set # with a custom init.rb default :ruby, :gem \ No newline at end of file diff --git a/lib/qwandry/configuration/probe_node.js b/lib/qwandry/configuration/probe_node.js new file mode 100644 index 0000000..a2178bb --- /dev/null +++ b/lib/qwandry/configuration/probe_node.js @@ -0,0 +1,4 @@ +// If anyone knows a way to pipe a one liner into node to do this, +// I'm all ears. +var sys = require('sys') +sys.puts(require.paths.join("\n")) \ No newline at end of file