boom 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.markdown +26 -0
- data/LICENSE.markdown +21 -0
- data/README.markdown +127 -0
- data/boom.gemspec +5 -5
- data/lib/boom/clipboard.rb +8 -3
- data/lib/boom/command.rb +14 -13
- data/lib/boom/list.rb +11 -0
- data/lib/boom.rb +1 -1
- data/test/test_command.rb +8 -1
- data/test/test_list.rb +12 -0
- metadata +9 -7
- data/changelog.markdown +0 -14
data/CHANGELOG.markdown
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# boom changes
|
2
|
+
|
3
|
+
## head
|
4
|
+
|
5
|
+
## 0.0.5
|
6
|
+
- Item deletes are now scoped by list rather than GLOBAL DESTRUCTION! (thanks
|
7
|
+
[natebean](https://github.com/natebean)).
|
8
|
+
- Command line options, like `boop --help` are translated into `boom help`. In
|
9
|
+
the future we play around with options a bit more.
|
10
|
+
- Non-Mac-based platforms get clipboard support with `xclip`. If it's
|
11
|
+
problematic (which it almost certainly is; I'm breaking this more or less on
|
12
|
+
purpose), please patch it and send me a pull request for your particular
|
13
|
+
platform.
|
14
|
+
|
15
|
+
## 0.0.4
|
16
|
+
- Adds `boom help`. You know, for help.
|
17
|
+
|
18
|
+
## 0.0.3
|
19
|
+
- `boom edit` to edit your stuff in a friendly $EDITOR.
|
20
|
+
- Class-level accessors in List for ActiveRecordesque actions.
|
21
|
+
|
22
|
+
## 0.0.2
|
23
|
+
- Fix for list selection (thanks [bgkittrell](https://github.com/bgkittrell)).
|
24
|
+
|
25
|
+
## 0.0.1
|
26
|
+
- BOOM!
|
data/LICENSE.markdown
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) Zach Holman, http://zachholman.com
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.markdown
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
# B O O M
|
2
|
+
|
3
|
+
See? Look, a tiny explosion: \*
|
4
|
+
|
5
|
+
## What's a boom?
|
6
|
+
|
7
|
+
boom lets you access text snippets over your command line. I'm personally
|
8
|
+
aiming for exactly two use cases, but I'm almost positive there are thirteen
|
9
|
+
more. Here's a couple examples:
|
10
|
+
|
11
|
+
- **Your own [del.icio.us](http://delicious.com)-esque URL tracker.** When I
|
12
|
+
make [clever animated
|
13
|
+
gifs](http://github.com/holman/dotfiles/blob/master/bin/gifme) of my
|
14
|
+
coworkers, I tend to lose the URL, which is a total bummer since I want to
|
15
|
+
repeatedly repost these images well past their funny expiration date. boom
|
16
|
+
lets me easily access the good stuff for years to come.
|
17
|
+
- **Commonly-used email replies.** Everyone's got those stock replies in their
|
18
|
+
pocket for a few common use cases. Rather than keep some files strewn about
|
19
|
+
with the responses, boom gives me them on my ever-present command line.
|
20
|
+
- **Simple todos.** You can super-quickly drop items into lists and remove them
|
21
|
+
when finished. I'm a big fan of simple, straightforward stuff. Plus, it's a
|
22
|
+
Dropbox away from simple cloud syncing. Someone get Cultured Code on the line
|
23
|
+
THIS MAY BE RELEVANT TO THEIR INTERESTS!
|
24
|
+
|
25
|
+
We store everything in one JSON file in your home directory: `~/.boom`. The
|
26
|
+
structure is simple, too. Each individual item is tossed on a `list`, and you
|
27
|
+
can have multiple lists.
|
28
|
+
|
29
|
+
## Show me the boom
|
30
|
+
|
31
|
+
** Overview **
|
32
|
+
|
33
|
+
$ boom
|
34
|
+
gifs (5)
|
35
|
+
email (4)
|
36
|
+
|
37
|
+
** Create a list **
|
38
|
+
|
39
|
+
$ boom urls
|
40
|
+
Boom! Created a new list called "urls".
|
41
|
+
|
42
|
+
** Add an item **
|
43
|
+
|
44
|
+
# boom <list> <name> <value>
|
45
|
+
$ boom urls github https://github.com
|
46
|
+
Boom! "github" in "urls" is "https://github.com". Got it.
|
47
|
+
|
48
|
+
** Copy an item's value to your clipboard **
|
49
|
+
|
50
|
+
$ boom github
|
51
|
+
Boom! Just copied https://github.com to your clipboard.
|
52
|
+
|
53
|
+
$ boom urls github
|
54
|
+
Boom! Just copied https://github.com to your clipboard.
|
55
|
+
|
56
|
+
** List items in a list **
|
57
|
+
|
58
|
+
$ boom urls
|
59
|
+
blog http://zachholman.com
|
60
|
+
github http://github.com
|
61
|
+
|
62
|
+
** Delete a list **
|
63
|
+
|
64
|
+
$ boom urls delete
|
65
|
+
You sure you want to delete everything in "urls"? (y/n): y
|
66
|
+
Boom! Deleted all your urls.
|
67
|
+
|
68
|
+
** Delete an item **
|
69
|
+
|
70
|
+
# boom urls github delete
|
71
|
+
Boom! "github" is gone forever.
|
72
|
+
|
73
|
+
** List everything **
|
74
|
+
|
75
|
+
$ boom all
|
76
|
+
enemies
|
77
|
+
@kneath: he's got dreamy eyes. he must die.
|
78
|
+
@rtomayko: i must murder him for his mac and cheese recipe.
|
79
|
+
@luckiestmonkey: she hates recycling.
|
80
|
+
urls
|
81
|
+
blog: http://zachholman.com
|
82
|
+
github: https://github.com
|
83
|
+
|
84
|
+
** Help **
|
85
|
+
|
86
|
+
$ boom help
|
87
|
+
|
88
|
+
** Manual edit **
|
89
|
+
|
90
|
+
If you want to edit the underlying JSON directly, make sure your `$EDITOR`
|
91
|
+
environment variable is set, and run:
|
92
|
+
|
93
|
+
$ boom edit
|
94
|
+
|
95
|
+
** It's just the command line, silly **
|
96
|
+
|
97
|
+
So don't forget all your other favorites are there to help you, too:
|
98
|
+
|
99
|
+
$ boom all | grep @luckiestmonkey
|
100
|
+
@luckiestmonkey: she hates recycling.
|
101
|
+
|
102
|
+
## Install
|
103
|
+
|
104
|
+
gem install boom
|
105
|
+
|
106
|
+
## Current Status
|
107
|
+
|
108
|
+
Precarious. I'm starting to use this a bunch now, but if you're tossing in
|
109
|
+
important business information (say, a carefully cultivated list of animated
|
110
|
+
.gifs), you'd be sitting pretty if you made a backup of `~/.boom` every now and
|
111
|
+
then, just in case. We're living on the edge, baby.
|
112
|
+
|
113
|
+
Also, don't mistype anything. Everything should be 100% perfect if you type all
|
114
|
+
the commands correctly. If you don't, it'll probably ungracefully error out and
|
115
|
+
a puppy in Kansas will probably be murdered. You should be fine, though. As
|
116
|
+
long as you don't have butter fingers.
|
117
|
+
|
118
|
+
Soon enough, though, this'll be stable to the point where I can truthfully tell
|
119
|
+
myself that this time baby, `boom` will be, bulletttttttttttttproof ♫.
|
120
|
+
|
121
|
+
## I love you
|
122
|
+
|
123
|
+
[Zach Holman](http://zachholman.com) made this. Ping me on Twitter —
|
124
|
+
[@holman](http://twitter.com/holman) — if you're having issues, want me to
|
125
|
+
merge in your pull request, or are using boom in a cool way. I'm kind of hoping
|
126
|
+
this is generic enough that people do some fun things with it. First one to use
|
127
|
+
`boom` to calculate their tax liability wins.
|
data/boom.gemspec
CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'boom'
|
16
|
-
s.version = '0.0.
|
17
|
-
s.date = '2010-12-
|
16
|
+
s.version = '0.0.5'
|
17
|
+
s.date = '2010-12-22'
|
18
18
|
s.rubyforge_project = 'boom'
|
19
19
|
|
20
20
|
## Make sure your summary is short. The description may be as long
|
@@ -65,18 +65,18 @@ Gem::Specification.new do |s|
|
|
65
65
|
## THE MANIFEST COMMENTS, they are used as delimiters by the task.
|
66
66
|
# = MANIFEST =
|
67
67
|
s.files = %w[
|
68
|
+
CHANGELOG.markdown
|
69
|
+
LICENSE.markdown
|
70
|
+
README.markdown
|
68
71
|
Rakefile
|
69
72
|
bin/boom
|
70
73
|
boom.gemspec
|
71
|
-
changelog.markdown
|
72
74
|
lib/boom.rb
|
73
75
|
lib/boom/clipboard.rb
|
74
76
|
lib/boom/command.rb
|
75
77
|
lib/boom/item.rb
|
76
78
|
lib/boom/list.rb
|
77
79
|
lib/boom/storage.rb
|
78
|
-
license.markdown
|
79
|
-
readme.markdown
|
80
80
|
test/examples/urls.json
|
81
81
|
test/helper.rb
|
82
82
|
test/test_command.rb
|
data/lib/boom/clipboard.rb
CHANGED
@@ -10,9 +10,14 @@ module Boom
|
|
10
10
|
#
|
11
11
|
# Returns nothing.
|
12
12
|
def copy(item)
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
copy_command =
|
14
|
+
if RUBY_PLATFORM =~ /darwin/
|
15
|
+
"pbcopy"
|
16
|
+
else
|
17
|
+
"xclip -selection clipboard"
|
18
|
+
end
|
19
|
+
|
20
|
+
`echo '#{item.value}' | tr -d "\n" | #{copy_command}`
|
16
21
|
|
17
22
|
"Boom! We just copied #{item.value} to your clipboard."
|
18
23
|
end
|
data/lib/boom/command.rb
CHANGED
@@ -70,11 +70,12 @@ module Boom
|
|
70
70
|
return all if command == 'all'
|
71
71
|
return edit if command == 'edit'
|
72
72
|
return help if command == 'help'
|
73
|
+
return help if command[0] == 45 # any - dash options are pleas for help
|
73
74
|
|
74
75
|
# if we're operating on a List
|
75
76
|
if storage.list_exists?(command)
|
76
|
-
return
|
77
|
-
return
|
77
|
+
return delete_list(command) if major == 'delete'
|
78
|
+
return detail_list(command) unless major
|
78
79
|
unless minor == 'delete'
|
79
80
|
return add_item(command,major,minor) if minor
|
80
81
|
return search_list_for_item(command, major)
|
@@ -84,10 +85,10 @@ module Boom
|
|
84
85
|
return search_items(command) if storage.item_exists?(command)
|
85
86
|
|
86
87
|
if minor == 'delete' and storage.item_exists?(major)
|
87
|
-
return
|
88
|
+
return delete_item(command, major)
|
88
89
|
end
|
89
90
|
|
90
|
-
return
|
91
|
+
return create_list(command)
|
91
92
|
end
|
92
93
|
|
93
94
|
# Public: prints all Items over a List.
|
@@ -95,7 +96,7 @@ module Boom
|
|
95
96
|
# name - the List object to iterate over
|
96
97
|
#
|
97
98
|
# Returns nothing.
|
98
|
-
def
|
99
|
+
def detail_list(name)
|
99
100
|
list = List.find(name)
|
100
101
|
list.items.sort{ |x,y| x.name <=> y.name }.each do |item|
|
101
102
|
output " #{item.name}: #{item.value}"
|
@@ -111,7 +112,7 @@ module Boom
|
|
111
112
|
# Commands.list_create("snippets")
|
112
113
|
#
|
113
114
|
# Returns the newly created List.
|
114
|
-
def
|
115
|
+
def create_list(name)
|
115
116
|
lists = (storage.lists << List.new(name))
|
116
117
|
storage.lists = lists
|
117
118
|
output "Boom! Created a new list called \"#{name}\"."
|
@@ -127,7 +128,7 @@ module Boom
|
|
127
128
|
# Commands.delete_list("snippets")
|
128
129
|
#
|
129
130
|
# Returns nothing.
|
130
|
-
def
|
131
|
+
def delete_list(name)
|
131
132
|
output "You sure you want to delete everything in \"#{name}\"? (y/n):"
|
132
133
|
if $stdin.gets.chomp == 'y'
|
133
134
|
List.delete(name)
|
@@ -158,17 +159,17 @@ module Boom
|
|
158
159
|
|
159
160
|
# Public: remove a named Item.
|
160
161
|
#
|
161
|
-
#
|
162
|
+
# list_name - the String name of the List.
|
163
|
+
# name - the String name of the Item.
|
162
164
|
#
|
163
165
|
# Example
|
164
166
|
#
|
165
|
-
# Commands.delete_item("an-item-name")
|
167
|
+
# Commands.delete_item("a-list-name", "an-item-name")
|
166
168
|
#
|
167
169
|
# Returns nothing.
|
168
|
-
def
|
169
|
-
|
170
|
-
|
171
|
-
end
|
170
|
+
def delete_item(list_name,name)
|
171
|
+
list = List.find(list_name)
|
172
|
+
list.delete_item(name)
|
172
173
|
output "Boom! \"#{name}\" is gone forever."
|
173
174
|
save!
|
174
175
|
end
|
data/lib/boom/list.rb
CHANGED
@@ -61,6 +61,17 @@ module Boom
|
|
61
61
|
previous != storage.lists.size
|
62
62
|
end
|
63
63
|
|
64
|
+
# Public: deletes an Item by name.
|
65
|
+
#
|
66
|
+
# name - String name of the item to delete
|
67
|
+
#
|
68
|
+
# Returns whether an item was removed.
|
69
|
+
def delete_item(name)
|
70
|
+
previous = items.size
|
71
|
+
items.reject! { |item| item.name == name}
|
72
|
+
previous != items.size
|
73
|
+
end
|
74
|
+
|
64
75
|
# Public: a Hash representation of this List.
|
65
76
|
#
|
66
77
|
# Returns a Hash of its own data and its child Items.
|
data/lib/boom.rb
CHANGED
data/test/test_command.rb
CHANGED
@@ -86,7 +86,14 @@ class TestCommand < Test::Unit::TestCase
|
|
86
86
|
assert_match 'Make your edits', command('edit')
|
87
87
|
end
|
88
88
|
|
89
|
-
def
|
89
|
+
def test_help
|
90
90
|
assert_match 'boom help', command('help')
|
91
|
+
assert_match 'boom help', command('-h')
|
92
|
+
assert_match 'boom help', command('--help')
|
93
|
+
end
|
94
|
+
|
95
|
+
def test_noop_options
|
96
|
+
assert_match 'boom help', command('--anything')
|
97
|
+
assert_match 'boom help', command('-d')
|
91
98
|
end
|
92
99
|
end
|
data/test/test_list.rb
CHANGED
@@ -40,4 +40,16 @@ class TestList < Test::Unit::TestCase
|
|
40
40
|
assert_equal 1, Boom.storage.lists.size
|
41
41
|
end
|
42
42
|
|
43
|
+
def test_deletes_scoped_to_list
|
44
|
+
@list.add_item(@item)
|
45
|
+
|
46
|
+
@list_2 = Boom::List.new('sexy-companies')
|
47
|
+
@item_2 = Boom::Item.new(@item.name, @item.value)
|
48
|
+
@list_2.add_item(@item_2)
|
49
|
+
|
50
|
+
@list.delete_item(@item.name)
|
51
|
+
assert_equal 0, @list.items.size
|
52
|
+
assert_equal 1, @list_2.items.size
|
53
|
+
end
|
54
|
+
|
43
55
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Zach Holman
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-12-
|
18
|
+
date: 2010-12-22 00:00:00 -06:00
|
19
19
|
default_executable: boom
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -67,23 +67,25 @@ extra_rdoc_files:
|
|
67
67
|
- readme.markdown
|
68
68
|
- license.markdown
|
69
69
|
files:
|
70
|
+
- CHANGELOG.markdown
|
71
|
+
- LICENSE.markdown
|
72
|
+
- README.markdown
|
70
73
|
- Rakefile
|
71
74
|
- bin/boom
|
72
75
|
- boom.gemspec
|
73
|
-
- changelog.markdown
|
74
76
|
- lib/boom.rb
|
75
77
|
- lib/boom/clipboard.rb
|
76
78
|
- lib/boom/command.rb
|
77
79
|
- lib/boom/item.rb
|
78
80
|
- lib/boom/list.rb
|
79
81
|
- lib/boom/storage.rb
|
80
|
-
- license.markdown
|
81
|
-
- readme.markdown
|
82
82
|
- test/examples/urls.json
|
83
83
|
- test/helper.rb
|
84
84
|
- test/test_command.rb
|
85
85
|
- test/test_item.rb
|
86
86
|
- test/test_list.rb
|
87
|
+
- readme.markdown
|
88
|
+
- license.markdown
|
87
89
|
has_rdoc: true
|
88
90
|
homepage: https://github.com/holman/boom
|
89
91
|
licenses: []
|
data/changelog.markdown
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# boom changes
|
2
|
-
|
3
|
-
## 0.0.4
|
4
|
-
- Adds `boom help`. You know, for help.
|
5
|
-
|
6
|
-
## 0.0.3
|
7
|
-
- `boom edit` to edit your stuff in a friendly $EDITOR.
|
8
|
-
- Class-level accessors in List for ActiveRecordesque actions.
|
9
|
-
|
10
|
-
## 0.0.2
|
11
|
-
- Fix for list selection (thanks [bgkittrell](https://github.com/bgkittrell)).
|
12
|
-
|
13
|
-
## 0.0.1
|
14
|
-
- BOOM!
|