scide 0.0.8 → 0.0.9
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 +4 -0
- data/VERSION +1 -1
- data/lib/scide/project.rb +15 -0
- data/scide.gemspec +2 -2
- data/spec/project_spec.rb +53 -4
- data/spec/results/project1.screen +2 -1
- metadata +19 -19
data/README.md
CHANGED
@@ -41,6 +41,7 @@ This is a simple scide configuration file:
|
|
41
41
|
- 'db-log TAIL log/db.log'
|
42
42
|
- 'server RUN rails server'
|
43
43
|
- 'shell'
|
44
|
+
default_window: project
|
44
45
|
|
45
46
|
By running `scide mywebsite`, screen would open with four windows:
|
46
47
|
|
@@ -49,6 +50,9 @@ By running `scide mywebsite`, screen would open with four windows:
|
|
49
50
|
* a __server__ window with your Ruby on Rails server launched;
|
50
51
|
* a __shell__ window with your shell running.
|
51
52
|
|
53
|
+
The __project__ window would be opened as specified by the
|
54
|
+
`default_window` option.
|
55
|
+
|
52
56
|
The format for a window is `NAME [COMMAND] [CONTENTS]`.
|
53
57
|
This opens a window with the given name. An optional command
|
54
58
|
can be run in the window, which can receive arguments/contents.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.9
|
data/lib/scide/project.rb
CHANGED
@@ -15,6 +15,10 @@ module Scide
|
|
15
15
|
# The GNU Screen windows of this project.
|
16
16
|
attr_reader :windows
|
17
17
|
|
18
|
+
# The name or index of the window that should be displayed by default for
|
19
|
+
# this project (defaults to the last window).
|
20
|
+
attr_reader :default_window
|
21
|
+
|
18
22
|
# Returns a project configuration.
|
19
23
|
#
|
20
24
|
# If not given in the project hash, {#path} is built by joining
|
@@ -60,6 +64,16 @@ module Scide
|
|
60
64
|
@options.merge!(contents[:options] || {})
|
61
65
|
|
62
66
|
@windows = contents[:windows].collect{ |w| Scide::Window.new self, w }
|
67
|
+
|
68
|
+
# find default window if specified
|
69
|
+
@default_window = if contents[:default_window].kind_of? Fixnum
|
70
|
+
@windows[contents[:default_window]]
|
71
|
+
elsif contents[:default_window].kind_of?(String) or contents[:default_window].kind_of?(Symbol)
|
72
|
+
@windows.find{ |w| w.name == contents[:default_window].to_s }
|
73
|
+
elsif !contents[:default_window].nil?
|
74
|
+
raise ArgumentError, "default window of project '#{key}' should be an integer, string or symbol"
|
75
|
+
end
|
76
|
+
raise ArgumentError, "default window of project '#{key}' must be the name or index of one of its windows" if !contents[:default_window].nil? and @default_window.nil?
|
63
77
|
end
|
64
78
|
|
65
79
|
# Returns a representation of this project as a GNU Screen
|
@@ -72,6 +86,7 @@ module Scide
|
|
72
86
|
s << w.to_screen(i)
|
73
87
|
s << "\n" if i != (@windows.length - 1)
|
74
88
|
end
|
89
|
+
s << "\nselect #{@default_window.name}" if @default_window
|
75
90
|
end
|
76
91
|
end
|
77
92
|
end
|
data/scide.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "scide"
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.9"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["AlphaHydrae"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2012-02-20"
|
13
13
|
s.description = "Utility to generate GNU screen configuration files."
|
14
14
|
s.email = "hydrae.alpha@gmail.com"
|
15
15
|
s.executables = ["scide"]
|
data/spec/project_spec.rb
CHANGED
@@ -72,16 +72,17 @@ describe Scide::Project do
|
|
72
72
|
|
73
73
|
describe 'Sample Configuration' do
|
74
74
|
before :each do
|
75
|
-
contents = {
|
75
|
+
@contents = {
|
76
76
|
:windows => [
|
77
77
|
'window1 EDIT',
|
78
78
|
{ :name => 'window2', :command => 'SHOW', :contents => 'ssh example.com' },
|
79
79
|
'window3 TAIL file.txt',
|
80
80
|
{ :string => 'window4 RUN ls -la' },
|
81
81
|
'window5'
|
82
|
-
]
|
82
|
+
],
|
83
|
+
:default_window => :window4
|
83
84
|
}
|
84
|
-
@project = Scide::Project.new @global, 'fubar', contents
|
85
|
+
@project = Scide::Project.new @global, 'fubar', @contents
|
85
86
|
end
|
86
87
|
|
87
88
|
it "should create five windows" do
|
@@ -97,9 +98,57 @@ describe Scide::Project do
|
|
97
98
|
@project.windows[4].command.should be_nil
|
98
99
|
end
|
99
100
|
|
100
|
-
it "should
|
101
|
+
it "should find the correct default window" do
|
102
|
+
@project.default_window.should == @project.windows[3]
|
103
|
+
end
|
104
|
+
|
105
|
+
it "should create the correct GNU Screen configuration" do
|
101
106
|
@project.to_screen.should == SpecHelper.result(:project1)
|
102
107
|
end
|
108
|
+
|
109
|
+
describe 'Default Window' do
|
110
|
+
before :each do
|
111
|
+
@default_window_contents = @contents.dup
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should find the default window with a fixnum" do
|
115
|
+
@default_window_contents[:default_window] = 0
|
116
|
+
project = Scide::Project.new(@global, 'fubar', @default_window_contents)
|
117
|
+
project.default_window.should == project.windows[0]
|
118
|
+
end
|
119
|
+
|
120
|
+
it "should find the default window with a negative fixnum" do
|
121
|
+
@default_window_contents[:default_window] = -4
|
122
|
+
project = Scide::Project.new(@global, 'fubar', @default_window_contents)
|
123
|
+
project.default_window.should == project.windows[1]
|
124
|
+
end
|
125
|
+
|
126
|
+
it "should find the default window with a string" do
|
127
|
+
@default_window_contents[:default_window] = 'window3'
|
128
|
+
project = Scide::Project.new(@global, 'fubar', @default_window_contents)
|
129
|
+
project.default_window.should == project.windows[2]
|
130
|
+
end
|
131
|
+
|
132
|
+
it "should find the default window with a symbol" do
|
133
|
+
@default_window_contents[:default_window] = :window5
|
134
|
+
project = Scide::Project.new(@global, 'fubar', @default_window_contents)
|
135
|
+
project.default_window.should == project.windows[4]
|
136
|
+
end
|
137
|
+
|
138
|
+
it "should raise an error if the default window is not a fixnum, string or symbol" do
|
139
|
+
[ [], {}, 0.4 ].each do |invalid|
|
140
|
+
@default_window_contents[:default_window] = invalid
|
141
|
+
lambda{ Scide::Project.new @global, 'fubar', @default_window_contents }.should raise_error(ArgumentError)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
it "should raise an error if the default window is unknown" do
|
146
|
+
[ 'unknown', :unknown, -10, -6, 5, 10 ].each do |invalid|
|
147
|
+
@default_window_contents[:default_window] = invalid
|
148
|
+
lambda{ Scide::Project.new @global, 'fubar', @default_window_contents }.should raise_error(ArgumentError)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
103
152
|
end
|
104
153
|
|
105
154
|
it "should raise an error if the contents are not a hash" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scide
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-02-20 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: upoj-rb
|
16
|
-
requirement: &
|
16
|
+
requirement: &2153824240 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.0.4
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2153824240
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &2153823740 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2153823740
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: shoulda
|
38
|
-
requirement: &
|
38
|
+
requirement: &2153823220 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2153823220
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
|
-
requirement: &
|
49
|
+
requirement: &2153822700 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.0.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2153822700
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: jeweler
|
60
|
-
requirement: &
|
60
|
+
requirement: &2153822180 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.6.4
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2153822180
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: simplecov
|
71
|
-
requirement: &
|
71
|
+
requirement: &2153821560 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2153821560
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: yard
|
82
|
-
requirement: &
|
82
|
+
requirement: &2153820940 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *2153820940
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rdiscount
|
93
|
-
requirement: &
|
93
|
+
requirement: &2153820380 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *2153820380
|
102
102
|
description: Utility to generate GNU screen configuration files.
|
103
103
|
email: hydrae.alpha@gmail.com
|
104
104
|
executables:
|
@@ -166,7 +166,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
166
166
|
version: '0'
|
167
167
|
segments:
|
168
168
|
- 0
|
169
|
-
hash:
|
169
|
+
hash: 3578219132485266251
|
170
170
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
171
|
none: false
|
172
172
|
requirements:
|