toggledots 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in toggledots.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,22 @@
1
+ toggledots
2
+ ==========
3
+
4
+ Show and hide hidden files in OS X's Finder.
5
+
6
+ ## Install
7
+
8
+ gem install toggledots
9
+
10
+ ## Usage
11
+
12
+ Once installed you can change the visibility of the dot-files by simply running `toggledots`
13
+
14
+ toggledots
15
+ # Hidden files will be visible.
16
+
17
+ toggledots
18
+ # Now they're hidden once again.
19
+
20
+ toggledots --help
21
+
22
+ Copyright (c) Chris Mytton
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
data/bin/toggledots ADDED
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env ruby
2
+ require 'optparse'
3
+
4
+ module ToggleDots
5
+ class << self
6
+ def run
7
+ # Parse the command line options
8
+ @options = {}
9
+ OptionParser.new do |opts|
10
+ opts.banner = 'Usage: toggledots [options]'
11
+ opts.on('-v', '--[no-]verbose', "Run Verbosely") do |v|
12
+ @options[:verbose] = v
13
+ end
14
+ opts.on_tail('-h', '--help', 'Show this message') do
15
+ puts opts
16
+ exit
17
+ end
18
+ end.parse!
19
+ toggle
20
+ end
21
+
22
+ def toggle
23
+ # Check what state the (com.apple.finder, AppleShowAllFiles) setting is in
24
+ case current_state
25
+ when ""
26
+ puts 'Adding domain/default pair (com.apple.finder, AppleShowAllFiles)'
27
+ show_hidden
28
+ when "FALSE"
29
+ show_hidden
30
+ when "TRUE"
31
+ hide_hidden
32
+ end
33
+ restart_finder
34
+ end
35
+
36
+ def current_state
37
+ `defaults read com.apple.finder AppleShowAllFiles`.chomp
38
+ end
39
+
40
+ def show_hidden
41
+ `defaults write com.apple.finder AppleShowAllFiles TRUE`
42
+ message :shown
43
+ end
44
+
45
+ def hide_hidden
46
+ `defaults write com.apple.finder AppleShowAllFiles FALSE`
47
+ message :hidden
48
+ end
49
+
50
+ def message state
51
+ puts "Dot files are now #{state} in Finder" if @options[:verbose]
52
+ end
53
+
54
+ def restart_finder
55
+ `killall Finder`
56
+ end
57
+ end
58
+ end
59
+
60
+ ToggleDots.run
@@ -0,0 +1,16 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "toggledots"
5
+ s.version = '0.0.1'
6
+ s.platform = Gem::Platform::RUBY
7
+ s.authors = ["Chris Mytton"]
8
+ s.email = ["self@hecticjeff.net"]
9
+ s.homepage = "https://github.com/hecticjeff/toggledots"
10
+ s.summary = %q{Toggle the display of invisible files in OSX's Finder.app}
11
+ s.description = %q{Show and hide the hidden files in OSX from the command line.}
12
+
13
+ s.files = `git ls-files`.split("\n")
14
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
15
+ s.require_paths = ["lib"]
16
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: toggledots
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Chris Mytton
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-06-16 00:00:00 +01:00
14
+ default_executable:
15
+ dependencies: []
16
+
17
+ description: Show and hide the hidden files in OSX from the command line.
18
+ email:
19
+ - self@hecticjeff.net
20
+ executables:
21
+ - toggledots
22
+ extensions: []
23
+
24
+ extra_rdoc_files: []
25
+
26
+ files:
27
+ - .gitignore
28
+ - Gemfile
29
+ - README.md
30
+ - Rakefile
31
+ - bin/toggledots
32
+ - toggledots.gemspec
33
+ has_rdoc: true
34
+ homepage: https://github.com/hecticjeff/toggledots
35
+ licenses: []
36
+
37
+ post_install_message:
38
+ rdoc_options: []
39
+
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: "0"
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ requirements: []
55
+
56
+ rubyforge_project:
57
+ rubygems_version: 1.6.2
58
+ signing_key:
59
+ specification_version: 3
60
+ summary: Toggle the display of invisible files in OSX's Finder.app
61
+ test_files: []
62
+