consular 1.0.0.rc1 → 1.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +101 -202
- data/lib/consular/cli.rb +26 -1
- data/lib/consular/dsl.rb +2 -9
- data/lib/consular/version.rb +1 -1
- data/spec/cli_spec.rb +38 -0
- metadata +4 -5
- data/Gemfile.lock +0 -28
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,86 +1,106 @@
|
|
1
|
-
|
1
|
+
Consular
|
2
2
|
===========
|
3
|
+
Formally known as *Terminitor*
|
3
4
|
|
4
|
-
|
5
|
+
Consular automates your development workflow setup. Less time setting up, more time getting things done.
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
WTFBBQ name change?
|
8
|
+
-------------------
|
8
9
|
|
9
|
-
|
10
|
+
There are a few reasons why the name change happened. To state it simply:
|
10
11
|
|
11
|
-
|
12
|
+
* Terminitor apparently was a pretty difficult name to spell, was
|
13
|
+
a bit awkward, and the 'i' appeared in a place you didn't expect.
|
14
|
+
* It's a pretty long name to type.
|
15
|
+
* console => consul(ar).
|
12
16
|
|
13
|
-
This will move your terminitor files to the new directory located at .config/terminitor
|
14
17
|
|
15
|
-
|
18
|
+
So what's new/different? let's start.
|
19
|
+
|
20
|
+
Setup && Installation
|
16
21
|
------------
|
17
22
|
|
18
|
-
|
19
|
-
|
23
|
+
Install the consular gem and `init`:
|
24
|
+
|
25
|
+
```bash
|
26
|
+
$ gem install consular --pre
|
27
|
+
$ consular init
|
28
|
+
```
|
29
|
+
|
30
|
+
This will generate a global path directory for your scripts to live in
|
31
|
+
at `~/.config/consular` and also a `.consularc` in your home directory.
|
32
|
+
You can customize your Consular further with `.consularc`. Say for
|
33
|
+
example, that you didn't like the default global path:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
# ~/.consularc
|
37
|
+
|
38
|
+
Consular.configure do |c|
|
39
|
+
c.global_path = '/a/path/i/like/better'
|
40
|
+
end
|
41
|
+
```
|
42
|
+
|
20
43
|
|
21
44
|
Development Setup
|
22
45
|
---------------------
|
23
46
|
|
24
|
-
To begin development on
|
47
|
+
To begin development on Consular, run bundler:
|
25
48
|
|
26
49
|
$ gem install bundler
|
27
50
|
$ bundle install
|
28
51
|
|
29
|
-
The test suite uses
|
52
|
+
The test suite uses Minitest
|
30
53
|
to run the test run:
|
31
54
|
|
32
55
|
$ rake test
|
33
56
|
|
34
57
|
or use watchr:
|
35
58
|
|
36
|
-
$ watchr
|
37
|
-
|
38
|
-
or if you have terminitor installed,
|
39
|
-
|
40
|
-
$ terminitor fetch achiu terminitor
|
41
|
-
|
42
|
-
this will git clone the repo and bundle install.
|
59
|
+
$ watchr spec.watchr
|
43
60
|
|
44
61
|
Usage
|
45
62
|
-------
|
46
63
|
|
47
64
|
### Creating Local Projects ###
|
48
65
|
|
49
|
-
Using
|
66
|
+
Using consular is quite easy. To define or edit a project file, simply invoke the command:
|
50
67
|
|
51
|
-
$
|
68
|
+
$ consular edit foo
|
52
69
|
|
53
70
|
This will open your default editor (set through the $TERM_EDITOR or $EDITOR variable in BASH) and you can proceed to define the commands for that project with the following syntaxes:
|
54
71
|
|
55
72
|
#### YAML Syntax ( Legacy ) ####
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
+
|
74
|
+
```yaml
|
75
|
+
# ~/.config/consular/foo.yml
|
76
|
+
# you can make as many tabs as you wish...
|
77
|
+
# tab names are actually arbitrary at this point too.
|
78
|
+
---
|
79
|
+
- tab1:
|
80
|
+
- cd ~/foo/bar
|
81
|
+
- gitx
|
82
|
+
- tab2:
|
83
|
+
- mysql -u root)
|
84
|
+
- use test;
|
85
|
+
- show tables;
|
86
|
+
- tab3: echo "hello world"
|
87
|
+
- tab4: cd ~/baz/ && git pull
|
88
|
+
- tab5:
|
89
|
+
- cd ~/foo/project
|
90
|
+
- autotest
|
91
|
+
```
|
73
92
|
|
74
93
|
Simply define each tab and declare the commands. Note that the session for each tab is maintained, so you just declare actions here as
|
75
94
|
you would manually type in the terminal. Note that the title for each tab(namely tab1, tab2) are arbitrary, and can be named whatever you want.
|
76
95
|
They are simply placeholders for the time being for upcoming features.
|
77
96
|
|
78
|
-
To use the legacy syntax, you can invoke it with
|
97
|
+
To use the legacy syntax, you can invoke it with consular by appending
|
98
|
+
the 'yml' file extension like so:
|
79
99
|
|
80
|
-
$
|
100
|
+
$ consular edit foo.yml
|
81
101
|
|
82
102
|
It is recommended that you move over to the newer Ruby DSL Syntax as it
|
83
|
-
provides more robust features, however
|
103
|
+
provides more robust features, however consular will still support the older
|
84
104
|
YAML syntax.
|
85
105
|
|
86
106
|
|
@@ -94,10 +114,13 @@ tab "echo 'default'", "echo 'default tab'"
|
|
94
114
|
|
95
115
|
window do
|
96
116
|
before { run 'cd /path' } # run this command before each command.
|
97
|
-
|
98
|
-
run 'padrino start' # run in new window
|
99
117
|
|
100
|
-
|
118
|
+
# run in new window
|
119
|
+
run 'padrino start'
|
120
|
+
|
121
|
+
# create a new tab in window and run it.
|
122
|
+
tab "echo 'first tab'", "echo 'of window'"
|
123
|
+
|
101
124
|
tab "named tab" do
|
102
125
|
run "echo 'named tab'"
|
103
126
|
run "ls"
|
@@ -182,83 +205,43 @@ or with a block:
|
|
182
205
|
setup do
|
183
206
|
run "echo 'hi'"
|
184
207
|
run "bundle install"
|
185
|
-
run 'git remote add upstream git://github.com/achiu/
|
208
|
+
run 'git remote add upstream git://github.com/achiu/consular.git'
|
186
209
|
end
|
187
210
|
````
|
188
211
|
|
189
212
|
|
190
213
|
Once defined, you can invoke your projects setup with:
|
191
214
|
|
192
|
-
|
193
|
-
|
194
|
-
##### Settings #####
|
195
|
-
_currently only available for Mac OSX Terminal_
|
196
|
-
|
197
|
-
You can also set settings on each of your tabs and windows. for example, this is possible:
|
198
|
-
|
199
|
-
Open a tab with terminal settings "Grass"
|
200
|
-
|
201
|
-
````ruby
|
202
|
-
tab :name => "named tab", :settings => "Grass" do
|
203
|
-
run "echo 'named tab'"
|
204
|
-
run "ls"
|
205
|
-
end
|
206
|
-
````
|
207
|
-
|
208
|
-
This will create a tab with a title of 'named tab' using Terminals 'Grass' setting.
|
209
|
-
|
210
|
-
|
211
|
-
How about a window with a specific size:
|
212
|
-
|
213
|
-
````ruby
|
214
|
-
window :bounds => [10,20,300,200] do
|
215
|
-
|
216
|
-
end
|
217
|
-
````
|
218
|
-
|
219
|
-
Currently, the following options are available:
|
220
|
-
|
221
|
-
__tabs__
|
222
|
-
|
223
|
-
* :settings - [String] Set the tab to terminal settings
|
224
|
-
* :selected - [Boolean] Sets whether the tab is active
|
225
|
-
* :miniaturized - [Boolean] Sets whether its miniaturized
|
226
|
-
* :visible - [Boolean] Sets whether its visible
|
227
|
-
|
228
|
-
|
229
|
-
__windows__
|
230
|
-
|
231
|
-
* :bounds - [Array] Sets the bounds
|
232
|
-
* :miniaturized - [Boolean] Sets whether its miniaturized
|
233
|
-
* :visible - [Boolean] Sets whether its visible
|
215
|
+
consular setup my_project
|
234
216
|
|
235
|
-
### Running
|
217
|
+
### Running Consular Projects ###
|
236
218
|
|
237
|
-
Once the project file has been declared to your satisfaction, simply execute any project defined in the `~/.config/
|
219
|
+
Once the project file has been declared to your satisfaction, simply execute any project defined in the `~/.config/consular` directory with:
|
238
220
|
|
239
|
-
$
|
221
|
+
$ consular start foo
|
240
222
|
|
241
223
|
This will execute the steps and create the tabs defined and run the various options as expected. That's it. Create as many project files with as many tabs
|
242
224
|
as you would like and automate your workflow.
|
243
225
|
|
244
|
-
### Removing
|
226
|
+
### Removing Consular Projects ###
|
245
227
|
|
246
|
-
If you no longer need a particular project, you can easily remove the
|
228
|
+
If you no longer need a particular project, you can easily remove the consular file for the project:
|
247
229
|
|
248
|
-
$
|
230
|
+
$ consular delete foo
|
249
231
|
|
250
|
-
to remove a legacy yml syntax file you can
|
232
|
+
to remove a legacy yml syntax file you can just append the file
|
233
|
+
extension and run:
|
251
234
|
|
252
|
-
$
|
235
|
+
$ consular delete foo.yml
|
253
236
|
|
254
237
|
|
255
|
-
### Listing
|
238
|
+
### Listing Consular Projects ###
|
256
239
|
|
257
240
|
You can also see a full list of available projects with:
|
258
241
|
|
259
|
-
$
|
242
|
+
$ consular list
|
260
243
|
|
261
|
-
This will print out the available project files that you can execute. The list also returns whatever text you have in the first comment of each
|
244
|
+
This will print out the available project files that you can execute. The list also returns whatever text you have in the first comment of each consular script.
|
262
245
|
|
263
246
|
### Creating Termfile for Repo ###
|
264
247
|
|
@@ -270,18 +253,17 @@ For example, let's say I am in `/code/my/foo/project` directory which is
|
|
270
253
|
a Sinatra application. This application might have a `Gemfile` which includes all dependencies. You can also generate a `Termfile`
|
271
254
|
which contains the ideal development setup for OSX. To generate this file, invoke:
|
272
255
|
|
273
|
-
$
|
256
|
+
$ consular create
|
274
257
|
|
275
258
|
This will generate a 'Termfile' in the current project directory and open the file to be edited in the default text editor. The format
|
276
|
-
of the file is using the new Ruby DSL as described above in the previous section.
|
277
|
-
the working directory for each tab so you can just say `mate .` and the project directory containing the `Termfile` will open.
|
259
|
+
of the file is using the new Ruby DSL as described above in the previous section.
|
278
260
|
|
279
261
|
Now, when you or another developer clones a project, you could simply:
|
280
262
|
|
281
263
|
$ git clone git://path/to/my/foo/project.git
|
282
264
|
$ cd project
|
283
|
-
$
|
284
|
-
$
|
265
|
+
$ consular setup
|
266
|
+
$ consular start
|
285
267
|
|
286
268
|
This would clone the project repo, and then install all dependencies and then launch the ideal development environment for the project. Clearly
|
287
269
|
this makes assumptions about the user's system setup right now, but we have some ideas on how to make this work more effectively on
|
@@ -289,112 +271,31 @@ different configurations in the future.
|
|
289
271
|
|
290
272
|
In addition, you are in the project folder and you wish to remove the Termfile, you can invoke the command:
|
291
273
|
|
292
|
-
$
|
274
|
+
$ consular delete
|
293
275
|
|
294
276
|
This will clear the `Termfile` for the particular project.
|
295
277
|
|
296
|
-
### Capturing Terminal Settings with Terminitor ###
|
297
|
-
_Currently Mac OSX Terminal only_
|
298
|
-
Terminitor has the ability to also capture your terminal setup and settings simply with:
|
299
|
-
|
300
|
-
$ terminitor edit my_project --capture
|
301
|
-
|
302
|
-
this will open up a new terminitor project with the captured settings for you to continuing modifying as you see fit.
|
303
|
-
|
304
|
-
|
305
|
-
### Fetching Github Projects with Terminitor ###
|
306
|
-
|
307
|
-
Terminitor can also fetch code repositories off Github. This will have terminitor clone the repo into the current directory:
|
308
|
-
|
309
|
-
$ terminitor fetch achiu terminitor
|
310
|
-
|
311
|
-
After the repo has been fetched, terminitor will go ahead and run the setup block from the Termfile included in the repository. In the event you wouldn't want the setup block to be executed, simply set setup to false:
|
312
|
-
|
313
|
-
$ terminitor fetch achiu terminitor --setup=false
|
314
|
-
|
315
|
-
Some notes. Terminitor's fetch command is dependent on the ([github-gem](http://github.com/defunkt/github-gem)) at the current moment. It will try to fetch the repository with read/write access first if you have rights, if not, it will default to git read only. Happy fetching!
|
316
|
-
|
317
|
-
|
318
278
|
Cores
|
319
279
|
-----
|
320
280
|
|
321
|
-
Cores allow
|
322
|
-
|
323
|
-
|
324
|
-
* KonsoleCore - KDE Konsole
|
325
|
-
* TerminatorCore - [Terminator](http://www.tenshu.net/terminator/)
|
326
|
-
* ITermCore - Mac OS X iTerm
|
327
|
-
|
328
|
-
Feel free to contribute more cores so that Terminitor can support your terminal of choice :)
|
329
|
-
|
330
|
-
|
331
|
-
Limitations
|
332
|
-
-----------
|
333
|
-
|
334
|
-
#### MacCore ####
|
335
|
-
|
336
|
-
Right now the Mac OS X Terminal tabs are created by invoking keystrokes which means there are limitations with the terminal being in
|
337
|
-
focus during execution of these commands. Obviously the long term goal is to solve this issue as well but in all honesty, this solution works well enough most of the time.
|
338
|
-
|
281
|
+
Cores allow Consular to operate on a variety of platforms. They abstract the general behavior that consular needs to run the commands.
|
282
|
+
Each core inherits from ([Consular::Core](http://github.com/achiu/consular/blob/master/lib/consular/core.rb)) and defines the needed methods.
|
283
|
+
Some of the cores that are available are:
|
339
284
|
|
340
|
-
|
285
|
+
* [OSX](http://www.github.com/achiu/consular-osx) - Mac OS X Terminal
|
286
|
+
* [Terminator](https://github.com/ilkka/consular-terminator) - Terminator
|
341
287
|
|
342
|
-
|
343
|
-
and settings functionality will be integrated soon.
|
288
|
+
Feel free to contribute more cores so that Consular can support your terminal of choice :)
|
344
289
|
|
345
|
-
|
290
|
+
To integrate core support for your Consular, you can simply require it
|
291
|
+
in your `.consularc` like so:
|
346
292
|
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
end
|
352
|
-
pane 'ls' # first pane level => vertical split
|
353
|
-
end
|
354
|
-
|
355
|
-
should result into something like this:
|
356
|
-
|
357
|
-
# ###########################
|
358
|
-
# # # #
|
359
|
-
# # # #
|
360
|
-
# # 'gitx' # #
|
361
|
-
# # # #
|
362
|
-
# # # #
|
363
|
-
# ############## 'ls' #
|
364
|
-
# # # #
|
365
|
-
# # # #
|
366
|
-
# # 'irb' # #
|
367
|
-
# # # #
|
368
|
-
# # # #
|
369
|
-
# ###########################
|
370
|
-
|
371
|
-
It is not possible to split the second level panes (the horizontal
|
372
|
-
ones). Nevertheless you should be able to split tabs into any kind of pane pattern you wish
|
373
|
-
with this syntax.
|
374
|
-
|
375
|
-
|
376
|
-
#### Fetching ####
|
377
|
-
|
378
|
-
The fetch task only pulls off Github repositories at the moment. Later on, this functionality will be extended to non github repository.
|
379
|
-
|
380
|
-
|
381
|
-
#### Settings and Captures ####
|
382
|
-
|
383
|
-
This feature is currently only available in Mac OS X at the moment.
|
384
|
-
|
385
|
-
|
386
|
-
#### Terminator support ####
|
387
|
-
|
388
|
-
This feature currently requires the "xdotool" utility to be installed and in
|
389
|
-
the search path. The xdotool homepage is
|
390
|
-
http://www.semicomplete.com/blog/projects/xdotool/.
|
391
|
-
|
392
|
-
|
393
|
-
#### Windows suppport ####
|
394
|
-
|
395
|
-
Windows support is currently limited to plain cmd.exe. It is also
|
396
|
-
limited to only creating new windows, as cmd.exe does not support tabs.
|
293
|
+
```ruby
|
294
|
+
# .consularc
|
295
|
+
require 'consular/osx'
|
296
|
+
```
|
397
297
|
|
298
|
+
Or check the README of each individual core.
|
398
299
|
|
399
300
|
Authors
|
400
301
|
-------
|
@@ -415,8 +316,8 @@ Thanks to the following people for their contributions so far:
|
|
415
316
|
* Elliot Winkler ([mcmire](https://github.com/mcmire)) for adding 1.8.6 compatiblity and ensuring tabs open in order and fixing named tabs
|
416
317
|
* Justin Hilemen ([bobthecow](https://github.com/bobthecow)) for fixing the list command to remove the term extensions.
|
417
318
|
* Dave Perrett ([recurser](https://github.com/recurser)) for adding basic iTerm support.
|
418
|
-
* Ilkka Laukkanen ([ilkka](https://github.com/achiu/
|
419
|
-
* Elia Schito ([elia](https://github.com/achiu/
|
319
|
+
* Ilkka Laukkanen ([ilkka](https://github.com/achiu/consular/commits/master?author=ilkka)) for Terminator core and other fixes
|
320
|
+
* Elia Schito ([elia](https://github.com/achiu/consular/commits/master?author=elia)) for patch to allow usage of "&" for background operations
|
420
321
|
* Dotan J. Nahum ([jondot](https://github.com/jondot)) for adding windows(cmd.exe) support
|
421
322
|
* Kyriacos Souroullas ([kyriacos](https://github.com/kyriacos) for removing params to support generic commands
|
422
323
|
* Jerry Cheung ([jch](https://github.com/jch)) for adding ignore for emac backups
|
@@ -425,8 +326,6 @@ Thanks to the following people for their contributions so far:
|
|
425
326
|
Acknowledgements
|
426
327
|
-----------------
|
427
328
|
|
428
|
-
|
429
|
-
|
430
329
|
The core terminal scripting code was initially developed by [Jeff Emminger](http://workingwithrails.com/person/2412-jeff-emminger) years ago. The original introduction was made on the [ELCTech Blog](http://blog.elctech.com/2008/01/16/script-terminal-with-terminit/) and a lot of that code was adapted from [Scripting the Terminal in Leopard](http://onrails.org/articles/2007/11/28/scripting-the-leopard-terminal).
|
431
330
|
|
432
331
|
This was a great start and made terminal automation easy. However, the repository died long ago, and we had continued using the code for a while.
|
data/lib/consular/cli.rb
CHANGED
@@ -146,8 +146,33 @@ module Consular
|
|
146
146
|
#
|
147
147
|
# @api private
|
148
148
|
def valid_core
|
149
|
-
Consular.cores.
|
149
|
+
cores = Consular.cores.select { |core| core.valid_system? }
|
150
|
+
if cores.nil? || cores.empty?
|
151
|
+
say "No valid core was found!. Exiting...", :red
|
152
|
+
raise SystemExit
|
153
|
+
elsif cores.size > 1
|
154
|
+
core_selection cores
|
155
|
+
else
|
156
|
+
cores.first
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
# Returns a dialoag to select the desired core.
|
161
|
+
#
|
162
|
+
# @param [Array<Core>] Array of cores
|
163
|
+
#
|
164
|
+
# @return [Core] core from selection
|
165
|
+
#
|
166
|
+
# @api private
|
167
|
+
def core_selection(cores)
|
168
|
+
say "Multiple cores match the current system:", :yellow
|
169
|
+
cores.each_with_index do |core, index|
|
170
|
+
say " [#{index}] - #{core.to_s}"
|
171
|
+
end
|
172
|
+
num = ask "Please select the number choice of the core to use: "
|
173
|
+
cores[num.to_i]
|
150
174
|
end
|
175
|
+
|
151
176
|
# Returns the first comment in file. This is used
|
152
177
|
# as the title when listing out the scripts.
|
153
178
|
#
|
data/lib/consular/dsl.rb
CHANGED
@@ -184,15 +184,6 @@ module Consular
|
|
184
184
|
@_context = @_old_context
|
185
185
|
end
|
186
186
|
|
187
|
-
def clean_up_context(context = last_open_window, old_context = nil)
|
188
|
-
@_context = context
|
189
|
-
@_old_context = old_context
|
190
|
-
end
|
191
|
-
|
192
|
-
def last_open_window
|
193
|
-
@_windows[@_windows.keys.last]
|
194
|
-
end
|
195
|
-
|
196
187
|
# Return the default hash format for windows
|
197
188
|
#
|
198
189
|
# @api private
|
@@ -200,6 +191,8 @@ module Consular
|
|
200
191
|
{:tabs => {'default' =>{:commands=>[]}}}.dup
|
201
192
|
end
|
202
193
|
|
194
|
+
# Contains interpretation for the legacy YAML format.
|
195
|
+
#
|
203
196
|
module Yaml
|
204
197
|
# Returns yaml file as formmatted hash
|
205
198
|
#
|
data/lib/consular/version.rb
CHANGED
data/spec/cli_spec.rb
CHANGED
@@ -49,9 +49,14 @@ describe Consular::CLI do
|
|
49
49
|
FileUtils.touch '/tmp/Termfile'
|
50
50
|
FileUtils.touch Consular.global_path('foo.term')
|
51
51
|
FileUtils.touch Consular.global_path('foo.yml')
|
52
|
+
Consular.instance_variable_set(:@cores,[])
|
52
53
|
Consular.add_core FakeCore
|
53
54
|
end
|
54
55
|
|
56
|
+
after do
|
57
|
+
Consular.instance_variable_set(:@cores,[])
|
58
|
+
end
|
59
|
+
|
55
60
|
it "should start a Termfile" do
|
56
61
|
output = capture_io { Consular::CLI.start ['start', '-r=/tmp'] }.join('')
|
57
62
|
assert_match /process/, output
|
@@ -71,6 +76,20 @@ describe Consular::CLI do
|
|
71
76
|
output = capture_io { Consular::CLI.start ['start', 'barr'] }.join('')
|
72
77
|
assert_match /does not exist/, output
|
73
78
|
end
|
79
|
+
|
80
|
+
it "should SystemExit if no core can be found" do
|
81
|
+
Consular.instance_variable_set(:@cores,[])
|
82
|
+
assert_raises SystemExit do
|
83
|
+
capture_io { Consular::CLI.start ['start', 'foo'] }.join('')
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should bring up a core selection if more than one matching core" do
|
88
|
+
Consular::CLI.any_instance.expects(:core_selection).with(anything).returns(FakeCore)
|
89
|
+
Consular.add_core FakeCore
|
90
|
+
Consular.add_core FakeCore
|
91
|
+
assert capture_io { Consular::CLI.start ['start', 'foo'] }.join('')
|
92
|
+
end
|
74
93
|
end
|
75
94
|
|
76
95
|
describe "setup command" do
|
@@ -79,9 +98,14 @@ describe Consular::CLI do
|
|
79
98
|
FileUtils.touch '/tmp/Termfile'
|
80
99
|
FileUtils.touch Consular.global_path('foo.term')
|
81
100
|
FileUtils.touch Consular.global_path('foo.yml')
|
101
|
+
Consular.instance_variable_set(:@cores,[])
|
82
102
|
Consular.add_core FakeCore
|
83
103
|
end
|
84
104
|
|
105
|
+
after do
|
106
|
+
Consular.instance_variable_set(:@cores,[])
|
107
|
+
end
|
108
|
+
|
85
109
|
it "should setup a Termfile" do
|
86
110
|
output = capture_io { Consular::CLI.start ['setup', '-r=/tmp'] }.join('')
|
87
111
|
assert_match /setup/, output
|
@@ -101,6 +125,20 @@ describe Consular::CLI do
|
|
101
125
|
output = capture_io { Consular::CLI.start ['setup', 'barr'] }.join('')
|
102
126
|
assert_match /does not exist/, output
|
103
127
|
end
|
128
|
+
|
129
|
+
it "should SystemExit if no core can be found" do
|
130
|
+
Consular.instance_variable_set(:@cores,[])
|
131
|
+
assert_raises SystemExit do
|
132
|
+
capture_io { Consular::CLI.start ['setup', 'foo'] }.join('')
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
it "should bring up a core selection if more than one matching core" do
|
137
|
+
Consular::CLI.any_instance.expects(:core_selection).with(anything).returns(FakeCore)
|
138
|
+
Consular.add_core FakeCore
|
139
|
+
Consular.add_core FakeCore
|
140
|
+
assert capture_io { Consular::CLI.start ['setup', 'foo'] }.join('')
|
141
|
+
end
|
104
142
|
end
|
105
143
|
|
106
144
|
it "init creates a new global script directory and consularc" do
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: consular
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15424049
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
9
|
- 0
|
10
10
|
- rc
|
11
|
-
-
|
12
|
-
version: 1.0.0.
|
11
|
+
- 2
|
12
|
+
version: 1.0.0.rc2
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Arthur Chiu
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-10-
|
20
|
+
date: 2011-10-22 00:00:00 -07:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
@@ -102,7 +102,6 @@ extra_rdoc_files: []
|
|
102
102
|
files:
|
103
103
|
- .gitignore
|
104
104
|
- Gemfile
|
105
|
-
- Gemfile.lock
|
106
105
|
- LICENSE
|
107
106
|
- README.md
|
108
107
|
- Rakefile
|
data/Gemfile.lock
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
consular (1.0.0)
|
5
|
-
activesupport
|
6
|
-
thor
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: http://rubygems.org/
|
10
|
-
specs:
|
11
|
-
activesupport (3.1.1)
|
12
|
-
multi_json (~> 1.0)
|
13
|
-
fakefs (0.3.1)
|
14
|
-
metaclass (0.0.1)
|
15
|
-
minitest (2.6.1)
|
16
|
-
mocha (0.10.0)
|
17
|
-
metaclass (~> 0.0.1)
|
18
|
-
multi_json (1.0.3)
|
19
|
-
thor (0.14.6)
|
20
|
-
|
21
|
-
PLATFORMS
|
22
|
-
ruby
|
23
|
-
|
24
|
-
DEPENDENCIES
|
25
|
-
consular!
|
26
|
-
fakefs
|
27
|
-
minitest
|
28
|
-
mocha
|