boomboom 0.0.1 → 0.0.2
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.
- data/.gitignore +1 -0
- data/Gemfile +1 -0
- data/README.md +3 -0
- data/boomboom.gemspec +1 -1
- data/lib/boomboom/version.rb +1 -1
- data/lib/boomboom.rb +19 -18
- metadata +18 -2
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
data/boomboom.gemspec
CHANGED
@@ -18,8 +18,8 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.add_dependency('json', '~> 1.7.3')
|
19
19
|
gem.add_dependency('clipboard', '~> 1.0.1')
|
20
20
|
gem.add_dependency('launchy', '~> 2.1.0')
|
21
|
+
gem.add_dependency('colorize', '~> 0.5.8')
|
21
22
|
gem.post_install_message = %q|
|
22
|
-
|
23
23
|
***********************************************************
|
24
24
|
|
25
25
|
BoomBoom!!
|
data/lib/boomboom/version.rb
CHANGED
data/lib/boomboom.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'json'
|
2
2
|
require 'clipboard'
|
3
3
|
require 'launchy'
|
4
|
+
require 'colorize'
|
4
5
|
require 'pry'
|
5
6
|
|
6
7
|
class BoomBoom
|
@@ -13,7 +14,7 @@ class BoomBoom
|
|
13
14
|
|
14
15
|
def create_list(list)
|
15
16
|
@boom[list] = {}
|
16
|
-
puts "Boom! Created a new list called #{list.
|
17
|
+
puts "Boom!".colorize(:cyan) + " Created a new list called #{list.dup.colorize(:green)}."
|
17
18
|
end
|
18
19
|
|
19
20
|
def has_list?(list)
|
@@ -42,39 +43,39 @@ class BoomBoom
|
|
42
43
|
begin
|
43
44
|
value = the_list.fetch item
|
44
45
|
rescue
|
45
|
-
puts "#{item} not found in #{list}"
|
46
|
+
puts "#{item.dup.colorize(:magenta)}" + " not found in".colorize(:red) + " #{list.dup.colorize(:yellow)}"
|
46
47
|
end
|
47
48
|
value
|
48
49
|
rescue KeyError
|
49
|
-
puts "Oops! list #{list.
|
50
|
+
puts "Oops! list #{list.dup.colorize(:green)} was " + "not found".colorize(:red) + "... but we'll create it..."
|
50
51
|
create_list list
|
51
52
|
end
|
52
53
|
|
53
54
|
def copy_to_clipboard(txt)
|
54
55
|
return if txt.nil?
|
55
56
|
Clipboard.copy txt
|
56
|
-
puts "Boom! We just copied #{txt} to your clipboard."
|
57
|
+
puts "Boom!".colorize(:cyan) +" We just copied #{txt.dup.colorize(:yellow)} to your clipboard."
|
57
58
|
end
|
58
59
|
|
59
60
|
def set_list_item(list, item, value)
|
60
61
|
create_list list unless has_list? list
|
61
62
|
@boom[list][item] = value
|
62
|
-
puts "#{item} in #{list} is #{value}. Got it."
|
63
|
+
puts "#{item.dup.colorize(:magenta)} in #{list.dup.colorize(:green)} is #{value.dup.colorize(:yellow)}. Got it."
|
63
64
|
end
|
64
65
|
|
65
66
|
def delete_list(list)
|
66
67
|
@boom.fetch list
|
67
|
-
puts "You sure you want to delete everything in #{list}? (y/n):\n"
|
68
|
+
puts "You sure you want to delete everything in #{list.dup.colorize(:green)}? (y/n):\n"
|
68
69
|
decision = gets
|
69
70
|
decision.chop!
|
70
71
|
if decision == ?y
|
71
72
|
@boom.delete list
|
72
|
-
puts "Boom! Deleted all your #{list}."
|
73
|
+
puts "Boom! Deleted all your #{list.dup.colorize(:green)}."
|
73
74
|
elsif decision == ?n
|
74
75
|
puts "Just kidding then."
|
75
76
|
end
|
76
77
|
rescue KeyError
|
77
|
-
puts "The list #{list.
|
78
|
+
puts "The list #{list.dup.colorize(:green)} " + "doesn't exist".colorize(:red) + "."
|
78
79
|
end
|
79
80
|
|
80
81
|
def delete_list_item(list, item)
|
@@ -82,31 +83,31 @@ class BoomBoom
|
|
82
83
|
begin
|
83
84
|
value = @boom[list].fetch item
|
84
85
|
rescue KeyError
|
85
|
-
puts "The item #{item} doesn't exist in the list #{list}."
|
86
|
+
puts "The item #{item.dup.colorize(:magenta)} " + "doesn't exist".colorize(:red) + " in the list #{list.dup.colorize(:green)}."
|
86
87
|
return
|
87
88
|
end
|
88
89
|
@boom[list].delete item
|
89
|
-
puts "Boom! #{item} in #{list} is gone forever. It was #{value}."
|
90
|
+
puts "Boom!".colorize(:cyan) + " #{item.dup.colorize(:magenta)} in #{list.dup.colorize(:green)} is gone forever. It was #{value.dup.colorize(:yellow)}."
|
90
91
|
rescue KeyError
|
91
|
-
puts "The list #{list} doesn't exist."
|
92
|
+
puts "The list #{list.dup.colorize(:green)} " + "doesn't exist".colorize(:red) + "."
|
92
93
|
end
|
93
94
|
|
94
95
|
def print_list(list)
|
95
96
|
@boom[list].each do |k,v|
|
96
|
-
puts " #{k}:\t\t#{v}\n"
|
97
|
+
puts " #{k.dup.colorize(:magenta)}:\t\t#{v.dup.colorize(:yellow)}\n"
|
97
98
|
end
|
98
99
|
end
|
99
100
|
|
100
101
|
def print_all
|
101
102
|
@boom.keys.each do |k|
|
102
|
-
puts " #{k}"
|
103
|
+
puts " #{k.dup.colorize(:green)}"
|
103
104
|
print_list k
|
104
105
|
end
|
105
106
|
end
|
106
107
|
|
107
108
|
def print_boom_count
|
108
109
|
@boom.each do |k,v|
|
109
|
-
puts " #{k}\t (#{v.size})"
|
110
|
+
puts " #{k.dup.colorize(:green)}\t (#{v.dup.size})"
|
110
111
|
end
|
111
112
|
end
|
112
113
|
|
@@ -114,14 +115,14 @@ class BoomBoom
|
|
114
115
|
if has_item? target
|
115
116
|
item = get_item target
|
116
117
|
Launchy.open item
|
117
|
-
puts "Boom! We just opened #{item} for you."
|
118
|
+
puts "Boom!".colorize(:cyan) + " We just opened #{item.dup.colorize(:yellow)} for you."
|
118
119
|
elsif has_list? target
|
119
120
|
@boom[target].each do |k,v|
|
120
121
|
Launchy.open v
|
121
122
|
end
|
122
|
-
puts "Boom! We just opened all of \"#{target}\" for you."
|
123
|
+
puts "Boom!".colorize(:cyan) + " We just opened all of \"#{target.dup.colorize(:green)}\" for you."
|
123
124
|
else
|
124
|
-
puts "#{target} not found."
|
125
|
+
puts "#{target} " + "not found".colorize(:red) + "."
|
125
126
|
end
|
126
127
|
end
|
127
128
|
|
@@ -131,7 +132,7 @@ class BoomBoom
|
|
131
132
|
rand_item = the_list.keys[rand the_list.size]
|
132
133
|
open rand_item
|
133
134
|
else
|
134
|
-
puts "#{list} not found."
|
135
|
+
puts "#{list.dup.colorize(:green)} " + "not found".colorize(:red) + "."
|
135
136
|
end
|
136
137
|
end
|
137
138
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boomboom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -59,6 +59,22 @@ dependencies:
|
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 2.1.0
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: colorize
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.5.8
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.5.8
|
62
78
|
description: My Implementation of @holman's boom [https://github.com/holman/boom/]
|
63
79
|
email:
|
64
80
|
- prasann87@gmail.com
|
@@ -78,7 +94,7 @@ files:
|
|
78
94
|
- lib/boomboom/version.rb
|
79
95
|
homepage: https://github.com/npras/boomboom
|
80
96
|
licenses: []
|
81
|
-
post_install_message: ! "\n
|
97
|
+
post_install_message: ! "\n ***********************************************************\n\n
|
82
98
|
\ BoomBoom!!\n Become a Commandline Magician!\n Say thanks to @holman (he dreamt
|
83
99
|
of the idea first)\n and npras@github (he implemented it in his own style!).\n\n
|
84
100
|
\ ***********************************************************\n "
|