scide 0.0.12 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +0 -1
- data/.ruby-version +1 -0
- data/.screenrc +8 -0
- data/.travis.yml +1 -1
- data/Gemfile +10 -11
- data/Gemfile.lock +46 -39
- data/LICENSE.txt +1 -1
- data/README.md +36 -144
- data/Rakefile +19 -26
- data/VERSION +1 -1
- data/bin/scide +1 -2
- data/lib/scide/auto.rb +33 -0
- data/lib/scide/list.rb +33 -0
- data/lib/scide/open.rb +57 -0
- data/lib/scide/program.rb +109 -0
- data/lib/scide/setup.rb +16 -0
- data/lib/scide.rb +25 -57
- data/scide.gemspec +51 -59
- data/spec/auto_spec.rb +72 -0
- data/spec/cli/list_spec.rb +81 -0
- data/spec/cli/open_spec.rb +131 -0
- data/spec/cli/setup_spec.rb +82 -0
- data/spec/helper.rb +12 -24
- data/spec/list_spec.rb +113 -0
- data/spec/open_spec.rb +228 -0
- data/spec/setup_spec.rb +106 -0
- data/spec/version_spec.rb +3 -5
- metadata +150 -72
- data/.document +0 -5
- data/.rvmrc +0 -41
- data/TODO.md +0 -21
- data/lib/scide/command.rb +0 -124
- data/lib/scide/commands/edit.rb +0 -37
- data/lib/scide/commands/run.rb +0 -25
- data/lib/scide/commands/show.rb +0 -29
- data/lib/scide/commands/tail.rb +0 -37
- data/lib/scide/config.rb +0 -105
- data/lib/scide/global.rb +0 -30
- data/lib/scide/opts.rb +0 -35
- data/lib/scide/overmind.rb +0 -70
- data/lib/scide/project.rb +0 -93
- data/lib/scide/screen.rb +0 -77
- data/lib/scide/window.rb +0 -88
- data/spec/command_spec.rb +0 -86
- data/spec/commands/edit_spec.rb +0 -19
- data/spec/commands/run_spec.rb +0 -9
- data/spec/commands/show_spec.rb +0 -15
- data/spec/commands/tail_spec.rb +0 -14
- data/spec/config_spec.rb +0 -113
- data/spec/global_spec.rb +0 -38
- data/spec/opts_spec.rb +0 -42
- data/spec/project_spec.rb +0 -171
- data/spec/results/config1.yml +0 -14
- data/spec/results/malformed_config.yml +0 -2
- data/spec/results/project1.screen +0 -10
- data/spec/results/screen1.screen +0 -14
- data/spec/scide_spec.rb +0 -38
- data/spec/screen_spec.rb +0 -90
- data/spec/window_spec.rb +0 -122
metadata
CHANGED
@@ -1,30 +1,51 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scide
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
- AlphaHydrae
|
8
|
+
- Simon Oulevay (AlphaHydrae)
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-05-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement:
|
15
|
+
name: commander
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 4.1.3
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 4.1.3
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: paint
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.8.6
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.8.6
|
25
46
|
- !ruby/object:Gem::Dependency
|
26
47
|
name: which_works
|
27
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
28
49
|
none: false
|
29
50
|
requirements:
|
30
51
|
- - ~>
|
@@ -32,10 +53,15 @@ dependencies:
|
|
32
53
|
version: 0.1.0
|
33
54
|
type: :runtime
|
34
55
|
prerelease: false
|
35
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.1.0
|
36
62
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
38
|
-
requirement:
|
63
|
+
name: bundler
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
39
65
|
none: false
|
40
66
|
requirements:
|
41
67
|
- - ! '>='
|
@@ -43,10 +69,15 @@ dependencies:
|
|
43
69
|
version: '0'
|
44
70
|
type: :development
|
45
71
|
prerelease: false
|
46
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
47
78
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
49
|
-
requirement:
|
79
|
+
name: rake
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
50
81
|
none: false
|
51
82
|
requirements:
|
52
83
|
- - ! '>='
|
@@ -54,10 +85,31 @@ dependencies:
|
|
54
85
|
version: '0'
|
55
86
|
type: :development
|
56
87
|
prerelease: false
|
57
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
58
94
|
- !ruby/object:Gem::Dependency
|
59
|
-
name:
|
60
|
-
requirement:
|
95
|
+
name: rspec
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: fakefs
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
61
113
|
none: false
|
62
114
|
requirements:
|
63
115
|
- - ! '>='
|
@@ -65,21 +117,31 @@ dependencies:
|
|
65
117
|
version: '0'
|
66
118
|
type: :development
|
67
119
|
prerelease: false
|
68
|
-
version_requirements:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
69
126
|
- !ruby/object:Gem::Dependency
|
70
127
|
name: jeweler
|
71
|
-
requirement:
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
72
129
|
none: false
|
73
130
|
requirements:
|
74
|
-
- -
|
131
|
+
- - ! '>='
|
75
132
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
133
|
+
version: '0'
|
77
134
|
type: :development
|
78
135
|
prerelease: false
|
79
|
-
version_requirements:
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
80
142
|
- !ruby/object:Gem::Dependency
|
81
|
-
name:
|
82
|
-
requirement:
|
143
|
+
name: gemcutter
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
83
145
|
none: false
|
84
146
|
requirements:
|
85
147
|
- - ! '>='
|
@@ -87,10 +149,15 @@ dependencies:
|
|
87
149
|
version: '0'
|
88
150
|
type: :development
|
89
151
|
prerelease: false
|
90
|
-
version_requirements:
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
91
158
|
- !ruby/object:Gem::Dependency
|
92
|
-
name:
|
93
|
-
requirement:
|
159
|
+
name: gem-release
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
94
161
|
none: false
|
95
162
|
requirements:
|
96
163
|
- - ! '>='
|
@@ -98,10 +165,15 @@ dependencies:
|
|
98
165
|
version: '0'
|
99
166
|
type: :development
|
100
167
|
prerelease: false
|
101
|
-
version_requirements:
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
102
174
|
- !ruby/object:Gem::Dependency
|
103
|
-
name:
|
104
|
-
requirement:
|
175
|
+
name: rake-version
|
176
|
+
requirement: !ruby/object:Gem::Requirement
|
105
177
|
none: false
|
106
178
|
requirements:
|
107
179
|
- - ! '>='
|
@@ -109,19 +181,45 @@ dependencies:
|
|
109
181
|
version: '0'
|
110
182
|
type: :development
|
111
183
|
prerelease: false
|
112
|
-
version_requirements:
|
184
|
+
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
186
|
+
requirements:
|
187
|
+
- - ! '>='
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
190
|
+
- !ruby/object:Gem::Dependency
|
191
|
+
name: simplecov
|
192
|
+
requirement: !ruby/object:Gem::Requirement
|
193
|
+
none: false
|
194
|
+
requirements:
|
195
|
+
- - ! '>='
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: '0'
|
198
|
+
type: :development
|
199
|
+
prerelease: false
|
200
|
+
version_requirements: !ruby/object:Gem::Requirement
|
201
|
+
none: false
|
202
|
+
requirements:
|
203
|
+
- - ! '>='
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: '0'
|
113
206
|
- !ruby/object:Gem::Dependency
|
114
207
|
name: travis-lint
|
115
|
-
requirement:
|
208
|
+
requirement: !ruby/object:Gem::Requirement
|
116
209
|
none: false
|
117
210
|
requirements:
|
118
|
-
- -
|
211
|
+
- - ! '>='
|
119
212
|
- !ruby/object:Gem::Version
|
120
|
-
version:
|
213
|
+
version: '0'
|
121
214
|
type: :development
|
122
215
|
prerelease: false
|
123
|
-
version_requirements:
|
124
|
-
|
216
|
+
version_requirements: !ruby/object:Gem::Requirement
|
217
|
+
none: false
|
218
|
+
requirements:
|
219
|
+
- - ! '>='
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '0'
|
222
|
+
description: GNU screen wrapper to open projects with a .screenrc file.
|
125
223
|
email: hydrae.alpha@gmail.com
|
126
224
|
executables:
|
127
225
|
- scide
|
@@ -130,50 +228,33 @@ extra_rdoc_files:
|
|
130
228
|
- LICENSE.txt
|
131
229
|
- README.md
|
132
230
|
files:
|
133
|
-
- .document
|
134
231
|
- .rspec
|
135
|
-
- .
|
232
|
+
- .ruby-version
|
233
|
+
- .screenrc
|
136
234
|
- .travis.yml
|
137
235
|
- Gemfile
|
138
236
|
- Gemfile.lock
|
139
237
|
- LICENSE.txt
|
140
238
|
- README.md
|
141
239
|
- Rakefile
|
142
|
-
- TODO.md
|
143
240
|
- VERSION
|
144
241
|
- bin/scide
|
145
242
|
- lib/scide.rb
|
146
|
-
- lib/scide/
|
147
|
-
- lib/scide/
|
148
|
-
- lib/scide/
|
149
|
-
- lib/scide/
|
150
|
-
- lib/scide/
|
151
|
-
- lib/scide/config.rb
|
152
|
-
- lib/scide/global.rb
|
153
|
-
- lib/scide/opts.rb
|
154
|
-
- lib/scide/overmind.rb
|
155
|
-
- lib/scide/project.rb
|
156
|
-
- lib/scide/screen.rb
|
157
|
-
- lib/scide/window.rb
|
243
|
+
- lib/scide/auto.rb
|
244
|
+
- lib/scide/list.rb
|
245
|
+
- lib/scide/open.rb
|
246
|
+
- lib/scide/program.rb
|
247
|
+
- lib/scide/setup.rb
|
158
248
|
- scide.gemspec
|
159
|
-
- spec/
|
160
|
-
- spec/
|
161
|
-
- spec/
|
162
|
-
- spec/
|
163
|
-
- spec/commands/tail_spec.rb
|
164
|
-
- spec/config_spec.rb
|
165
|
-
- spec/global_spec.rb
|
249
|
+
- spec/auto_spec.rb
|
250
|
+
- spec/cli/list_spec.rb
|
251
|
+
- spec/cli/open_spec.rb
|
252
|
+
- spec/cli/setup_spec.rb
|
166
253
|
- spec/helper.rb
|
167
|
-
- spec/
|
168
|
-
- spec/
|
169
|
-
- spec/
|
170
|
-
- spec/results/malformed_config.yml
|
171
|
-
- spec/results/project1.screen
|
172
|
-
- spec/results/screen1.screen
|
173
|
-
- spec/scide_spec.rb
|
174
|
-
- spec/screen_spec.rb
|
254
|
+
- spec/list_spec.rb
|
255
|
+
- spec/open_spec.rb
|
256
|
+
- spec/setup_spec.rb
|
175
257
|
- spec/version_spec.rb
|
176
|
-
- spec/window_spec.rb
|
177
258
|
homepage: http://github.com/AlphaHydrae/scide
|
178
259
|
licenses:
|
179
260
|
- MIT
|
@@ -187,9 +268,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
187
268
|
- - ! '>='
|
188
269
|
- !ruby/object:Gem::Version
|
189
270
|
version: '0'
|
190
|
-
segments:
|
191
|
-
- 0
|
192
|
-
hash: -4477489654140745728
|
193
271
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
194
272
|
none: false
|
195
273
|
requirements:
|
@@ -198,8 +276,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
198
276
|
version: '0'
|
199
277
|
requirements: []
|
200
278
|
rubyforge_project:
|
201
|
-
rubygems_version: 1.8.
|
279
|
+
rubygems_version: 1.8.25
|
202
280
|
signing_key:
|
203
281
|
specification_version: 3
|
204
|
-
summary: GNU Screen IDE
|
282
|
+
summary: GNU Screen IDE
|
205
283
|
test_files: []
|
data/.document
DELETED
data/.rvmrc
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
|
3
|
-
# This is an RVM Project .rvmrc file, used to automatically load the ruby
|
4
|
-
# development environment upon cd'ing into the directory
|
5
|
-
|
6
|
-
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
|
7
|
-
environment_id="ruby-1.9.2@scide"
|
8
|
-
|
9
|
-
#
|
10
|
-
# First we attempt to load the desired environment directly from the environment
|
11
|
-
# file. This is very fast and efficicent compared to running through the entire
|
12
|
-
# CLI and selector. If you want feedback on which environment was used then
|
13
|
-
# insert the word 'use' after --create as this triggers verbose mode.
|
14
|
-
#
|
15
|
-
if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
|
16
|
-
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
|
17
|
-
then
|
18
|
-
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
19
|
-
|
20
|
-
if [[ -s ".rvm/hooks/after_use" ]]
|
21
|
-
then
|
22
|
-
. ".rvm/hooks/after_use"
|
23
|
-
fi
|
24
|
-
else
|
25
|
-
# If the environment file has not yet been created, use the RVM CLI to select.
|
26
|
-
if ! rvm --create "$environment_id"
|
27
|
-
then
|
28
|
-
echo "Failed to create RVM environment ''."
|
29
|
-
fi
|
30
|
-
fi
|
31
|
-
|
32
|
-
#
|
33
|
-
# If you use an RVM gemset file to install a list of gems (*.gems), you can have
|
34
|
-
# it be automatically loaded. Uncomment the following and adjust the filename if
|
35
|
-
# necessary.
|
36
|
-
#
|
37
|
-
# filename=".gems"
|
38
|
-
# if [[ -s "$filename" ]] ; then
|
39
|
-
# rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
|
40
|
-
# fi
|
41
|
-
|
data/TODO.md
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# TODO
|
2
|
-
|
3
|
-
## Improvements/Maintenance
|
4
|
-
|
5
|
-
* check format of keys, names, etc.
|
6
|
-
* ensure that all data from configuration is duplicated
|
7
|
-
* replace default hashes by HashWithIndifferentAccess
|
8
|
-
* make all options/contents parameters optional
|
9
|
-
* extract tempfile management into separate runner class
|
10
|
-
* find a way to check whether a path is absolute (cross-platform)
|
11
|
-
|
12
|
-
## New Features
|
13
|
-
|
14
|
-
* allow to load configuration from hash
|
15
|
-
* interactive configuration generation
|
16
|
-
* save generated configurations
|
17
|
-
|
18
|
-
## Specifications
|
19
|
-
|
20
|
-
* find a way to stub puts (opts version & banner)
|
21
|
-
* use rspec 2 shared examples
|
data/lib/scide/command.rb
DELETED
@@ -1,124 +0,0 @@
|
|
1
|
-
module Scide
|
2
|
-
|
3
|
-
# A command to be used in a GNU Screen window. There are several
|
4
|
-
# command implementations (show command, run command, tail file, etc).
|
5
|
-
# See under {Scide::Commands}.
|
6
|
-
class Command
|
7
|
-
|
8
|
-
# The options given to this command. These are built by merging
|
9
|
-
# global options, project options and window options.
|
10
|
-
attr_reader :options
|
11
|
-
|
12
|
-
# Returns a new command for the given window.
|
13
|
-
#
|
14
|
-
# == Arguments
|
15
|
-
# * <tt>window</tt> - The window in which the command will be used.
|
16
|
-
# Command options are retrieved from {Scide::Window#options}. See
|
17
|
-
# {#initialize}.
|
18
|
-
# * <tt>contents</tt> - The command configuration (String or Hash).
|
19
|
-
#
|
20
|
-
# == String Initialization
|
21
|
-
# The string must be in the format <tt>COMMAND [CONTENTS]</tt>.
|
22
|
-
#
|
23
|
-
# <tt>TYPE</tt> is the name of the command class under
|
24
|
-
# {Scide::Commands}, in uppercase camelcase. For example, <tt>TAIL</tt>
|
25
|
-
# corresponds to {Scide::Commands::Tail}, <tt>MY_COMMAND</tt> would
|
26
|
-
# correspond to <tt>Scide::Commands::MyCommand</tt>.
|
27
|
-
#
|
28
|
-
# <tt>CONTENTS</tt> is the contents of the command.
|
29
|
-
#
|
30
|
-
# == Hash Initialization
|
31
|
-
# The following options can be given:
|
32
|
-
# * <tt>:command => string</tt> is the same <tt>COMMAND</tt> as
|
33
|
-
# for string initialization above.
|
34
|
-
# * <tt>:contents => string or other</tt> is the same <tt>CONTENTS</tt>
|
35
|
-
# as for string initialization above. Typically this is only a
|
36
|
-
# string, but more advanced commands might be initialized with
|
37
|
-
# arrays or hashes.
|
38
|
-
def self.resolve window, contents
|
39
|
-
if contents.kind_of? Hash
|
40
|
-
resolve_from_hash window, contents
|
41
|
-
elsif contents.kind_of? String
|
42
|
-
resolve_from_string window, contents
|
43
|
-
else
|
44
|
-
raise ArgumentError, 'command must be a string or a hash'
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
# Returns a new command with the given options.
|
49
|
-
#
|
50
|
-
# == Arguments
|
51
|
-
# * <tt>contents</tt> - The contents of the command. Typically this
|
52
|
-
# is only a string, but more advanced commands might be initialized
|
53
|
-
# with arrays or hashes. By default, the contents can be retrieved
|
54
|
-
# as a string with {#text_with_options}.
|
55
|
-
# * <tt>options</tt> - Options that can be used in the string contents
|
56
|
-
# of the command. See #text_with_options.
|
57
|
-
def initialize contents, options = {}
|
58
|
-
|
59
|
-
# fill text only if it's not already there, in case a subclass does
|
60
|
-
# some initialization work before calling super
|
61
|
-
@text ||= contents.to_s
|
62
|
-
|
63
|
-
# merge given options to the already initialized ones, if any
|
64
|
-
@options = (@options || {}).merge options
|
65
|
-
end
|
66
|
-
|
67
|
-
# Returns a representation of this command as a GNU Screen
|
68
|
-
# configuration fragment.
|
69
|
-
#
|
70
|
-
# This default implementation raises an error and must be
|
71
|
-
# overriden by subclasses.
|
72
|
-
def to_screen
|
73
|
-
raise 'Use a subclass'
|
74
|
-
end
|
75
|
-
|
76
|
-
# Returns the text of this command with filtered option placeholders.
|
77
|
-
#
|
78
|
-
# == Examples
|
79
|
-
# com_text = 'tail %{tail} -f file.txt -c %{foo}'
|
80
|
-
# com = Scide::Command.new com_text, :tail => '-n 1000', :foo => 400
|
81
|
-
#
|
82
|
-
# com.text_with_options #=> 'tail -n 1000 -f file.txt -c 400'
|
83
|
-
def text_with_options
|
84
|
-
@text.dup.tap do |s|
|
85
|
-
@options.each_pair do |key, value|
|
86
|
-
s.gsub! /\%\{#{Regexp.escape key.to_s}\}/, value.to_s
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
private
|
92
|
-
|
93
|
-
# Returns a new command for the given window. The given
|
94
|
-
# contents are a hash. See {Scide::Command.resolve}.
|
95
|
-
def self.resolve_from_hash window, contents
|
96
|
-
begin
|
97
|
-
klass = Scide::Commands.const_get contents[:command].downcase.camelize
|
98
|
-
klass.new contents[:contents], window.options.dup
|
99
|
-
rescue NameError => err
|
100
|
-
raise ArgumentError, "unknown '#{contents[:command]}' command type"
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
# Returns a new command for the given window. The given
|
105
|
-
# contents are a string. See {Scide::Command.resolve}.
|
106
|
-
def self.resolve_from_string window, contents
|
107
|
-
klass_name, text = contents.split /\s+/, 2
|
108
|
-
begin
|
109
|
-
klass = Scide::Commands.const_get klass_name.downcase.camelize
|
110
|
-
klass.new text, window.options.dup
|
111
|
-
rescue NameError => err
|
112
|
-
raise ArgumentError, "unknown '#{klass_name}' command type"
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
# Module containing scide command classes.
|
118
|
-
module Commands
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
# load pre-defined commands
|
123
|
-
deps_dir = File.join File.dirname(__FILE__), 'commands'
|
124
|
-
%w( show run tail edit ).each{ |dep| require File.join(deps_dir, dep) }
|
data/lib/scide/commands/edit.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
module Scide
|
2
|
-
|
3
|
-
module Commands
|
4
|
-
|
5
|
-
# Edits a file with the default editor (<tt>$EDITOR</tt>).
|
6
|
-
#
|
7
|
-
# == Configuration Example
|
8
|
-
# # this YAML configuration,
|
9
|
-
# projects:
|
10
|
-
# project1:
|
11
|
-
# options:
|
12
|
-
# edit: '-c MyVimCommand'
|
13
|
-
# windows:
|
14
|
-
# - "window1 EDIT $HOME/fubar.txt"
|
15
|
-
#
|
16
|
-
# # will produce the following command in window1:
|
17
|
-
# $EDITOR -c MyVimCommand $HOME/fubar.txt
|
18
|
-
class Edit < Scide::Commands::Run
|
19
|
-
|
20
|
-
# Returns a new edit command.
|
21
|
-
#
|
22
|
-
# See class definition for examples.
|
23
|
-
#
|
24
|
-
# == Arguments
|
25
|
-
# * <tt>contents</tt> - The file to edit.
|
26
|
-
# * <tt>options</tt> - Options that can be used in the contents
|
27
|
-
# of the command.
|
28
|
-
#
|
29
|
-
# == Options
|
30
|
-
# * <tt>:edit => string</tt> - Arguments to the editor.
|
31
|
-
def initialize contents, options = {}
|
32
|
-
super contents, options
|
33
|
-
@text = [ '$EDITOR', options[:edit].to_s, @text.to_s ].select(&:present?).join(' ')
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
data/lib/scide/commands/run.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
module Scide
|
2
|
-
|
3
|
-
module Commands
|
4
|
-
|
5
|
-
# Runs a command.
|
6
|
-
#
|
7
|
-
# == Configuration Example
|
8
|
-
# # this YAML configuration,
|
9
|
-
# projects:
|
10
|
-
# project1:
|
11
|
-
# windows:
|
12
|
-
# - "window1 RUN rails server"
|
13
|
-
#
|
14
|
-
# # will produce the following command in window1:
|
15
|
-
# rails server
|
16
|
-
class Run < Scide::Commands::Show
|
17
|
-
|
18
|
-
# Appends a carriage return to the command so that
|
19
|
-
# it will not only be shown but also executed.
|
20
|
-
def text_with_options
|
21
|
-
"#{super}\\012"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/lib/scide/commands/show.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
module Scide
|
2
|
-
|
3
|
-
module Commands
|
4
|
-
|
5
|
-
# Prepares and shows a command but do not run it.
|
6
|
-
#
|
7
|
-
# == Configuration Example
|
8
|
-
# # this YAML configuration,
|
9
|
-
# projects:
|
10
|
-
# project1:
|
11
|
-
# options:
|
12
|
-
# host: 127.0.0.1
|
13
|
-
# windows:
|
14
|
-
# - "window1 SHOW ssh %{host}"
|
15
|
-
#
|
16
|
-
# # will produce the following command in window1:
|
17
|
-
# ssh 127.0.0.1
|
18
|
-
class Show < Scide::Command
|
19
|
-
|
20
|
-
# Returns a configuration fragment that will show
|
21
|
-
# this command in a GNU Screen window without running it.
|
22
|
-
# This will use screen's <tt>stuff</tt> command to
|
23
|
-
# put the text in the window.
|
24
|
-
def to_screen
|
25
|
-
%|stuff "#{text_with_options}"|
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
data/lib/scide/commands/tail.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
module Scide
|
2
|
-
|
3
|
-
module Commands
|
4
|
-
|
5
|
-
# Tails a file.
|
6
|
-
#
|
7
|
-
# == Configuration Example
|
8
|
-
# # this YAML configuration,
|
9
|
-
# projects:
|
10
|
-
# project1:
|
11
|
-
# options:
|
12
|
-
# tail: '-n 1000'
|
13
|
-
# windows:
|
14
|
-
# - "window1 TAIL $HOME/fubar.txt"
|
15
|
-
#
|
16
|
-
# # will produce the following command in window1:
|
17
|
-
# tail -n 1000 -f $HOME/fubar.txt
|
18
|
-
class Tail < Scide::Commands::Run
|
19
|
-
|
20
|
-
# Returns a new tail command.
|
21
|
-
#
|
22
|
-
# See class definition for examples.
|
23
|
-
#
|
24
|
-
# == Arguments
|
25
|
-
# * <tt>contents</tt> - The file to tail.
|
26
|
-
# * <tt>options</tt> - Options that can be used in the
|
27
|
-
# contents of the command.
|
28
|
-
#
|
29
|
-
# == Options
|
30
|
-
# * <tt>tail => string</tt> - Arguments to tail.
|
31
|
-
def initialize contents, options = {}
|
32
|
-
super contents, options
|
33
|
-
@text = [ 'tail', options[:tail].to_s, '-f', @text.to_s ].select(&:present?).join(' ')
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|