desktop-boom 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +45 -0
- data/LICENSE +10 -0
- data/README.md +46 -0
- data/bin/boom +148 -0
- data/boom.gemspec +20 -0
- data/lib/boom.rb +2 -0
- data/lib/boom/boom.rb +0 -0
- data/lib/boom/version.rb +3 -0
- metadata +68 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f1ea8bcc636ae95479cbd25a5434628a2f66e225
|
4
|
+
data.tar.gz: 2d1e092e8efa38288166854e3d8d77b64297f66e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 52cc944f2f63ad16871b5ae9e3251395ab1f99591e0e66b094dc18111f1ddb9f072de4e84381d33011648899e0766beb85f759f0f453a4920e103206af762466
|
7
|
+
data.tar.gz: 38a1921f4d8426205e6a6a5f3bd24a312b950318fab0dfccbfbee98ba6888a80bbc80e5420feb451895304bd9b8d74b45947762aa77f92fb186878229d10746d
|
data/.gitignore
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
## Specific to RubyMotion:
|
14
|
+
.dat*
|
15
|
+
.repl_history
|
16
|
+
build/
|
17
|
+
vendor/Pods/
|
18
|
+
*.bridgesupport
|
19
|
+
build-iPhoneOS/
|
20
|
+
build-iPhoneSimulator/
|
21
|
+
|
22
|
+
## Documentation cache and generated files:
|
23
|
+
/.yardoc/
|
24
|
+
/_yardoc/
|
25
|
+
/doc/
|
26
|
+
/rdoc/
|
27
|
+
|
28
|
+
## Environment normalization:
|
29
|
+
/.bundle/
|
30
|
+
/vendor/bundle
|
31
|
+
/lib/bundler/man/
|
32
|
+
|
33
|
+
## Mac
|
34
|
+
.DS_Store
|
35
|
+
|
36
|
+
# for a library or gem, you might want to ignore these files since the code is
|
37
|
+
# intended to run in multiple environments; otherwise, check them in:
|
38
|
+
# Gemfile.lock
|
39
|
+
# .ruby-version
|
40
|
+
# .ruby-gemset
|
41
|
+
|
42
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
43
|
+
.rvmrc
|
44
|
+
|
45
|
+
tags
|
data/LICENSE
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
Copyright (c) 2016, Hwee-Boon Yar
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
5
|
+
|
6
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
7
|
+
|
8
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
9
|
+
|
10
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
About
|
2
|
+
---
|
3
|
+
The (OS X) desktop is very handy for storing files and folders you are currently working on. `Exposé`/`Mission Control`/`Show Desktop` makes the desktop very accessible. But it can get messy as you work on different tasks.
|
4
|
+
|
5
|
+
Enter `boom`. `boom` is a simple tool. You classify your files and folders into "projects" and `boom` helps maintain your OS X desktop by making it contain files and folders for the current project you are working on.
|
6
|
+
|
7
|
+
Usage
|
8
|
+
---
|
9
|
+
A project in `boom` is just a name.
|
10
|
+
|
11
|
+
When you switch projects, the files and folders in the desktop will be kept and tagged with the project's name so it can be restored later by boomboom again.
|
12
|
+
|
13
|
+
Assuming you are current working on project `A`, to switch to the project called `B`, run
|
14
|
+
|
15
|
+
```
|
16
|
+
$ boom B
|
17
|
+
```
|
18
|
+
|
19
|
+
Files and folders in the desktop will be moved away and tagged as belonging to project `A` and the files and folders for project `B` will be moved to the desktop.
|
20
|
+
|
21
|
+
If `B` doesn't exist yet, it will be created.
|
22
|
+
|
23
|
+
Installation
|
24
|
+
---
|
25
|
+
`gem install desktop-boom`
|
26
|
+
|
27
|
+
Dependencies
|
28
|
+
---
|
29
|
+
* [commander](https://github.com/tj/commander)
|
30
|
+
|
31
|
+
Known Limitations
|
32
|
+
---
|
33
|
+
These paths are assumed:
|
34
|
+
|
35
|
+
* Desktop folder is `~/Desktop/`
|
36
|
+
* Projects folder will be created at `~/Documents/boom/`
|
37
|
+
|
38
|
+
License
|
39
|
+
---
|
40
|
+
BSD
|
41
|
+
|
42
|
+
Questions
|
43
|
+
---
|
44
|
+
* Email: [hboon@motionobj.com](mailto:hboon@motionobj.com)
|
45
|
+
* Web: [http://hboon.com/boom/](http://hboon.com/boom/)
|
46
|
+
* Twitter: [https://twitter.com/hboon](https://twitter.com/hboon)
|
data/bin/boom
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'commander/import'
|
5
|
+
require 'fileutils'
|
6
|
+
require 'psych'
|
7
|
+
require 'boom'
|
8
|
+
|
9
|
+
APP_NAME = 'boom'
|
10
|
+
#TODO make configurable?
|
11
|
+
DESKTOP_DIR = File.expand_path('~/Desktop/')
|
12
|
+
#TODO make configurable?
|
13
|
+
PROJECTS_DIRECTORY = "~/Documents/#{APP_NAME}/"
|
14
|
+
HELP_STRING = "#{APP_NAME} helps maintain your OS X desktop. Use APP_NAME so that your desktop
|
15
|
+
only contains files and folders for the current project you are
|
16
|
+
working on.
|
17
|
+
|
18
|
+
When you switch projects, the files and folders in the desktop will
|
19
|
+
be kept and tagged with the project's name so it can be restored
|
20
|
+
later by #{APP_NAME} again.
|
21
|
+
|
22
|
+
Assuming you are current working on project `A`, to switch to the
|
23
|
+
project called `B`, run
|
24
|
+
|
25
|
+
$ APP_NAME B
|
26
|
+
|
27
|
+
Files and folders in the desktop will be moved away and tagged as
|
28
|
+
belonging to project `A` and the files and folders for project `B`
|
29
|
+
will be moved to the desktop.
|
30
|
+
|
31
|
+
If `B` doesn't exist yet, it will be created.
|
32
|
+
|
33
|
+
"
|
34
|
+
|
35
|
+
program :version, DesktopBoom::VERSION
|
36
|
+
program :description, HELP_STRING
|
37
|
+
|
38
|
+
default_command :switch
|
39
|
+
|
40
|
+
def config_path
|
41
|
+
File.expand_path("~/.config/#{APP_NAME}.yml")
|
42
|
+
end
|
43
|
+
|
44
|
+
command :switch do |c|
|
45
|
+
c.syntax = "#{APP_NAME} [switch]"
|
46
|
+
c.summary = 'Switch project'
|
47
|
+
c.description = c.summary
|
48
|
+
c.example 'Run command', "$ #{APP_NAME} <project name>"
|
49
|
+
c.action do |args, options|
|
50
|
+
say_error "Specify the name of the project you want to switch to. If the project
|
51
|
+
doesn't exist, it will be created:
|
52
|
+
|
53
|
+
#{APP_NAME} <project name>
|
54
|
+
" and abort if args.empty?
|
55
|
+
new_project = args[0]
|
56
|
+
create_configuration_file unless File.file? config_path
|
57
|
+
File.open(config_path) do |f|
|
58
|
+
mapping = Psych.load(f.read)
|
59
|
+
projects_directory = mapping['projects_directory']
|
60
|
+
current_project = mapping['current_project']
|
61
|
+
|
62
|
+
if new_project == current_project
|
63
|
+
say "Already at project '#{current_project}'"
|
64
|
+
break
|
65
|
+
end
|
66
|
+
move_desktop_to_project(current_project, projects_directory)
|
67
|
+
switch_to(mapping, new_project)
|
68
|
+
move_project_to_desktop(new_project, projects_directory)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
command :current do |c|
|
74
|
+
c.syntax = "#{APP_NAME} current"
|
75
|
+
c.summary = 'Show the current project name'
|
76
|
+
c.description = c.summary
|
77
|
+
c.example 'Run command', "$ #{APP_NAME} current"
|
78
|
+
c.action do |args, options|
|
79
|
+
create_configuration_file unless File.file? config_path
|
80
|
+
File.open(config_path) do |f|
|
81
|
+
mapping = Psych.load(f.read)
|
82
|
+
projects_directory = mapping['projects_directory']
|
83
|
+
current_project = mapping['current_project']
|
84
|
+
say current_project
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
command :list do |c|
|
90
|
+
c.syntax = "#{APP_NAME} list"
|
91
|
+
c.summary = 'Show list of projects'
|
92
|
+
c.description = c.summary
|
93
|
+
c.example 'Run command', "$ #{APP_NAME} list"
|
94
|
+
c.action do |args, options|
|
95
|
+
create_configuration_file unless File.file? config_path
|
96
|
+
File.open(config_path) do |f|
|
97
|
+
mapping = Psych.load(f.read)
|
98
|
+
projects_directory = mapping['projects_directory']
|
99
|
+
projects = Dir.entries(File.expand_path(projects_directory)).reject {|e| e == '.' || e == '..' || !File.directory?(File.expand_path(e, projects_directory))}
|
100
|
+
current_project = mapping['current_project']
|
101
|
+
projects.each do |e|
|
102
|
+
if e == current_project
|
103
|
+
say "#{e} <="
|
104
|
+
else
|
105
|
+
say e
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def create_configuration_file
|
113
|
+
write_configuration(nil)
|
114
|
+
end
|
115
|
+
|
116
|
+
def write_configuration(contents)
|
117
|
+
config_dir = File.dirname(config_path)
|
118
|
+
contents ||= {'projects_directory' => PROJECTS_DIRECTORY}
|
119
|
+
FileUtils.mkdir_p(config_dir) unless File.directory? config_dir
|
120
|
+
File.open(config_path, 'w') {|f| f.write(Psych.dump(contents))}
|
121
|
+
end
|
122
|
+
|
123
|
+
def move_dir_contents(from_dir, to_dir)
|
124
|
+
entries = Dir.entries(from_dir).reject {|e| e == '.' || e == '..'}
|
125
|
+
FileUtils.mkdir_p(to_dir) unless File.directory? to_dir
|
126
|
+
entries.each {|e| FileUtils.mv(File.expand_path(e, from_dir), File.expand_path(e, to_dir))}
|
127
|
+
end
|
128
|
+
|
129
|
+
def switch_to(mapping, new_project)
|
130
|
+
mapping['current_project'] = new_project
|
131
|
+
write_configuration(mapping)
|
132
|
+
end
|
133
|
+
|
134
|
+
def move_desktop_to_project(current_project, projects_directory)
|
135
|
+
return unless current_project
|
136
|
+
project_dir = File.expand_path(current_project, projects_directory)
|
137
|
+
move_dir_contents(DESKTOP_DIR, project_dir)
|
138
|
+
end
|
139
|
+
|
140
|
+
def move_project_to_desktop(new_project, projects_directory)
|
141
|
+
project_dir = File.expand_path(new_project, projects_directory)
|
142
|
+
unless File.directory? project_dir
|
143
|
+
FileUtils.mkdir_p(project_dir)
|
144
|
+
say "New project created '#{new_project}'"
|
145
|
+
end
|
146
|
+
move_dir_contents(project_dir, DESKTOP_DIR)
|
147
|
+
say "Switched to project '#{new_project}'"
|
148
|
+
end
|
data/boom.gemspec
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/boom/version.rb', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.name = 'desktop-boom'
|
6
|
+
gem.authors = ['Hwee-Boon Yar']
|
7
|
+
gem.email = 'hboon@motionobj.com'
|
8
|
+
gem.version = DesktopBoom::VERSION
|
9
|
+
|
10
|
+
gem.licenses = ['BSD']
|
11
|
+
gem.summary = 'boom - maintain your OS X desktop. Use boom so that your desktop only contains files and folders for the current project you are working on.'
|
12
|
+
gem.description = gem.summary
|
13
|
+
gem.homepage = 'http://hboon.com/boom/'
|
14
|
+
|
15
|
+
gem.add_dependency 'commander', '~> 4.3'
|
16
|
+
gem.files = `git ls-files`.split($\)
|
17
|
+
gem.executables = ['boom']
|
18
|
+
gem.require_paths = ['lib']
|
19
|
+
#gem.test_files = gem.files.grep(%r{^spec/})
|
20
|
+
end
|
data/lib/boom.rb
ADDED
data/lib/boom/boom.rb
ADDED
File without changes
|
data/lib/boom/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: desktop-boom
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hwee-Boon Yar
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: commander
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.3'
|
27
|
+
description: boom - maintain your OS X desktop. Use boom so that your desktop only
|
28
|
+
contains files and folders for the current project you are working on.
|
29
|
+
email: hboon@motionobj.com
|
30
|
+
executables:
|
31
|
+
- boom
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- ".gitignore"
|
36
|
+
- LICENSE
|
37
|
+
- README.md
|
38
|
+
- bin/boom
|
39
|
+
- boom.gemspec
|
40
|
+
- lib/boom.rb
|
41
|
+
- lib/boom/boom.rb
|
42
|
+
- lib/boom/version.rb
|
43
|
+
homepage: http://hboon.com/boom/
|
44
|
+
licenses:
|
45
|
+
- BSD
|
46
|
+
metadata: {}
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
requirements: []
|
62
|
+
rubyforge_project:
|
63
|
+
rubygems_version: 2.4.8
|
64
|
+
signing_key:
|
65
|
+
specification_version: 4
|
66
|
+
summary: boom - maintain your OS X desktop. Use boom so that your desktop only contains
|
67
|
+
files and folders for the current project you are working on.
|
68
|
+
test_files: []
|