Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

wriggle

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wriggle

  • 1.3.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Wriggle

A simple directory crawler DSL.

Usage

require 'wriggle'

wriggle '/path/to/files' do |w|
  # Print a list of files
  w.file { |path| puts path }

  # Build a list of Rails controller files
  controllers = []
  w.files /_controller\.rb/ do |path|
    controllers << path
  end

  # Print the path of any file named "spec_helper.rb"
  w.file 'spec_helper.rb' { |path| puts path }

  # Build an array of Ruby code files
  ruby_files = []
  w.extension :rb do |path|
    ruby_files << path
  end

  # Build an array of video files
  video_files = []
  w.extensions %w(mpg mpeg wmv avi mkv) do |path|
    video_files << path
  end

  # Delete directories that are empty
  w.directories do |path|
    Dir.rmdir(path) unless Dir.entries(path).length > 2
  end

  # Print a list of directories matching "foo"
  # NOTE: Matches "/baz/bar/foo" and "/foo" but not "/foo/bar/baz"
  w.directory /foo/ { |path| puts path }
end

Note on Patches/Pull Requests

  • Fork
  • Code
  • Commit
  • Push
  • Pull Request

Copyright (c) 2010 Robert Speicher. See LICENSE for details.

FAQs

Package last updated on 09 Mar 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc