Skip to content
This repository
Browse code

Start ack support

  • Loading branch information...
commit f48584c3e894e91e4fe9eadb30cb109da807afc1 1 parent a9b947f
Garen Torikian gjtorikian authored
10 plugins-server/cloud9.ide.search/ack
@@ -1287,7 +1287,10 @@ BEGIN {
1287 1287
1288 1288 # CHANGE: we're doing this to provide pattern match support
1289 1289 @ignore_pattern_dirs = (
1290   - '~backup-'
  1290 + '\w+~backup-\d+',
  1291 + '\.c9revisions',
  1292 + '\.architect',
  1293 + '\/node_modules'
1291 1294 );
1292 1295
1293 1296 %mappings = (
@@ -1643,11 +1646,12 @@ sub delete_type {
1643 1646 sub ignoredir_filter {
1644 1647 # CHANGE: provide quick pattern-match fail
1645 1648 foreach my $key (@ignore_pattern_dirs) {
1646   - if ($_ =~ m{\Q$key\E}) {
  1649 + App::Ack::print($key);
  1650 + if ($_ =~ m{$key}) {
  1651 + print($key);
1647 1652 return 0;
1648 1653 }
1649 1654 }
1650   -
1651 1655 return !exists $ignore_dirs{$_} && !exists $ignore_dirs{$File::Next::dir};
1652 1656 }
1653 1657
36 plugins-server/cloud9.ide.search/search.js
@@ -52,6 +52,7 @@ util.inherits(SearchPlugin, Plugin);
52 52 this.init = function() {
53 53 var self = this;
54 54 this.eventbus.on("search::filelist", function(msg) {
  55 + console.log(msg)
55 56 if (msg.type == "shell-start")
56 57 self.processCount += 1;
57 58 else if (msg.type == "shell-exit")
@@ -103,6 +104,7 @@ util.inherits(SearchPlugin, Plugin);
103 104 return false;
104 105
105 106 console.log(args.command + " " + args.join(" "));
  107 + process.exit(1)
106 108 this.options = message;
107 109 var self = this;
108 110 this.pm.spawn("shell", {
@@ -161,8 +163,7 @@ util.inherits(SearchPlugin, Plugin);
161 163 // do the actual replace; intentionally using unescape query here
162 164 " if s/" + options.query + "/" + options.replacement + "/mg" + (!options.casesensitive ? "" : "i" ) + ";'");
163 165
164   - // not sure why (perhaps due to piping?), but args must be redirected to
165   - // bash like this when replacing
  166 + // args must be redirected to bash like this when replacing
166 167 args.unshift(agCmd);
167 168 args = ["-c", args.join(" ")];
168 169 console.log(args)
@@ -238,14 +239,15 @@ util.inherits(SearchPlugin, Plugin);
238 239 this.assembleFileListCommand = function(options) {
239 240 var args;
240 241
241   - if (!useAg) {
242   - args =["--nocolor",
  242 + if (useAg) {
  243 + args = ["--nocolor",
243 244 "-p", path.join(__dirname, ".agignore"), // use the Cloud9 ignore file
244 245 "-U", // skip VCS ignores (.gitignore, .hgignore), but use root .agignore
245 246 "-l", // filenames only
246 247 "-f", // follow symlinks
247   - "--search-binary"] // list binary files
248   -
  248 + "--search-binary", // list binary files
  249 + "-m 1"]; // stop after one
  250 +
249 251 if (options.showHiddenFiles)
250 252 args.push("--hidden");
251 253
@@ -257,20 +259,28 @@ util.inherits(SearchPlugin, Plugin);
257 259 args.command = agCmd;
258 260 }
259 261 else {
260   - args =["--nocolor",
261   - "-l", // filenames only
262   - "--follow", // follow symlinks
263   - "--text", // list text files
264   - "--binary"] // list binary files
  262 + args = ["--nocolor",
  263 + "-l", // filenames only
  264 + "--follow", // follow symlinks
  265 + "--text", // list text files
  266 + "--binary"]; // list binary files
265 267
266   - /* if (options.showHiddenFiles)
  268 + /*
  269 +
  270 + if (options.showHiddenFiles)
267 271 args.push("--hidden");
268 272
269 273 if (options.maxdepth)
270 274 args.push("--depth", options.maxdepth); */
271 275
272 276 args.push(".", options.path);
273   - args.command = ackCmd;
  277 + args.push("</dev/null");
  278 +
  279 + args.unshift(ackCmd);
  280 + args = ["-c", args.join(" ")];
  281 +
  282 + args.command = "bash";
  283 + //args.command = ackCmd;
274 284 }
275 285
276 286 return args;

0 comments on commit f48584c

Please sign in to comment.
Something went wrong with that request. Please try again.