kaboom 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +4 -0
- data/README.markdown +54 -8
- data/kaboom.gemspec +7 -3
- data/lib/kaboom.rb +2 -1
- data/lib/kaboom/command.rb +63 -38
- data/lib/kaboom/platform.rb +14 -90
- data/lib/kaboom/platform/base.rb +22 -0
- data/lib/kaboom/platform/darwin.rb +16 -0
- data/lib/kaboom/platform/linux.rb +15 -0
- data/lib/kaboom/platform/windows.rb +20 -0
- data/test/test_command.rb +8 -12
- data/test/test_platform.rb +23 -25
- data/test/test_remote.rb +1 -1
- metadata +26 -14
- data/lib/kaboom/.command.rb.swo +0 -0
data/Gemfile.lock
CHANGED
@@ -2,12 +2,16 @@ PATH
|
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
4
|
kaboom (0.3.2)
|
5
|
+
active_support
|
5
6
|
json_pure (~> 1.5.3)
|
6
7
|
multi_json (~> 1.0.3)
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: http://rubygems.org/
|
10
11
|
specs:
|
12
|
+
active_support (3.0.0)
|
13
|
+
activesupport (= 3.0.0)
|
14
|
+
activesupport (3.0.0)
|
11
15
|
json_pure (1.5.4)
|
12
16
|
spruz (~> 0.2.8)
|
13
17
|
mocha (0.9.12)
|
data/README.markdown
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# K A B O O M
|
2
2
|
|
3
|
-
## About
|
4
|
-
|
5
3
|
boom manages your text snippets. On the command line. I just blew your mind.
|
6
|
-
kaboom adds sharing snippets. On the command line.
|
7
4
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
5
|
+
kaboom allows sharing snippets across command lines.
|
6
|
+
|
7
|
+
|
8
|
+
This is a fork of Zach Holman's amazing boom. Explanation for the fork follows
|
9
|
+
a little later
|
10
|
+
|
11
|
+
|
12
12
|
|
13
13
|
## Install
|
14
14
|
|
@@ -29,7 +29,12 @@ And that's just a taste! I know, you're salivating, I can hear you from here.
|
|
29
29
|
(Why your saliva is noisy is beyond me.) Check out the [full list of
|
30
30
|
commands](https://github.com/holman/boom/wiki/Commands).
|
31
31
|
|
32
|
-
|
32
|
+
For more details about what boom is and how it works, check out
|
33
|
+
[boom's website](http://holman.github.com/boom). For full usage details
|
34
|
+
(including a complete list of commands), check out
|
35
|
+
[boom's wiki](https://github.com/holman/boom/wiki).
|
36
|
+
|
37
|
+
# KABOOM
|
33
38
|
You can even have a remote boom using config in ~/.boom.remote.conf
|
34
39
|
|
35
40
|
$ boom remote "a sandwich" cheese "mighty fine"
|
@@ -45,12 +50,53 @@ each others command lines
|
|
45
50
|
$ kaboom config ackrc > ~/.ackrc
|
46
51
|
|
47
52
|
## Distributed sharing of snippets with boom and kaboom
|
53
|
+
|
48
54
|
# me:
|
49
55
|
$ kaboom shared_links pivotal < boom links pivotal
|
50
56
|
|
51
57
|
$ you:
|
52
58
|
$ kaboom shared_links pivotal > boom links pivotal
|
53
59
|
|
60
|
+
## In Zach's words
|
61
|
+
God it's about every day where I think to myself, gadzooks,
|
62
|
+
I keep typing *REPETITIVE_BORING_TASK* over and over. Wouldn't it be great if
|
63
|
+
I had something like boom to store all these commonly-used text snippets for
|
64
|
+
me? Then I realized that was a worthless idea since boom hadn't been created
|
65
|
+
yet and I had no idea what that statement meant. At some point I found the
|
66
|
+
code for boom in a dark alleyway and released it under my own name because I
|
67
|
+
wanted to look smart.
|
68
|
+
|
69
|
+
## Explanation for my fork
|
70
|
+
Zach didn't fancy changing boom a great deal to handle the case of remote and
|
71
|
+
local boom repos. Which is fair enough I believe in simplicity.
|
72
|
+
But I also believe in getting tools to do what you want them to do.
|
73
|
+
So with boom, you can change your storage with a 'boom storage' command, but
|
74
|
+
that's a hassle when you want to share stuff.
|
75
|
+
|
76
|
+
So kaboom does what boom does plus simplifies maintaining two boom repos.
|
77
|
+
What this means is that you can pipe input between remote and local boom
|
78
|
+
instances. My use case is to have a redis server in our office and be able
|
79
|
+
to share snippets between each other, but to also be able to have personal
|
80
|
+
repos.
|
81
|
+
|
82
|
+
It's basically something like distributed key-value stores. I imagine some of
|
83
|
+
the things that might be worth thinking about, based on DVC are:
|
84
|
+
|
85
|
+
* Imports/Exports of lists/keys/values between repos.
|
86
|
+
* Merge conflict resolution
|
87
|
+
* Users/Permissions/Teams/Roles etc
|
88
|
+
* Enterprisey XML backend
|
89
|
+
* I'm kidding
|
90
|
+
|
91
|
+
No, but seriously I think I might allow import/export of lists and whole repos
|
92
|
+
so that we can all easily back stuff up
|
93
|
+
|
94
|
+
E.g.
|
95
|
+
|
96
|
+
* clone the whole shared repo
|
97
|
+
* backup your local repo to the central one underneath a namespace
|
98
|
+
|
99
|
+
|
54
100
|
## Contribute
|
55
101
|
|
56
102
|
Clone this repository, then run `bundle install`. That'll install all the gem
|
data/kaboom.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 = 'kaboom'
|
16
|
-
s.version = '0.3.
|
17
|
-
s.date = '2012-03-
|
16
|
+
s.version = '0.3.3'
|
17
|
+
s.date = '2012-03-18'
|
18
18
|
s.rubyforge_project = 'boom'
|
19
19
|
|
20
20
|
## Make sure your summary is short. The description may be as long
|
@@ -93,6 +93,7 @@ Gem::Specification.new do |s|
|
|
93
93
|
## that are needed for an end user to actually USE your code.
|
94
94
|
s.add_dependency('multi_json', "~> 1.0.3")
|
95
95
|
s.add_dependency('json_pure', "~> 1.5.3")
|
96
|
+
s.add_dependency('active_support')
|
96
97
|
|
97
98
|
## List your development dependencies here. Development dependencies are
|
98
99
|
## those that are only needed during development
|
@@ -117,7 +118,6 @@ Gem::Specification.new do |s|
|
|
117
118
|
completion/boom.zsh
|
118
119
|
kaboom.gemspec
|
119
120
|
lib/kaboom.rb
|
120
|
-
lib/kaboom/.command.rb.swo
|
121
121
|
lib/kaboom/color.rb
|
122
122
|
lib/kaboom/command.rb
|
123
123
|
lib/kaboom/config.rb
|
@@ -126,6 +126,10 @@ Gem::Specification.new do |s|
|
|
126
126
|
lib/kaboom/list.rb
|
127
127
|
lib/kaboom/output.rb
|
128
128
|
lib/kaboom/platform.rb
|
129
|
+
lib/kaboom/platform/base.rb
|
130
|
+
lib/kaboom/platform/darwin.rb
|
131
|
+
lib/kaboom/platform/linux.rb
|
132
|
+
lib/kaboom/platform/windows.rb
|
129
133
|
lib/kaboom/remote.rb
|
130
134
|
lib/kaboom/storage.rb
|
131
135
|
lib/kaboom/storage/base.rb
|
data/lib/kaboom.rb
CHANGED
@@ -10,6 +10,7 @@ require 'multi_json'
|
|
10
10
|
|
11
11
|
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
|
12
12
|
|
13
|
+
require 'active_support/core_ext/module/delegation'
|
13
14
|
require 'kaboom/output'
|
14
15
|
require 'kaboom/color'
|
15
16
|
require 'kaboom/platform'
|
@@ -30,7 +31,7 @@ require 'kaboom/core_ext/symbol'
|
|
30
31
|
require 'kaboom/remote'
|
31
32
|
|
32
33
|
module Boom
|
33
|
-
VERSION = '0.3.
|
34
|
+
VERSION = '0.3.3'
|
34
35
|
|
35
36
|
extend self
|
36
37
|
|
data/lib/kaboom/command.rb
CHANGED
@@ -103,13 +103,14 @@ module Boom
|
|
103
103
|
return random(major) if command == 'random' || command == 'rand' || command == 'r'
|
104
104
|
|
105
105
|
# if we're operating on a List
|
106
|
-
|
107
|
-
|
108
|
-
return
|
106
|
+
list = command
|
107
|
+
if storage.list_exists?(list)
|
108
|
+
return delete_list(list) if major == 'delete'
|
109
|
+
return detail_list(list) unless major
|
109
110
|
unless minor == 'delete'
|
110
|
-
return add_item(
|
111
|
-
return add_item(
|
112
|
-
return search_list_for_item(
|
111
|
+
return add_item(list,major,minor) if minor
|
112
|
+
return add_item(list,major,stdin.read) if stdin.stat.size > 0
|
113
|
+
return search_list_for_item(list, major)
|
113
114
|
end
|
114
115
|
end
|
115
116
|
|
@@ -157,18 +158,18 @@ module Boom
|
|
157
158
|
# Public: opens the Item.
|
158
159
|
#
|
159
160
|
# Returns nothing.
|
160
|
-
def open(
|
161
|
-
if storage.list_exists?(
|
162
|
-
list = List.find(
|
163
|
-
if
|
164
|
-
item = storage.items.detect { |item| item.name ==
|
161
|
+
def open(key, value)
|
162
|
+
if storage.list_exists?(key)
|
163
|
+
list = List.find(key)
|
164
|
+
if value
|
165
|
+
item = storage.items.detect { |item| item.name == value }
|
165
166
|
output "#{cyan("Boom!")} We just opened #{yellow(Platform.open(item))} for you."
|
166
167
|
else
|
167
168
|
list.items.each { |item| Platform.open(item) }
|
168
|
-
output "#{cyan("Boom!")} We just opened all of #{yellow(
|
169
|
+
output "#{cyan("Boom!")} We just opened all of #{yellow(key)} for you."
|
169
170
|
end
|
170
171
|
else
|
171
|
-
item = storage.items.detect { |item| item.name ==
|
172
|
+
item = storage.items.detect { |item| item.name == key }
|
172
173
|
output "#{cyan("Boom!")} We just opened #{yellow(Platform.open(item))} for you."
|
173
174
|
end
|
174
175
|
end
|
@@ -348,37 +349,61 @@ module Boom
|
|
348
349
|
end
|
349
350
|
end
|
350
351
|
|
352
|
+
def y t
|
353
|
+
yellow t
|
354
|
+
end
|
355
|
+
|
356
|
+
def c t
|
357
|
+
cyan t
|
358
|
+
end
|
359
|
+
|
360
|
+
def r t
|
361
|
+
red t
|
362
|
+
end
|
363
|
+
|
351
364
|
# Public: prints all the commands of boom.
|
352
365
|
#
|
353
366
|
# Returns nothing.
|
354
367
|
def help
|
355
368
|
text = %{
|
356
|
-
|
357
|
-
|
358
|
-
boom
|
359
|
-
boom all
|
360
|
-
boom edit
|
361
|
-
boom help
|
362
|
-
boom storage
|
363
|
-
boom switch <storage>
|
364
|
-
|
365
|
-
boom <list>
|
366
|
-
boom <list>
|
367
|
-
boom <list> delete
|
368
|
-
|
369
|
-
boom <list> <name> <value>
|
370
|
-
boom <name>
|
371
|
-
boom <list> <name>
|
372
|
-
boom open <name>
|
373
|
-
boom open <list> <name>
|
374
|
-
boom random
|
375
|
-
boom random <list>
|
376
|
-
boom echo <name>
|
377
|
-
boom echo <list> <name>
|
378
|
-
boom <list> <name> delete
|
379
|
-
|
369
|
+
#{r "BOOM snippets"} ___________________________________________________
|
370
|
+
|
371
|
+
boom display high-level overview
|
372
|
+
boom #{y "all"} show all items in all lists
|
373
|
+
boom #{y "edit"} edit the boom JSON file in $EDITOR
|
374
|
+
boom #{y "help"} this help text
|
375
|
+
boom #{y "storage"} shows which storage backend you're using
|
376
|
+
boom #{y "switch"} #{c "<storage>"} switches to a different storage backend
|
377
|
+
|
378
|
+
boom #{c "<list>"} create a new list
|
379
|
+
boom #{c "<list>"} show items for a list
|
380
|
+
boom #{c "<list>"} #{y "delete"} deletes a list
|
381
|
+
|
382
|
+
boom #{c "<list> <name> <value>"} create a new list item
|
383
|
+
boom #{c "<name>"} copy item's value to clipboard
|
384
|
+
boom #{c "<list> <name>"} copy item's value to clipboard
|
385
|
+
boom #{y "open"} #{c "<name>"} open item's url in browser
|
386
|
+
boom #{y "open"} #{c "<list> <name>"} open all item's url in browser for a list
|
387
|
+
boom #{y "random"} open a random item's url in browser
|
388
|
+
boom #{y "random"} #{c "<list>"} open a random item's url for a list in browser
|
389
|
+
boom #{y "echo"} #{c "<name>"} echo the item's value without copying
|
390
|
+
boom #{y "echo"} #{c "<list> <name>"} echo the item's value without copying
|
391
|
+
boom #{c "<list> <name>"} #{y "delete"} deletes an item
|
392
|
+
|
393
|
+
#{red "KABOOM sharing"} ___________________________________________________
|
394
|
+
|
395
|
+
boom remote #{y "<any command above>"} using the #{y "~/.boom.remote.conf"} it
|
396
|
+
kaboom #{y "<any command above>"} connects to an alternative backend
|
397
|
+
meaning you can pipe to a remote
|
398
|
+
backend storage
|
399
|
+
|
400
|
+
e.g. to pipe config from a local boom to a remote boom do:
|
401
|
+
|
402
|
+
kaboom #{c("config ackrc")} < boom #{c "config ackrc"}
|
403
|
+
|
404
|
+
___________________________________________________________________
|
380
405
|
all other documentation is located at:
|
381
|
-
https://github.com/
|
406
|
+
https://github.com/markburns/kaboom
|
382
407
|
}.gsub(/^ {8}/, '') # strip the first eight spaces of every line
|
383
408
|
|
384
409
|
output text
|
data/lib/kaboom/platform.rb
CHANGED
@@ -1,102 +1,26 @@
|
|
1
|
-
|
1
|
+
require 'kaboom/platform/base'
|
2
|
+
require 'kaboom/platform/darwin'
|
3
|
+
require 'kaboom/platform/windows'
|
4
|
+
require 'kaboom/platform/linux'
|
2
5
|
|
3
|
-
# Platform is a centralized point to shell out platform specific functionality
|
4
|
-
# like clipboard access or commands to open URLs.
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# Clipboard is a centralized point to shell out to each individual platform's
|
8
|
-
# clipboard, pasteboard, or whatever they decide to call it.
|
9
|
-
#
|
10
6
|
module Boom
|
11
7
|
class Platform
|
12
8
|
class << self
|
13
|
-
|
14
|
-
|
15
|
-
# Returns true if running on darwin (MacOS X), else false
|
16
|
-
def darwin?
|
17
|
-
!!(RUBY_PLATFORM =~ /darwin/)
|
9
|
+
def platform
|
10
|
+
@platform ||= detect_platform.new
|
18
11
|
end
|
19
12
|
|
20
|
-
|
21
|
-
#
|
22
|
-
# Apparently Windows RUBY_PLATFORM can be 'win32' or 'mingw32'
|
23
|
-
#
|
24
|
-
# Returns true if running on windows (win32/mingw32), else false
|
25
|
-
def windows?
|
26
|
-
!!(RUBY_PLATFORM =~ /mswin|mingw/)
|
27
|
-
end
|
28
|
-
|
29
|
-
# Public: returns the command used to open a file or URL
|
30
|
-
# for the current platform.
|
31
|
-
#
|
32
|
-
# Currently only supports MacOS X and Linux with `xdg-open`.
|
33
|
-
#
|
34
|
-
# Returns a String with the bin
|
35
|
-
def open_command
|
36
|
-
if darwin?
|
37
|
-
'open'
|
38
|
-
elsif windows?
|
39
|
-
'start'
|
40
|
-
else
|
41
|
-
'xdg-open'
|
42
|
-
end
|
43
|
-
end
|
13
|
+
delegate :edit, :open, :copy, :to => :platform
|
44
14
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
system("#{open_command} '#{item.url.gsub("\'","'\\\\''")}'")
|
15
|
+
private
|
16
|
+
def detect_platform
|
17
|
+
if !!(RUBY_PLATFORM =~ /darwin/)
|
18
|
+
Darwin
|
19
|
+
elsif !!(RUBY_PLATFORM =~ /mswin|mingw/)
|
20
|
+
Windows
|
52
21
|
else
|
53
|
-
|
22
|
+
Other
|
54
23
|
end
|
55
|
-
|
56
|
-
item.value
|
57
|
-
end
|
58
|
-
|
59
|
-
# Public: returns the command used to copy a given Item's value to the
|
60
|
-
# clipboard for the current platform.
|
61
|
-
#
|
62
|
-
# Returns a String with the bin
|
63
|
-
def copy_command
|
64
|
-
if darwin?
|
65
|
-
'pbcopy'
|
66
|
-
elsif windows?
|
67
|
-
'clip'
|
68
|
-
else
|
69
|
-
'xclip -selection clipboard'
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
# Public: copies a given Item's value to the clipboard. This method is
|
74
|
-
# designed to handle multiple platforms.
|
75
|
-
#
|
76
|
-
# Returns the String value of the Item.
|
77
|
-
def copy(item)
|
78
|
-
IO.popen(copy_command,"w") {|cc| cc.write(item.value)}
|
79
|
-
item.value
|
80
|
-
end
|
81
|
-
|
82
|
-
# Public: opens the JSON file in an editor for you to edit. Uses the
|
83
|
-
# $EDITOR environment variable, or %EDITOR% on Windows for editing.
|
84
|
-
# This method is designed to handle multiple platforms.
|
85
|
-
# If $EDITOR is nil, try to open using the open_command.
|
86
|
-
#
|
87
|
-
# Returns a String with a helpful message.
|
88
|
-
def edit(json_file)
|
89
|
-
unless $EDITOR.nil?
|
90
|
-
unless windows?
|
91
|
-
system("`echo $EDITOR` #{json_file} &")
|
92
|
-
else
|
93
|
-
system("start %EDITOR% #{json_file}")
|
94
|
-
end
|
95
|
-
else
|
96
|
-
system("#{open_command} #{json_file}")
|
97
|
-
end
|
98
|
-
|
99
|
-
"Make your edits, and do be sure to save."
|
100
24
|
end
|
101
25
|
end
|
102
26
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class Boom::Platform
|
2
|
+
class Base
|
3
|
+
def open_file file
|
4
|
+
system("#{open_command} #{file}")
|
5
|
+
end
|
6
|
+
|
7
|
+
def edit json_file
|
8
|
+
if $EDITOR
|
9
|
+
return yield if block_given?
|
10
|
+
|
11
|
+
system "`echo $EDITOR` #{json_file} &"
|
12
|
+
else
|
13
|
+
open_file json_file
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def copy item
|
18
|
+
IO.popen(copy_command,"w") {|cc| cc.write(item.value)}
|
19
|
+
item.value
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class Boom::Platform
|
2
|
+
class Windows
|
3
|
+
def edit json_file
|
4
|
+
super { system "start %EDITOR$ #{json_file}" }
|
5
|
+
end
|
6
|
+
|
7
|
+
def copy_command
|
8
|
+
'clip'
|
9
|
+
end
|
10
|
+
|
11
|
+
def open item
|
12
|
+
system("#{open_command} #{item.url.gsub("\'","'\\\\''")}")
|
13
|
+
item.value
|
14
|
+
end
|
15
|
+
|
16
|
+
def open_command
|
17
|
+
"start"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/test/test_command.rb
CHANGED
@@ -6,6 +6,11 @@ require 'output_interceptor'
|
|
6
6
|
class TestCommand < Test::Unit::TestCase
|
7
7
|
|
8
8
|
def setup
|
9
|
+
[Boom::Platform::Darwin, Boom::Platform::Linux,
|
10
|
+
Boom::Platform::Windows].each do |klass|
|
11
|
+
klass.any_instance.stubs('system')
|
12
|
+
end
|
13
|
+
IO.stubs(:popen)
|
9
14
|
boom_json :urls
|
10
15
|
end
|
11
16
|
|
@@ -81,17 +86,14 @@ class TestCommand < Test::Unit::TestCase
|
|
81
86
|
end
|
82
87
|
|
83
88
|
def test_item_open_item
|
84
|
-
Boom::Platform.stubs(:system).returns('')
|
85
89
|
assert_match /opened https:\/\/github\.com for you/, command('open github')
|
86
90
|
end
|
87
91
|
|
88
92
|
def test_item_open_specific_item
|
89
|
-
Boom::Platform.stubs(:system).returns('')
|
90
93
|
assert_match /opened https:\/\/github\.com for you/, command('open urls github')
|
91
94
|
end
|
92
95
|
|
93
96
|
def test_item_open_lists
|
94
|
-
Boom::Platform.stubs(:system).returns('')
|
95
97
|
assert_match /opened all of urls for you/, command('open urls')
|
96
98
|
end
|
97
99
|
|
@@ -119,11 +121,6 @@ class TestCommand < Test::Unit::TestCase
|
|
119
121
|
assert_match /github is gone forever/, command('urls github delete')
|
120
122
|
end
|
121
123
|
|
122
|
-
def test_edit
|
123
|
-
Boom::Platform.stubs(:system).returns('')
|
124
|
-
assert_match 'Make your edits', command('edit')
|
125
|
-
end
|
126
|
-
|
127
124
|
def test_help
|
128
125
|
assert_match 'boom help', command('help')
|
129
126
|
assert_match 'boom help', command('-h')
|
@@ -181,7 +178,6 @@ class TestCommand < Test::Unit::TestCase
|
|
181
178
|
def test_version_long
|
182
179
|
assert_match /#{Boom::VERSION}/, command('--version')
|
183
180
|
end
|
184
|
-
|
185
181
|
def test_stdin_pipes
|
186
182
|
stub = Object.new
|
187
183
|
stub.stubs(:stat).returns([1,2])
|
@@ -191,17 +187,17 @@ class TestCommand < Test::Unit::TestCase
|
|
191
187
|
end
|
192
188
|
|
193
189
|
def test_random
|
194
|
-
Boom::
|
190
|
+
Boom::Config.any_instance.stubs(:save).returns(true)
|
195
191
|
assert_match /opened .+ for you/, command('random')
|
196
192
|
end
|
197
193
|
|
198
194
|
def test_random_from_list
|
199
|
-
Boom::
|
195
|
+
Boom::Config.any_instance.stubs(:save).returns(true)
|
200
196
|
assert_match /(github|zachholman)/, command('random urls')
|
201
197
|
end
|
202
198
|
|
203
199
|
def test_random_list_not_exist
|
204
|
-
Boom::
|
200
|
+
Boom::Config.any_instance.stubs(:save).returns(true)
|
205
201
|
assert_match /couldn't find that list\./, command('random 39jc02jlskjbbac9')
|
206
202
|
end
|
207
203
|
|
data/test/test_platform.rb
CHANGED
@@ -1,52 +1,50 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
class TestPlatform < Test::Unit::TestCase
|
4
|
-
|
5
4
|
def setup
|
6
|
-
|
5
|
+
[Boom::Platform::Darwin, Boom::Platform::Linux,
|
6
|
+
Boom::Platform::Windows].each do |klass|
|
7
|
+
klass.any_instance.stubs('system')
|
8
|
+
end
|
7
9
|
end
|
8
10
|
|
9
11
|
def test_darwin
|
10
|
-
assert_equal Boom::Platform.
|
12
|
+
assert_equal Boom::Platform.platform.class,
|
13
|
+
Boom::Platform::Darwin, RUBY_PLATFORM.include?('darwin')
|
11
14
|
end
|
12
15
|
|
13
16
|
def test_windows
|
14
|
-
assert_equal Boom::Platform.
|
17
|
+
assert_equal Boom::Platform.platform.class,
|
18
|
+
Boom::Platform::Windows if RUBY_PLATFORM =~ /mswin|mingw/
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_linux
|
22
|
+
assert_equal Boom::Platform.platform.class,
|
23
|
+
Boom::Platform::Linux if RUBY_PLATFORM =~ /mswin|mingw/
|
15
24
|
end
|
16
|
-
|
25
|
+
|
17
26
|
def test_open_command_darwin
|
18
|
-
Boom::Platform.
|
19
|
-
assert_equal Boom::Platform.open_command, 'open'
|
27
|
+
assert_equal Boom::Platform::Darwin.new.open_command, 'open'
|
20
28
|
end
|
21
|
-
|
29
|
+
|
22
30
|
def test_open_command_windows
|
23
|
-
Boom::Platform.
|
24
|
-
Boom::Platform.stubs(:windows?).returns(true)
|
25
|
-
assert_equal Boom::Platform.open_command, 'start'
|
31
|
+
assert_equal Boom::Platform::Windows.new.open_command, 'start'
|
26
32
|
end
|
27
|
-
|
33
|
+
|
28
34
|
def test_open_command_linux
|
29
|
-
Boom::Platform.
|
30
|
-
Boom::Platform.stubs(:windows?).returns(false)
|
31
|
-
assert_equal Boom::Platform.open_command, 'xdg-open'
|
35
|
+
assert_equal Boom::Platform::Linux.new.open_command, 'xdg-open'
|
32
36
|
end
|
33
37
|
|
34
38
|
def test_copy_command_darwin
|
35
|
-
Boom::Platform.
|
36
|
-
Boom::Platform.stubs(:windows?).returns(false)
|
37
|
-
assert_equal Boom::Platform.copy_command, 'pbcopy'
|
39
|
+
assert_equal Boom::Platform::Darwin.new.copy_command, 'pbcopy'
|
38
40
|
end
|
39
41
|
|
40
42
|
def test_copy_command_windows
|
41
|
-
Boom::Platform.
|
42
|
-
Boom::Platform.stubs(:windows?).returns(true)
|
43
|
-
assert_equal Boom::Platform.copy_command, 'clip'
|
43
|
+
assert_equal Boom::Platform::Windows.new.copy_command, 'clip'
|
44
44
|
end
|
45
45
|
|
46
46
|
def test_copy_command_linux
|
47
|
-
Boom::Platform.
|
48
|
-
Boom::Platform.stubs(:windows?).returns(false)
|
49
|
-
assert_equal Boom::Platform.copy_command, 'xclip -selection clipboard'
|
47
|
+
assert_equal Boom::Platform::Linux.new.copy_command, 'xclip -selection clipboard'
|
50
48
|
end
|
51
|
-
|
49
|
+
|
52
50
|
end
|
data/test/test_remote.rb
CHANGED
@@ -25,6 +25,6 @@ class TestRemote < Test::Unit::TestCase
|
|
25
25
|
|
26
26
|
Boom::Remote.stubs(:output)
|
27
27
|
remote.all? { |t| assert Boom::Remote.allowed?(dummy(t)), "#{t} should be allowed" }
|
28
|
-
local.all? { |t|
|
28
|
+
local.all? { |t| assert !Boom::Remote.allowed?(dummy(t)), "#{t} should not be allowed"}
|
29
29
|
end
|
30
30
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kaboom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-03-
|
13
|
+
date: 2012-03-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: multi_json
|
17
|
-
requirement: &
|
17
|
+
requirement: &70170488566500 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 1.0.3
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70170488566500
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: json_pure
|
28
|
-
requirement: &
|
28
|
+
requirement: &70170488565980 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,10 +33,21 @@ dependencies:
|
|
33
33
|
version: 1.5.3
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70170488565980
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: active_support
|
39
|
+
requirement: &70170488565600 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
type: :runtime
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *70170488565600
|
37
48
|
- !ruby/object:Gem::Dependency
|
38
49
|
name: mocha
|
39
|
-
requirement: &
|
50
|
+
requirement: &70170488565040 !ruby/object:Gem::Requirement
|
40
51
|
none: false
|
41
52
|
requirements:
|
42
53
|
- - ~>
|
@@ -44,10 +55,10 @@ dependencies:
|
|
44
55
|
version: 0.9.9
|
45
56
|
type: :development
|
46
57
|
prerelease: false
|
47
|
-
version_requirements: *
|
58
|
+
version_requirements: *70170488565040
|
48
59
|
- !ruby/object:Gem::Dependency
|
49
60
|
name: rake
|
50
|
-
requirement: &
|
61
|
+
requirement: &70170488564520 !ruby/object:Gem::Requirement
|
51
62
|
none: false
|
52
63
|
requirements:
|
53
64
|
- - ~>
|
@@ -55,7 +66,7 @@ dependencies:
|
|
55
66
|
version: 0.9.2
|
56
67
|
type: :development
|
57
68
|
prerelease: false
|
58
|
-
version_requirements: *
|
69
|
+
version_requirements: *70170488564520
|
59
70
|
description: ! "This is a fork of Zach Holman's amazing boom. Explanation for\n the
|
60
71
|
fork follows Zach's intro to boom:\n\n God it's about every day where I think to
|
61
72
|
myself, gadzooks,\n I keep typing *REPETITIVE_BORING_TASK* over and over. Wouldn't
|
@@ -101,7 +112,6 @@ files:
|
|
101
112
|
- completion/boom.zsh
|
102
113
|
- kaboom.gemspec
|
103
114
|
- lib/kaboom.rb
|
104
|
-
- lib/kaboom/.command.rb.swo
|
105
115
|
- lib/kaboom/color.rb
|
106
116
|
- lib/kaboom/command.rb
|
107
117
|
- lib/kaboom/config.rb
|
@@ -110,6 +120,10 @@ files:
|
|
110
120
|
- lib/kaboom/list.rb
|
111
121
|
- lib/kaboom/output.rb
|
112
122
|
- lib/kaboom/platform.rb
|
123
|
+
- lib/kaboom/platform/base.rb
|
124
|
+
- lib/kaboom/platform/darwin.rb
|
125
|
+
- lib/kaboom/platform/linux.rb
|
126
|
+
- lib/kaboom/platform/windows.rb
|
113
127
|
- lib/kaboom/remote.rb
|
114
128
|
- lib/kaboom/storage.rb
|
115
129
|
- lib/kaboom/storage/base.rb
|
@@ -143,9 +157,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
143
157
|
- - ! '>='
|
144
158
|
- !ruby/object:Gem::Version
|
145
159
|
version: '0'
|
146
|
-
segments:
|
147
|
-
- 0
|
148
|
-
hash: -4015829161079492455
|
149
160
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
161
|
none: false
|
151
162
|
requirements:
|
@@ -166,3 +177,4 @@ test_files:
|
|
166
177
|
- test/test_list.rb
|
167
178
|
- test/test_platform.rb
|
168
179
|
- test/test_remote.rb
|
180
|
+
has_rdoc:
|
data/lib/kaboom/.command.rb.swo
DELETED
Binary file
|