{"id":15339888,"url":"https://github.com/jbampton/ruby-strip","last_synced_at":"2026-04-17T11:32:02.052Z","repository":{"id":90825874,"uuid":"44579500","full_name":"jbampton/ruby-strip","owner":"jbampton","description":"Strip leading and trailing white space (whitespace) from any folder of files - Ruby command line application","archived":false,"fork":false,"pushed_at":"2018-01-01T22:33:32.000Z","size":10245,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"gh-pages","last_synced_at":"2025-06-18T13:51:54.490Z","etag":null,"topics":["command-line-tool","fileutils","homebrew","imagemagick","man-page","osx","ruby","rvm","whitespace","windows"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jbampton.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-10-20T03:20:40.000Z","updated_at":"2019-12-26T14:00:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"b8e5c74d-6118-49cb-9570-3059b7f98da7","html_url":"https://github.com/jbampton/ruby-strip","commit_stats":{"total_commits":114,"total_committers":1,"mean_commits":114.0,"dds":0.0,"last_synced_commit":"6af38f3d03e8595de749e5cebb6d42a7c3c70b8f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jbampton/ruby-strip","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbampton%2Fruby-strip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbampton%2Fruby-strip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbampton%2Fruby-strip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbampton%2Fruby-strip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jbampton","download_url":"https://codeload.github.com/jbampton/ruby-strip/tar.gz/refs/heads/gh-pages","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbampton%2Fruby-strip/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31927745,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T10:35:34.458Z","status":"ssl_error","status_checked_at":"2026-04-17T10:35:09.472Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["command-line-tool","fileutils","homebrew","imagemagick","man-page","osx","ruby","rvm","whitespace","windows"],"created_at":"2024-10-01T10:31:19.095Z","updated_at":"2026-04-17T11:32:02.037Z","avatar_url":"https://github.com/jbampton.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ruby white space strip command line application\n\nThis program uses **[Ruby Power](https://www.ruby-lang.org/en/documentation/success-stories/)** to strip whitespace from files, and the accompanying documentation provided aims at being an easy to follow tutorial on all things **[Ruby](https://www.ruby-lang.org/en/)**.  All the links in this README.md briefly explain some of the **[Ruby](https://github.com/ruby/ruby)** topics discussed.\n\nWait until this webpage fully loads and if you want to jump ahead, choose your topic below:\n\n - [OS X](#os-x-instructions)\n - [OS X installation requirements](#os-x-installation-requirements)\n - [RVM](#rvm-usage)\n - [Homebrew](#homebrew-usage)\n - [Windows](#windows-instructions)\n - [Resources used on this project and helpful links](#resources-used-on-this-project-and-helpful-links)\n - [List of Ruby](#list-of-ruby)\n - [Contributions](#contributions)\n\n[Matz](https://twitter.com/matz_translated) made Ruby fun to learn so come and check out the [Ruby in 4 seconds](https://youtu.be/ayx4fASYkZU) video.\n\nFor those of you who don't know much about [Ruby](http://ruby-doc.org)...\n\nHere's [Ruby Power](http://skillcrush.com/2015/02/02/37-rails-sites/) in five seconds from [Ruby Wikipedia](https://en.wikipedia.org/wiki/Ruby_\\(programming_language\\))\n\n**[Ruby](http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=59579)** was accepted as a [Japanese Industrial Standard](https://en.wikipedia.org/wiki/Japanese_Industrial_Standards) (JIS X 3017) in 2011[25] and an [international standard](http://www.iso.org/iso/home.html) (ISO/IEC 30170) in 2012.\n\nRuby is growing in popularity and is currently ranked 13th on the [TIOBE Index](http://www.tiobe.com/tiobe_index).\n\nThis program runs on the [command line](https://en.wikipedia.org/wiki/Command-line_interface) and accepts a single [parameter](https://en.wikipedia.org/wiki/Parameter_\\(computer_programming\\)), a folder [path](https://en.wikipedia.org/wiki/Path_\\(computing) name.\n\nIt checks this folder [recursively](https://en.wikipedia.org/wiki/Recursion) through all sub folders and files for leading and trailing [whitespace](https://en.wikipedia.org/wiki/Whitespace_character).\n\nIt removes all the excess leading and trailing whitespace and [copies](https://en.wikipedia.org/wiki/Copy_\\(command\\)) the folder contents to this projects 'output' [directory](https://en.wikipedia.org/wiki/Directory_\\(computing).\n\nSo far it has been checked against these [file formats](https://en.wikipedia.org/wiki/File_format):\n\n    - *.c\n    - *.xml\n    - *.xsl\n    - *.txt\n    - *.php\n    - *.html\n    - *.py\n    - *.css\n    - *.rb\n    \n    \nComing from a [PHP](http://php.net) background where leading and trailing white space can sometimes be [problematic](https://www.google.com.au/search?client=opera\u0026q=php+leading+whitespace+problem\u0026sourceid=opera\u0026ie=UTF-8\u0026oe=UTF-8) I thought it would be \ninteresting to build a command line tool in Ruby (my first command line tool in Ruby)\n    \nTo run simply clone this repo and then open a terminal and navigate to the directory where you cloned to.\n\nThen simply run: ruby ruby_strip.rb path/to/folder \n\nThis should copy the folder to the 'output' directory.  There are currently two test folders for input and output.\n\nThe two commands that were run to produce the sample output were:\n\n  - ```ruby ruby_strip.rb php-test-files``` \n\n  - ```ruby ruby_strip.rb random-test-files```\n  \nIf you are still to afraid to dive in and try Ruby, how about some easy free web based interactive courses on basic tech:\n\n- [Try Ruby](http://tryruby.org/levels/1/challenges/0) \n- [Codecademy Ruby](https://www.codecademy.com/learn/ruby) \n- [Learn the command line](https://www.codecademy.com/learn/learn-the-command-line)\n- [Try Git](https://www.codeschool.com/courses/try-git)\n- [Learn Git](https://www.codecademy.com/learn/learn-git)\n\nAnd then come train in the [REAL DOJO](http://www.codewars.com) and reach your highest potential, become **faster**, **stronger** and **more powerful**......**JEDI MASTER LEVEL**.....**!??!?!!**  \n\nSo now that you are **Ruby Gung-Ho**, the new Ruby [Bruce Lee](https://en.wikipedia.org/wiki/Bruce_Lee) on the street, try the instructions below.\n\n[\u0026#8593;](#ruby-white-space-strip-command-line-application) [\u0026#8595;](#contributions)\n\n# OS X instructions\n\n[Matz](https://en.wikipedia.org/wiki/Yukihiro_Matsumoto) made Ruby easy to learn, so don't be worried and first check out a short Ruby YouTube video I created.\n\n[Ruby in 29 seconds](https://youtu.be/2ei7S0FU65E)\n\nMost Macs have Ruby preinstalled so lets see if its installed on your machine, open a terminal and type:\n\n### ruby -v\n\n![ruby -v](documentation/images/terminal/ruby/ruby-v.png)\n\nTo find out more about Ruby type:\n\n### ruby --help\n\n![ruby --help](documentation/images/terminal/ruby/ruby--help.png)\n\n[man pages](https://en.wikipedia.org/wiki/Man_page) contain a lot of information about programs.\n\n### man ruby\n\n![man ruby](documentation/images/terminal/ruby/man-ruby.png)\n\nYou can use the up and down arrows to navigate through the man page or press q to exit.\n\nRuby also ships with 'ri' a tool used to display information about Ruby Classes, modules and methods from your terminal\n\nA lot of people don't know 'ri' exists and use google search instead.\n\n### man ri\n\n![man ri](documentation/images/terminal/ruby/man-ri.png)\n\nRuby also ships with a fantastic tool called IRB.  IRB is the interactive Ruby console where you can test out your Ruby commands inside a terminal.  Watch a [short video on Youtube](https://www.youtube.com/watch?v=CpFgz5Iq3qA) that I made on IRB.\n\n### man irb\n\n![man irb](documentation/images/terminal/ruby/man-irb.png)\n\nAnd to use IRB type:\n\n### irb\n\n![irb](documentation/images/terminal/ruby/irb.png)\n\nYou type 'exit' to stop using irb and return to the standard terminal.\n\nYou can add 'tab' completion to irb by creating a .irbrc file\n\nYou can use the nano editor to create this by entering:\n\n### nano .irbrc\n\nThen entering the next line:\n\n### require 'irb/completion'\n\n[\u0026#8593;](#ruby-white-space-strip-command-line-application) [\u0026#8595;](#contributions)\n\n\n## OS X installation requirements\n\n - Homebrew\n - Imagemagick\n - Bundler - not a fixed requirement\n - fileutils, rubocop gems \n\nI used [Homebrew](http://brew.sh) to install imagemagick.  Homebrew is the missing package manager for OS X.  It installs the stuff you need that Apple didn't. There is a short Homebrew usage section towards the bottom of this README.\n\nUnder the hood Homebrew and [Homebrew formula](http://brewformulas.org) are all Ruby.  For example with Homebrew I installed [Wine](https://www.winehq.org) and then was able to get [Notepad++](https://notepad-plus-plus.org/) running on OS X....\n\nThe command to install imagemagick with Homebrew would be:\n\n### brew install imagemagick\n\n![brew install imagemagick](documentation/images/terminal/homebrew/brew-install-imagemagick.png)\n\nThe code uses two RubyGems, [fileutils](https://rubygems.org/gems/fileutils) and [rubocop](https://github.com/bbatsov/rubocop) so you must install them, if not already installed.\n\nThe 'fileutils' gem requires the [rmagick](https://rubygems.org/gems/rmagick) gem to be installed which requries [imagemagick](http://www.imagemagick.org/script/index.php) to be installed.\n\n![gem dependency](documentation/images/terminal/ruby/gem-dependency.png)\n\nYou can either install [Bundler](http://bundler.io/) which will install the required gems from the Gemfile or install the required gems manually.\n\nUsing bundler run:\n\n### gem install bundler\n\nI've added a Gemfile so you can use bundler from this projects directory to run:\n\n### bundle install\n\nwhich will install the required gems.\n\nAlternatively if not using bundler open a terminal and type: \n\n### gem install rubocop\n\nand\n\n### gem install fileutils\n\n[\u0026#8593;](#ruby-white-space-strip-command-line-application) [\u0026#8595;](#contributions)\n\n\n## Gem commands \n\nTo see the current Gems that are installed on your system type: \n\n### gem list --local  \n\n![gem install fileutils](documentation/images/terminal/ruby/gem-install-fileutils.png)\n\nAnother way to see the installed gems is to type: \n\n### gem server\n\n![gem server](documentation/images/terminal/ruby/gem-server.png)\n\nThis will bring up a locally served web page at http://localhost:8808/ listing information about all the gems.\n\n![gem server webpage](documentation/images/terminal/ruby/gem-server-webpage.png)\n\nType: \n\n### gem -h  \n\nfor more information on the gem command.\n\n![gem -h](documentation/images/terminal/ruby/gem-h.png)\n\nAnother important gem command is:\n\n### gem help commands\n\n![gem help commands](documentation/images/terminal/ruby/gem-help-commands.png)\n\nwhich leads us to:\n\n### gem update\n\n![gem update](documentation/images/terminal/ruby/gem-update.png)\n\nDepending on number of gems installed, your gem update maybe shorter and I have not displayed the full output from the command.\n\n[\u0026#8593;](#ruby-white-space-strip-command-line-application) [\u0026#8595;](#contributions)\n\n\n## RVM Usage\n\nRVM is the Ruby Version Manager and it's developed mainly by [Michael Papis](https://github.com/mpapis) on GitHub at https://github.com/rvm/rvm.\n \nRVM is a command line tool which allows you to easily install, manage and work with multiple ruby environments or multiple ruby versions so that you can mirror the servers environment.\n\nTo find out more about RVM open a terminal and type:\n\n### man rvm\n\n![man rvm](documentation/images/terminal/rvm/man-rvm.png)\n\nAlso you should enter the following command:\n\n### rvm version\n\n![rvm version](documentation/images/terminal/rvm/rvm-version.png)\n \nYou will also want to keep rvm update to date so run:\n \n### rvm get stable\n\n![rvm get stable](documentation/images/terminal/rvm/rvm-get-stable.png) \n\n### rvm list known\n\n![rvm list known](documentation/images/terminal/rvm/rvm-list-known.png)\n\n### ruby -v \n\n![ruby -v](documentation/images/terminal/ruby/ruby-v.png)\n\nThis will print the current default system installed ruby version.\n\nTo install a new Ruby inside rvm, type:\n\n### rvm install ruby-2.2.1\n\n![rvm install ruby 2.2.1](documentation/images/terminal/rvm/rvm-install-ruby-2.2.1.png)\n\nEntering the next command will show which Rubies are installed inside RVM\n\n### rvm list\n\n![rvm list](documentation/images/terminal/rvm/rvm-list.png)\n\nFollowed by: \n\n### ruby -v\n\n![rvm ruby -v](documentation/images/terminal/rvm/rvm-ruby-v.png)\n\nYou can see the the RVM installed Ruby is now the system default.\n\nIf you would like to switch back to the original system installed Ruby type:\n\n### rvm use system\n\n### ruby -v\n\n![rvm use system](documentation/images/terminal/rvm/rvm-use-system.png)\n\nTo switch back to using an RVM Ruby type:\n\n### rvm use ruby-2.2.1\n\n### ruby -v\n\n![rvm use ruby-2.2.1](documentation/images/terminal/rvm/rvm-use-ruby-2.2.1.png)\n\nYou can also enter: \n\n### which ruby\n\n![which ruby](documentation/images/terminal/ruby/which-ruby.png)\n\nYou can read more about the which command by entering:\n\n### man which\n\n![man which](documentation/images/terminal/general/man-which.png)\n\n[\u0026#8593;](#ruby-white-space-strip-command-line-application) [\u0026#8595;](#contributions)\n\n\n## Homebrew usage\n\n[Homebrew](http://brew.sh) is an amazing package management system that installs the stuff you need that Apple didn't.\n\n[Homebrew Formula](http://brewformulas.org) are written in Ruby.\n\nA made a [video on Homebrew](https://www.youtube.com/watch?v=IonWEFStPio) which runs for under minute that shows the typical brew update command.\n\nIf you install Homebrew you should try to run brew update daily.\n\nOnce you have installed Homebrew you can run through the basic commands below.\n\nOpen a terminal and type:\n\n### man brew\n![man brew](documentation/images/terminal/homebrew/man_brew.png)\n\n**Before using Homebrew you should ensure it's up to date. Run the next command:**\n\n### brew doctor\n![brew doctor](documentation/images/terminal/homebrew/brew_doctor.png)\n\n## brew update\n![brew update](documentation/images/terminal/homebrew/brew_update.png)\n\n### brew list\n![brew list](documentation/images/terminal/homebrew/brew_list.png)\n\n[\u0026#8593;](#ruby-white-space-strip-command-line-application) [\u0026#8595;](#contributions)\n\n\n# Windows instructions\n\nTo run this program on Windows you will need to install the following software in this order:\n\n - RubyInstaller\n - Ruby DevKit\n - Imagemagick\n - Bundler - optional\n - fileutils and rubocop gems\n \nYou can use the RubyInstaller for Windows - http://rubyinstaller.org/ to install Ruby.\n\nBefore using the RubyInstaller you should check the integrity of the RubyInstaller against its hash on https://bintray.com/oneclick/rubyinstaller/rubyinstaller\n\nTo do this on windows you can use the builtin Windows CertUtil command.\n\nAfter you have installed Ruby try out the next two commands:\n\n### ruby -v\n\n![ruby -v](documentation/images/windows/ruby-v.png)\n\n### ruby -h\n\n![ruby -h](documentation/images/windows/ruby-h.png)\n\nInteractive Ruby Shell or IRB should also be installed as seen below\n\n### irb \n\n![irb](documentation/images/windows/irb.png)\n\nNext you will have to install the Ruby DevKit and then Imagemagick followed by the fileutils RubyGem.\n\nYou can download Imagemagick at http://www.imagemagick.org/script/index.php and if you like you can watch the [ImageMagick Windows installation video](https://www.youtube.com/watch?v=bKWDZb_Nkpo) on Youtube.\n\nWhen you are installing Imagemagick on the - Select Additional Tasks page of the installer, check the box for Install development headers and libraries for C and C++.\n\nThe following images show the steps in the ImageMagick Windows installation.\n\n![Imagemagick installer page 1](documentation/images/windows/imagemagick/imagemagick1.png)\n\n![Imagemagick installer page 2](documentation/images/windows/imagemagick/imagemagick2.png)\n\n![Imagemagick installer page 3](documentation/images/windows/imagemagick/imagemagick3.png)\n\n![Imagemagick installer page 4](documentation/images/windows/imagemagick/imagemagick4.png)\n\n![Imagemagick installer page 5](documentation/images/windows/imagemagick/imagemagick5.png)\n\n![Imagemagick installer page 6](documentation/images/windows/imagemagick/imagemagick6.png)\n\n![Imagemagick installer page 7](documentation/images/windows/imagemagick/imagemagick7.png)\n\n![Imagemagick installer page 8](documentation/images/windows/imagemagick/imagemagick8.png)\n\n![Imagemagick installer page 9](documentation/images/windows/imagemagick/imagemagick9.png)\n\nNext you will need to install the \"fileutils\" gem\n\nSince this project has a Gemfile, the easiest way to install the projects requirements is to run:\n\n### bundle install\n\nOtherwise you can install the gems manually by:\n\n### gem install fileutils\n\n### gem install rubocop\n\n[\u0026#8593;](#ruby-white-space-strip-command-line-application) [\u0026#8595;](#contributions)\n\n## Additional gem commands\n\nTo see the current Gems that are installed on your system type: \n\n### gem list \n\n![gem install and gem list](documentation/images/windows/gem-install-gem-list.png)\n\n### gem dependency fileutils\n\n![gem dependency fileutils](documentation/images/windows/gem-dependency-fileutils.png)\n\nTo bring up more information on the gem command type:\n\n### gem -h\n\n![gem -h](documentation/images/windows/gem-h.png)\n\n[\u0026#8593;](#ruby-white-space-strip-command-line-application) [\u0026#8595;](#contributions)\n\n\n## Resources used on this project and helpful links\n\nRuby Programming Language - https://www.ruby-lang.org/en/\n\nRuby Doc - http://ruby-doc.org-doc.org\n\nRuby the ISO - http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=59579\n\nThe Ruby Toolbox - https://www.ruby-toolbox.com/\n\nRubyInstaller for Windows - http://rubyinstaller.org/\n\nHomebrew — The missing package manager for OS X - http://brew.sh/\n\nHomebrew formula - http://brewformulas.org\n\nJetBrains RubyMine - https://www.jetbrains.com/ruby/\n\nRuby Version Manager (RVM) - https://rvm.io/\n\nRuby regular expression editor - http://rubular.com/\n\nInstalling Ruby - https://www.ruby-lang.org/en/documentation/installation/   \n\nRuby success stories - https://www.ruby-lang.org/en/documentation/success-stories/\n\nRuby Motion success stories - http://www.rubymotion.com/references/success-stories/\n\nThe Top Ruby Jobs - https://toprubyjobs.com/\n\nAustralian companies using Rails - https://github.com/rails-oceania/roro/wiki/Australian-Companies-using-Ruby-on-Rails\n\nCodecademy - Learn the Command Line - https://www.codecademy.com/courses/learn-the-command-line\n\nCodecademy - Learn Ruby - https://www.codecademy.com/learn/ruby\n\nCodeSchool - Got 15 minutes and want to learn Git? https://try.github.io/levels/1/challenges/1\n\nCodeSchool Try Ruby - https://www.codeschool.com/courses/try-ruby\n\nIDE - Integrated Development Environment - https://en.wikipedia.org/wiki/Integrated_development_environment\n\nGit (software) - https://en.wikipedia.org/wiki/Git_(software)\n\nman page - https://en.wikipedia.org/wiki/Man_page\n\nTerminal (OS X) - https://en.wikipedia.org/wiki/Terminal_(OS_X)\n\nEssential programmer training - http://www.codewars.com/\n\nMastering Markdown - https://guides.github.com/features/mastering-markdown/\n\nImageMagick - http://www.imagemagick.org/script/index.php\n\nWine - https://www.winehq.org\n\nPHP - http://php.net\n\nOne-Click rubyinstaller and DevKit - https://bintray.com/oneclick/rubyinstaller\n\nMinGW - Minimalist GNU for Windows - http://www.mingw.org/\n\nBundler RubyGem - http://bundler.io/\n\nfileutils RubyGem - https://rubygems.org/gems/fileutils/\n\nRuboCop RubyGem - https://github.com/bbatsov/rubocop\n\n[\u0026#8593;](#ruby-white-space-strip-command-line-application) [\u0026#8595;](#contributions)\n\n\n## List of Ruby\n\nhttps://github.com/ruby/ruby\n\nhttps://twitter.com/matz_translated\n\nhttps://twitter.com/yukihiro_matz\n\nhttps://www.facebook.com/pages/Yukihiro-Matsumoto/109410772411674\n\nhttps://plus.google.com/communities/101878695540653445908\n\n[\u0026#8593;](#ruby-white-space-strip-command-line-application) [\u0026#8595;](#contributions)\n\n\n## Contributions\nFork and pull request. Simple.\n\n[\u0026#8593;](#ruby-white-space-strip-command-line-application) \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbampton%2Fruby-strip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjbampton%2Fruby-strip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbampton%2Fruby-strip/lists"}