consular-gnome-terminal 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/.rspec +1 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +61 -0
- data/LICENSE.txt +674 -0
- data/README.rdoc +13 -0
- data/Rakefile +23 -0
- data/consular-gnome-terminal.gemspec +50 -0
- data/cucumber.yml +1 -0
- data/features/support/env.rb +18 -0
- data/lib/consular/gnome-terminal.rb +260 -0
- data/lib/consular/gnome-terminal/version.rb +16 -0
- data/spec/gnome-terminal_spec.rb +56 -0
- data/spec/spec_helper.rb +30 -0
- data/tests.watchr +151 -0
- metadata +210 -0
data/tests.watchr
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
#!/usr/bin/env watchr
|
2
|
+
# vim:ft=ruby
|
3
|
+
|
4
|
+
def have_notify_send?
|
5
|
+
case `which notify-send`.empty?
|
6
|
+
when true
|
7
|
+
false
|
8
|
+
else
|
9
|
+
true
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def have_growl?
|
14
|
+
@have_growl ||= begin
|
15
|
+
require 'growl'
|
16
|
+
rescue LoadError
|
17
|
+
false
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def error_icon_name
|
22
|
+
"gtk-dialog-error"
|
23
|
+
end
|
24
|
+
|
25
|
+
def success_icon_name
|
26
|
+
"gtk-dialog-info"
|
27
|
+
end
|
28
|
+
|
29
|
+
# Rules
|
30
|
+
watch('^spec/.+_spec\.rb$') { |md| spec md[0] }
|
31
|
+
watch('^lib/.+\.rb$') { |md| spec "spec/#{File.basename(md[0]).gsub(/\..*?$/, '')}_spec.rb" }
|
32
|
+
watch('^features/.+\.feature$') { |md| feature md[0] }
|
33
|
+
watch('^features/step_definitions/(.+)_steps\.rb$') { |md| feature "features/#{md[1]}.feature" }
|
34
|
+
|
35
|
+
# Notify using notify-send.
|
36
|
+
#
|
37
|
+
# @param icon [String] name of stock icon to use.
|
38
|
+
# @param title [String] title of notification.
|
39
|
+
# @param message [String] message for notification body.
|
40
|
+
# @return [Boolean] true if the command ran successfully, false
|
41
|
+
# otherwise.
|
42
|
+
def notify(icon, title, message)
|
43
|
+
system("notify-send -t 3000 -i #{icon} \"#{title}\" \"#{message}\"")
|
44
|
+
end
|
45
|
+
|
46
|
+
# Notify of success.
|
47
|
+
#
|
48
|
+
def notify_success
|
49
|
+
puts "Success"
|
50
|
+
if have_notify_send?
|
51
|
+
notify success_icon_name, "All green!", "Now write more tests :)"
|
52
|
+
elsif have_growl?
|
53
|
+
Growl.notify_ok "All green!"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Notify of failure.
|
58
|
+
#
|
59
|
+
def notify_failure
|
60
|
+
puts "Failure"
|
61
|
+
if have_notify_send?
|
62
|
+
notify error_icon_name, "Something is broken", "Now go fix it :)"
|
63
|
+
elsif have_growl?
|
64
|
+
Growl.notify_error "Something is broken"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# Run a single ruby command. Notify appropriately.
|
69
|
+
#
|
70
|
+
# @param cmd [String] command to run.
|
71
|
+
def run(cmd)
|
72
|
+
system('clear')
|
73
|
+
puts "Running #{cmd}"
|
74
|
+
if system(cmd)
|
75
|
+
notify_success
|
76
|
+
true
|
77
|
+
else
|
78
|
+
notify_failure
|
79
|
+
false
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# Run a single spec.
|
84
|
+
#
|
85
|
+
# @param specfiles [String] path to specfile or [Array] of paths.
|
86
|
+
def spec(specfiles)
|
87
|
+
specs = case specfiles.respond_to? :join
|
88
|
+
when true
|
89
|
+
specfiles.join(" ")
|
90
|
+
when false
|
91
|
+
specfiles
|
92
|
+
end
|
93
|
+
if run(%Q(rspec #{specs}))
|
94
|
+
if @last_run_failed
|
95
|
+
@last_run_failed = false
|
96
|
+
run_all_specs
|
97
|
+
end
|
98
|
+
else
|
99
|
+
@last_run_failed = true
|
100
|
+
end
|
101
|
+
!@last_run_failed
|
102
|
+
end
|
103
|
+
|
104
|
+
# Run a single feature.
|
105
|
+
#
|
106
|
+
# @param featurefiles [String] path to feature file or [Array] of paths.
|
107
|
+
def feature(featurefiles)
|
108
|
+
features = case featurefiles.respond_to? :join
|
109
|
+
when true
|
110
|
+
featurefiles.join(" ")
|
111
|
+
when false
|
112
|
+
featurefiles
|
113
|
+
end
|
114
|
+
run(%Q(cucumber #{features}))
|
115
|
+
end
|
116
|
+
|
117
|
+
# Run all specs.
|
118
|
+
#
|
119
|
+
def run_all_specs
|
120
|
+
spec Dir['spec/*_spec.rb']
|
121
|
+
end
|
122
|
+
|
123
|
+
# Run all features.
|
124
|
+
#
|
125
|
+
def run_features
|
126
|
+
feature Dir['features/*.feature']
|
127
|
+
end
|
128
|
+
|
129
|
+
# Run specs and features.
|
130
|
+
#
|
131
|
+
def run_suite
|
132
|
+
run_all_specs && run_features
|
133
|
+
end
|
134
|
+
|
135
|
+
# Run all specs on Ctrl-\
|
136
|
+
Signal.trap('QUIT') { run_all_specs }
|
137
|
+
|
138
|
+
# Run full suite on one Ctrl-C, quit on two
|
139
|
+
@interrupted = false
|
140
|
+
Signal.trap('INT') do
|
141
|
+
if @interrupted
|
142
|
+
abort("\n")
|
143
|
+
else
|
144
|
+
puts "Interrupt a second time to quit"
|
145
|
+
@interrupted = true
|
146
|
+
Kernel.sleep 1.5
|
147
|
+
run_suite
|
148
|
+
@interrupted = false
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
metadata
ADDED
@@ -0,0 +1,210 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: consular-gnome-terminal
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 1322991910812937300
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Jesse Cooke
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-10-23 00:00:00 -07:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: consular
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 2002549777813010636
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rake
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 2002549777813010636
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: rspec
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 2002549777813010636
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
type: :development
|
62
|
+
version_requirements: *id003
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: yard
|
65
|
+
prerelease: false
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 2002549777813010636
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
75
|
+
type: :development
|
76
|
+
version_requirements: *id004
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
name: cucumber
|
79
|
+
prerelease: false
|
80
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
hash: 2002549777813010636
|
86
|
+
segments:
|
87
|
+
- 0
|
88
|
+
version: "0"
|
89
|
+
type: :development
|
90
|
+
version_requirements: *id005
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: spork
|
93
|
+
prerelease: false
|
94
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
hash: 2002549777813010636
|
100
|
+
segments:
|
101
|
+
- 0
|
102
|
+
version: "0"
|
103
|
+
type: :development
|
104
|
+
version_requirements: *id006
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
name: watchr
|
107
|
+
prerelease: false
|
108
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
hash: 2002549777813010636
|
114
|
+
segments:
|
115
|
+
- 0
|
116
|
+
version: "0"
|
117
|
+
type: :development
|
118
|
+
version_requirements: *id007
|
119
|
+
- !ruby/object:Gem::Dependency
|
120
|
+
name: bundler
|
121
|
+
prerelease: false
|
122
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
hash: 2002549777813010636
|
128
|
+
segments:
|
129
|
+
- 0
|
130
|
+
version: "0"
|
131
|
+
type: :development
|
132
|
+
version_requirements: *id008
|
133
|
+
- !ruby/object:Gem::Dependency
|
134
|
+
name: mocha
|
135
|
+
prerelease: false
|
136
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
hash: 2002549777813010636
|
142
|
+
segments:
|
143
|
+
- 0
|
144
|
+
version: "0"
|
145
|
+
type: :development
|
146
|
+
version_requirements: *id009
|
147
|
+
description: Add support for automating the Gnome Terminal with Consular.
|
148
|
+
email:
|
149
|
+
- jesse@jc00ke.com
|
150
|
+
executables: []
|
151
|
+
|
152
|
+
extensions: []
|
153
|
+
|
154
|
+
extra_rdoc_files:
|
155
|
+
- LICENSE.txt
|
156
|
+
- README.rdoc
|
157
|
+
files:
|
158
|
+
- .gitignore
|
159
|
+
- .rspec
|
160
|
+
- Gemfile
|
161
|
+
- Gemfile.lock
|
162
|
+
- LICENSE.txt
|
163
|
+
- README.rdoc
|
164
|
+
- Rakefile
|
165
|
+
- consular-gnome-terminal.gemspec
|
166
|
+
- cucumber.yml
|
167
|
+
- features/support/env.rb
|
168
|
+
- lib/consular/gnome-terminal.rb
|
169
|
+
- lib/consular/gnome-terminal/version.rb
|
170
|
+
- spec/gnome-terminal_spec.rb
|
171
|
+
- spec/spec_helper.rb
|
172
|
+
- tests.watchr
|
173
|
+
has_rdoc: true
|
174
|
+
homepage: http://github.com/jc00ke/consular-gnome-terminal
|
175
|
+
licenses:
|
176
|
+
- GPLv3
|
177
|
+
post_install_message:
|
178
|
+
rdoc_options: []
|
179
|
+
|
180
|
+
require_paths:
|
181
|
+
- lib
|
182
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
183
|
+
none: false
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
hash: 2002549777813010636
|
188
|
+
segments:
|
189
|
+
- 0
|
190
|
+
version: "0"
|
191
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
|
+
none: false
|
193
|
+
requirements:
|
194
|
+
- - ">="
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
hash: 2002549777813010636
|
197
|
+
segments:
|
198
|
+
- 0
|
199
|
+
version: "0"
|
200
|
+
requirements: []
|
201
|
+
|
202
|
+
rubyforge_project:
|
203
|
+
rubygems_version: 1.5.2
|
204
|
+
signing_key:
|
205
|
+
specification_version: 3
|
206
|
+
summary: Gnome Terminal support for Consular
|
207
|
+
test_files:
|
208
|
+
- features/support/env.rb
|
209
|
+
- spec/gnome-terminal_spec.rb
|
210
|
+
- spec/spec_helper.rb
|