consular 1.0.1 → 1.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/README.md +31 -277
- data/lib/consular/cli.rb +1 -1
- data/lib/consular/core.rb +2 -2
- data/lib/consular/version.rb +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -1,21 +1,9 @@
|
|
1
1
|
Consular
|
2
2
|
===========
|
3
|
-
Formally known as *Terminitor*
|
4
3
|
|
5
|
-
Consular automates your development workflow setup.
|
4
|
+
Consular automates your development workflow setup.
|
6
5
|
|
7
|
-
|
8
|
-
-------------------
|
9
|
-
|
10
|
-
There are a few reasons why the name change happened. To state it simply:
|
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).
|
16
|
-
|
17
|
-
|
18
|
-
So what's new/different? let's start.
|
6
|
+
Read the rest of the README and check out the [wiki](https://github.com/achiu/consular/wiki) for more info!
|
19
7
|
|
20
8
|
Setup && Installation
|
21
9
|
------------
|
@@ -23,7 +11,7 @@ Setup && Installation
|
|
23
11
|
Install the consular gem and `init`:
|
24
12
|
|
25
13
|
```bash
|
26
|
-
$ gem install consular
|
14
|
+
$ gem install consular
|
27
15
|
$ consular init
|
28
16
|
```
|
29
17
|
|
@@ -40,240 +28,10 @@ Consular.configure do |c|
|
|
40
28
|
end
|
41
29
|
```
|
42
30
|
|
31
|
+
## IMPORTANT ##
|
43
32
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
To begin development on Consular, run bundler:
|
48
|
-
|
49
|
-
$ gem install bundler
|
50
|
-
$ bundle install
|
51
|
-
|
52
|
-
The test suite uses Minitest
|
53
|
-
to run the test run:
|
54
|
-
|
55
|
-
$ rake test
|
56
|
-
|
57
|
-
or use watchr:
|
58
|
-
|
59
|
-
$ watchr spec.watchr
|
60
|
-
|
61
|
-
Usage
|
62
|
-
-------
|
63
|
-
|
64
|
-
### Creating Local Projects ###
|
65
|
-
|
66
|
-
Using consular is quite easy. To define or edit a project file, simply invoke the command:
|
67
|
-
|
68
|
-
$ consular edit foo
|
69
|
-
|
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:
|
71
|
-
|
72
|
-
#### YAML Syntax ( Legacy ) ####
|
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
|
-
```
|
92
|
-
|
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
|
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.
|
95
|
-
They are simply placeholders for the time being for upcoming features.
|
96
|
-
|
97
|
-
To use the legacy syntax, you can invoke it with consular by appending
|
98
|
-
the 'yml' file extension like so:
|
99
|
-
|
100
|
-
$ consular edit foo.yml
|
101
|
-
|
102
|
-
It is recommended that you move over to the newer Ruby DSL Syntax as it
|
103
|
-
provides more robust features, however consular will still support the older
|
104
|
-
YAML syntax.
|
105
|
-
|
106
|
-
|
107
|
-
#### Ruby DSL Syntax ####
|
108
|
-
|
109
|
-
````ruby
|
110
|
-
setup 'echo "setup"' # code to run during setup
|
111
|
-
|
112
|
-
# open a tab in current window with these commands
|
113
|
-
tab "echo 'default'", "echo 'default tab'"
|
114
|
-
|
115
|
-
window do
|
116
|
-
before { run 'cd /path' } # run this command before each command.
|
117
|
-
|
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
|
-
|
124
|
-
tab "named tab" do
|
125
|
-
run "echo 'named tab'"
|
126
|
-
run "ls"
|
127
|
-
end
|
128
|
-
end
|
129
|
-
````
|
130
|
-
|
131
|
-
The newer Ruby DSL syntax allows for more complicated behavior such as window creation as well as setup blocks that can be executed prior loading a project.
|
132
|
-
|
133
|
-
##### Tabs #####
|
134
|
-
|
135
|
-
to create tabs, we can simply invoke the tab command with either the command arguments like:
|
136
|
-
|
137
|
-
````ruby
|
138
|
-
tab "echo 'hi'", "gitx"
|
139
|
-
````
|
140
|
-
|
141
|
-
or even pass it a block:
|
142
|
-
|
143
|
-
````ruby
|
144
|
-
tab do
|
145
|
-
run "echo 'hi'"
|
146
|
-
run "mate ."
|
147
|
-
end
|
148
|
-
````
|
149
|
-
|
150
|
-
##### Windows #####
|
151
|
-
|
152
|
-
to create windows, we can simply invoke the window command with a block containing additional commands like:
|
153
|
-
|
154
|
-
````ruby
|
155
|
-
window do
|
156
|
-
|
157
|
-
run "whoami" # Runs the command in the current window.
|
158
|
-
|
159
|
-
tab "echo 'hi'" # Creates another tab
|
160
|
-
tab "mate ." # And another
|
161
|
-
tab do # Last hoorah
|
162
|
-
run "open http://www.google.com"
|
163
|
-
end
|
164
|
-
end
|
165
|
-
````
|
166
|
-
|
167
|
-
##### Before #####
|
168
|
-
|
169
|
-
Sometimes you'll want to create a few commands that you want to run in each tab instance. You can do that with 'before':
|
170
|
-
|
171
|
-
````ruby
|
172
|
-
before { run "cd /path" } # execute this command before other commands in the default window
|
173
|
-
run "whoami"
|
174
|
-
tab 'uptime'
|
175
|
-
|
176
|
-
# In this instance, "cd /path" wil be executed in the default window before 'whoami'
|
177
|
-
# and also in the tab before 'uptime'.
|
178
|
-
# You can also use this inside a specific window context:
|
179
|
-
|
180
|
-
window do
|
181
|
-
before 'cd /tmp'
|
182
|
-
run 'watchr test.watchr' # "cd /tmp" first than run watchr
|
183
|
-
|
184
|
-
tab do
|
185
|
-
run 'padrino start' # "cd /tmp" is ran beforehand and then padrino start is executed
|
186
|
-
end
|
187
|
-
end
|
188
|
-
````
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
##### Setup #####
|
193
|
-
|
194
|
-
The setup block allows you to store commands that can be ran specifically before a project and can be defined with:
|
195
|
-
|
196
|
-
the command arguments:
|
197
|
-
|
198
|
-
````ruby
|
199
|
-
setup "bundle install", "gitx"
|
200
|
-
````
|
201
|
-
|
202
|
-
or with a block:
|
203
|
-
|
204
|
-
````ruby
|
205
|
-
setup do
|
206
|
-
run "echo 'hi'"
|
207
|
-
run "bundle install"
|
208
|
-
run 'git remote add upstream git://github.com/achiu/consular.git'
|
209
|
-
end
|
210
|
-
````
|
211
|
-
|
212
|
-
|
213
|
-
Once defined, you can invoke your projects setup with:
|
214
|
-
|
215
|
-
consular setup my_project
|
216
|
-
|
217
|
-
### Running Consular Projects ###
|
218
|
-
|
219
|
-
Once the project file has been declared to your satisfaction, simply execute any project defined in the `~/.config/consular` directory with:
|
220
|
-
|
221
|
-
$ consular start foo
|
222
|
-
|
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
|
224
|
-
as you would like and automate your workflow.
|
225
|
-
|
226
|
-
### Removing Consular Projects ###
|
227
|
-
|
228
|
-
If you no longer need a particular project, you can easily remove the consular file for the project:
|
229
|
-
|
230
|
-
$ consular delete foo
|
231
|
-
|
232
|
-
to remove a legacy yml syntax file you can just append the file
|
233
|
-
extension and run:
|
234
|
-
|
235
|
-
$ consular delete foo.yml
|
236
|
-
|
237
|
-
|
238
|
-
### Listing Consular Projects ###
|
239
|
-
|
240
|
-
You can also see a full list of available projects with:
|
241
|
-
|
242
|
-
$ consular list
|
243
|
-
|
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.
|
245
|
-
|
246
|
-
### Creating Termfile for Repo ###
|
247
|
-
|
248
|
-
In addition to creating 'local' projects which can run on your computer (and are stored in your home directory), we also
|
249
|
-
optionally allow you to create a `Termfile` within any directory and then you can execute this any time to setup the
|
250
|
-
environment for that particular project source.
|
251
|
-
|
252
|
-
For example, let's say I am in `/code/my/foo/project` directory which is
|
253
|
-
a Sinatra application. This application might have a `Gemfile` which includes all dependencies. You can also generate a `Termfile`
|
254
|
-
which contains the ideal development setup for OSX. To generate this file, invoke:
|
255
|
-
|
256
|
-
$ consular create
|
257
|
-
|
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
|
259
|
-
of the file is using the new Ruby DSL as described above in the previous section.
|
260
|
-
|
261
|
-
Now, when you or another developer clones a project, you could simply:
|
262
|
-
|
263
|
-
$ git clone git://path/to/my/foo/project.git
|
264
|
-
$ cd project
|
265
|
-
$ consular setup
|
266
|
-
$ consular start
|
267
|
-
|
268
|
-
This would clone the project repo, and then install all dependencies and then launch the ideal development environment for the project. Clearly
|
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
|
270
|
-
different configurations in the future.
|
271
|
-
|
272
|
-
In addition, you are in the project folder and you wish to remove the Termfile, you can invoke the command:
|
273
|
-
|
274
|
-
$ consular delete
|
275
|
-
|
276
|
-
This will clear the `Termfile` for the particular project.
|
33
|
+
After that, you'll need to install a 'core' so you can run Consular n
|
34
|
+
your desired platform.
|
277
35
|
|
278
36
|
Cores
|
279
37
|
-----
|
@@ -283,6 +41,7 @@ Each core inherits from ([Consular::Core](http://github.com/achiu/consular/blob/
|
|
283
41
|
Some of the cores that are available are:
|
284
42
|
|
285
43
|
* [OSX](http://www.github.com/achiu/consular-osx) - Mac OS X Terminal
|
44
|
+
* [iTerm](https://github.com/achiu/consular-iterm) - Mac OS X iTerm
|
286
45
|
* [Terminator](https://github.com/ilkka/consular-terminator) - Terminator
|
287
46
|
* [Gnome](https://github.com/jc00ke/consular-gnome-terminal) - Gnome Terminal
|
288
47
|
|
@@ -298,40 +57,35 @@ require 'consular/osx'
|
|
298
57
|
|
299
58
|
Or check the README of each individual core.
|
300
59
|
|
301
|
-
Authors
|
302
|
-
-------
|
303
60
|
|
304
|
-
|
305
|
-
|
61
|
+
Development Setup
|
62
|
+
---------------------
|
306
63
|
|
307
|
-
|
308
|
-
-------------
|
64
|
+
To begin development on Consular, run bundler:
|
309
65
|
|
310
|
-
|
66
|
+
$ gem install bundler
|
67
|
+
$ bundle install
|
68
|
+
|
69
|
+
The test suite uses Minitest
|
70
|
+
to run the test run:
|
71
|
+
|
72
|
+
$ rake test
|
73
|
+
|
74
|
+
or use watchr:
|
75
|
+
|
76
|
+
$ watchr spec.watchr
|
311
77
|
|
312
|
-
|
313
|
-
* Tim Gossett ([[MrGossett](https://github.com/MrGossett)) for a patch to fix comment reading
|
314
|
-
* Flavio Castelli ([flavio](https://github.com/flavio)) for contributing Konsole(KDE) core.
|
315
|
-
* Alexey Kuleshov ([kulesa](https://github.com/kulesa)) for contributing the terminal settings and terminal settings capture functionality
|
316
|
-
* Arthur Gunn ([gunn](https://github.com/gunn)) for contributing a path to support tab syntax and load path.
|
317
|
-
* Elliot Winkler ([mcmire](https://github.com/mcmire)) for adding 1.8.6 compatiblity and ensuring tabs open in order and fixing named tabs
|
318
|
-
* Justin Hilemen ([bobthecow](https://github.com/bobthecow)) for fixing the list command to remove the term extensions.
|
319
|
-
* Dave Perrett ([recurser](https://github.com/recurser)) for adding basic iTerm support.
|
320
|
-
* Ilkka Laukkanen ([ilkka](https://github.com/achiu/consular/commits/master?author=ilkka)) for Terminator core and other fixes
|
321
|
-
* Elia Schito ([elia](https://github.com/achiu/consular/commits/master?author=elia)) for patch to allow usage of "&" for background operations
|
322
|
-
* Dotan J. Nahum ([jondot](https://github.com/jondot)) for adding windows(cmd.exe) support
|
323
|
-
* Kyriacos Souroullas ([kyriacos](https://github.com/kyriacos) for removing params to support generic commands
|
324
|
-
* Jerry Cheung ([jch](https://github.com/jch)) for adding ignore for emac backups
|
325
|
-
* Michael Klein ([LevelbossMike](https://github.com/LevelbossMike)) for adding iTerm Pane support
|
78
|
+
#### Note on Patches/Pull Requests
|
326
79
|
|
327
|
-
|
328
|
-
|
80
|
+
* Fork the project.
|
81
|
+
* Make your feature addition or bug fix.
|
82
|
+
* Add tests for it. This is important so I don't break it in a
|
83
|
+
future version unintentionally.
|
84
|
+
* Commit, do not mess with rakefile, version, or history.
|
85
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
86
|
+
* Send me a pull request. Bonus points for topic branches.
|
329
87
|
|
330
|
-
|
88
|
+
#### Copyright
|
331
89
|
|
332
|
-
|
333
|
-
Finally, we decided the time had come to release this code back to the world as a gem. Thanks to ELC for creating the original source for this project.
|
90
|
+
Copyright (c) (2011 - when the Singularity occurs) Arthur Chiu. See LICENSE for details.
|
334
91
|
|
335
|
-
Also, we didn't take any code from [Project](http://github.com/joshnesbitt/project) by Josh but that project did inspire us to setup terminit
|
336
|
-
as a gem. Basically, project is a great gem but there were a couple issues with the fact that the terminal doesn't save the session state in some cases.
|
337
|
-
I had already been using terminit for years so we decided to package this up for easy use.
|
data/lib/consular/cli.rb
CHANGED
data/lib/consular/core.rb
CHANGED
@@ -26,7 +26,7 @@ module Consular
|
|
26
26
|
#
|
27
27
|
# @api public
|
28
28
|
def setup!
|
29
|
-
raise NotImplementedError, ".setup! needs to be defined for it to be ran by `
|
29
|
+
raise NotImplementedError, ".setup! needs to be defined for it to be ran by `consular setup`"
|
30
30
|
end
|
31
31
|
|
32
32
|
# Method called by the runner to execute the Termfile
|
@@ -34,7 +34,7 @@ module Consular
|
|
34
34
|
#
|
35
35
|
# @api public
|
36
36
|
def process!
|
37
|
-
raise NotImplementedError, ".process! needs to be defined for it to be ran by `
|
37
|
+
raise NotImplementedError, ".process! needs to be defined for it to be ran by `consular start`"
|
38
38
|
end
|
39
39
|
|
40
40
|
class << self
|
data/lib/consular/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: consular
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Arthur Chiu
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-11-20 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|