ruber 0.0.7 → 0.0.8
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/CHANGES +54 -0
- data/bin/ruber +12 -1
- data/data/share/apps/ruber/ruberui.rc +5 -0
- data/data/share/icons/pin.png +0 -0
- data/lib/ruber/application/application.rb +1 -1
- data/lib/ruber/documents/document_list.rb +1 -1
- data/lib/ruber/editor/document.rb +26 -6
- data/lib/ruber/editor/editor_view.rb +21 -2
- data/lib/ruber/filtered_output_widget.rb +1 -1
- data/lib/ruber/ktexteditor_sugar.rb +124 -0
- data/lib/ruber/main_window/main_window.rb +34 -16
- data/lib/ruber/main_window/main_window_actions.rb +98 -5
- data/lib/ruber/main_window/main_window_internal.rb +1 -1
- data/lib/ruber/main_window/plugin.yaml +5 -0
- data/lib/ruber/main_window/ui/choose_plugins_widget.rb +2 -2
- data/lib/ruber/main_window/ui/main_window_settings_widget.rb +67 -34
- data/lib/ruber/main_window/ui/main_window_settings_widget.ui +77 -30
- data/lib/ruber/main_window/ui/new_project_widget.rb +2 -2
- data/lib/ruber/main_window/ui/open_file_in_project_dlg.rb +2 -2
- data/lib/ruber/main_window/ui/output_color_widget.rb +2 -2
- data/lib/ruber/main_window/ui/workspace_settings_widget.rb +1 -1
- data/lib/ruber/main_window/view_manager.rb +14 -1
- data/lib/ruber/output_widget.rb +409 -288
- data/lib/ruber/pane.rb +22 -0
- data/lib/ruber/projects/ui/project_files_rule_chooser_widget.rb +2 -2
- data/lib/ruber/projects/ui/project_files_widget.rb +2 -2
- data/lib/ruber/qt_sugar.rb +11 -0
- data/lib/ruber/version.rb +1 -1
- data/plugins/auto_end/auto_end.rb +122 -0
- data/plugins/auto_end/plugin.yaml +11 -0
- data/plugins/autosave/ui/autosave_config_widget.rb +2 -2
- data/plugins/command/command.rb +71 -12
- data/plugins/command/output.rb +592 -0
- data/plugins/command/ui/tool_widget.rb +143 -0
- data/plugins/command/ui/tool_widget.ui +147 -0
- data/plugins/find_in_files/ui/config_widget.rb +2 -2
- data/plugins/find_in_files/ui/find_in_files_widget.rb +2 -2
- data/plugins/rake/ui/add_quick_task_widget.rb +2 -2
- data/plugins/rake/ui/choose_task_widget.rb +2 -2
- data/plugins/rake/ui/config_widget.rb +2 -2
- data/plugins/rake/ui/project_widget.rb +2 -2
- data/plugins/rspec/plugin.yaml +7 -2
- data/plugins/rspec/rspec.rb +178 -53
- data/plugins/rspec/rspecui.rc +2 -3
- data/plugins/rspec/ui/config_widget.rb +79 -0
- data/plugins/rspec/ui/config_widget.ui +89 -0
- data/plugins/rspec/ui/rspec_project_widget.rb +2 -2
- data/plugins/ruby_development/ruby_development.rb +1 -1
- data/plugins/ruby_development/ui/config_widget.rb +1 -1
- data/plugins/ruby_development/ui/project_widget.rb +2 -2
- data/plugins/ruby_runner/ruby_runner.rb +13 -12
- data/plugins/ruby_runner/ui/config_widget.rb +2 -2
- data/plugins/ruby_runner/ui/project_widget.rb +2 -2
- data/plugins/ruby_runner/ui/ruby_runnner_plugin_option_widget.rb +2 -2
- data/plugins/state/ui/config_widget.rb +2 -2
- data/plugins/syntax_checker/syntax_checker.rb +1 -1
- data/spec/auto_end_spec.rb +272 -0
- data/spec/common.rb +1 -0
- data/spec/document_spec.rb +83 -0
- data/spec/editor_view_spec.rb +41 -0
- data/spec/filtered_output_widget_spec.rb +2 -2
- data/spec/ktexteditor_sugar_spec.rb +190 -0
- data/spec/output_widget_spec.rb +120 -11
- data/spec/pane_spec.rb +1 -1
- data/spec/qt_sugar_spec.rb +14 -0
- data/spec/state_spec.rb +0 -26
- metadata +14 -3
@@ -0,0 +1,143 @@
|
|
1
|
+
=begin
|
2
|
+
** Form generated from reading ui file 'tool_widget.ui'
|
3
|
+
**
|
4
|
+
** Created: mer gen 19 23:53:49 2011
|
5
|
+
** by: Qt User Interface Compiler version 4.7.1
|
6
|
+
**
|
7
|
+
** WARNING! All changes made in this file will be lost when recompiling ui file!
|
8
|
+
=end
|
9
|
+
|
10
|
+
class Ui_CommandToolWidget
|
11
|
+
attr_reader :verticalLayout_3
|
12
|
+
attr_reader :horizontalLayout
|
13
|
+
attr_reader :verticalLayout
|
14
|
+
attr_reader :label
|
15
|
+
attr_reader :editor
|
16
|
+
attr_reader :verticalLayout_2
|
17
|
+
attr_reader :output_label
|
18
|
+
attr_reader :output
|
19
|
+
attr_reader :horizontalLayout_2
|
20
|
+
attr_reader :execute
|
21
|
+
attr_reader :clear
|
22
|
+
attr_reader :horizontalSpacer_2
|
23
|
+
attr_reader :show_output
|
24
|
+
|
25
|
+
def setupUi(commandToolWidget)
|
26
|
+
if commandToolWidget.objectName.nil?
|
27
|
+
commandToolWidget.objectName = "commandToolWidget"
|
28
|
+
end
|
29
|
+
commandToolWidget.resize(645, 307)
|
30
|
+
@verticalLayout_3 = Qt::VBoxLayout.new(commandToolWidget)
|
31
|
+
@verticalLayout_3.objectName = "verticalLayout_3"
|
32
|
+
@horizontalLayout = Qt::HBoxLayout.new()
|
33
|
+
@horizontalLayout.objectName = "horizontalLayout"
|
34
|
+
@verticalLayout = Qt::VBoxLayout.new()
|
35
|
+
@verticalLayout.objectName = "verticalLayout"
|
36
|
+
@label = Qt::Label.new(commandToolWidget)
|
37
|
+
@label.objectName = "label"
|
38
|
+
@label.alignment = Qt::AlignCenter
|
39
|
+
|
40
|
+
@verticalLayout.addWidget(@label)
|
41
|
+
|
42
|
+
@editor = Qt::PlainTextEdit.new(commandToolWidget)
|
43
|
+
@editor.objectName = "editor"
|
44
|
+
@editor.lineWrapMode = Qt::PlainTextEdit::NoWrap
|
45
|
+
@editor.tabStopWidth = 80
|
46
|
+
|
47
|
+
@verticalLayout.addWidget(@editor)
|
48
|
+
|
49
|
+
|
50
|
+
@horizontalLayout.addLayout(@verticalLayout)
|
51
|
+
|
52
|
+
@verticalLayout_2 = Qt::VBoxLayout.new()
|
53
|
+
@verticalLayout_2.objectName = "verticalLayout_2"
|
54
|
+
@output_label = Qt::Label.new(commandToolWidget)
|
55
|
+
@output_label.objectName = "output_label"
|
56
|
+
@output_label.alignment = Qt::AlignCenter
|
57
|
+
|
58
|
+
@verticalLayout_2.addWidget(@output_label)
|
59
|
+
|
60
|
+
@output = Qt::PlainTextEdit.new(commandToolWidget)
|
61
|
+
@output.objectName = "output"
|
62
|
+
@output.focusPolicy = Qt::NoFocus
|
63
|
+
@output.tabChangesFocus = true
|
64
|
+
@output.lineWrapMode = Qt::PlainTextEdit::NoWrap
|
65
|
+
@output.readOnly = true
|
66
|
+
@output.tabStopWidth = 80
|
67
|
+
@output.textInteractionFlags = Qt::TextSelectableByMouse
|
68
|
+
|
69
|
+
@verticalLayout_2.addWidget(@output)
|
70
|
+
|
71
|
+
|
72
|
+
@horizontalLayout.addLayout(@verticalLayout_2)
|
73
|
+
|
74
|
+
|
75
|
+
@verticalLayout_3.addLayout(@horizontalLayout)
|
76
|
+
|
77
|
+
@horizontalLayout_2 = Qt::HBoxLayout.new()
|
78
|
+
@horizontalLayout_2.objectName = "horizontalLayout_2"
|
79
|
+
@execute = Qt::PushButton.new(commandToolWidget)
|
80
|
+
@execute.objectName = "execute"
|
81
|
+
@sizePolicy = Qt::SizePolicy.new(Qt::SizePolicy::MinimumExpanding, Qt::SizePolicy::Fixed)
|
82
|
+
@sizePolicy.setHorizontalStretch(0)
|
83
|
+
@sizePolicy.setVerticalStretch(0)
|
84
|
+
@sizePolicy.heightForWidth = @execute.sizePolicy.hasHeightForWidth
|
85
|
+
@execute.sizePolicy = @sizePolicy
|
86
|
+
|
87
|
+
@horizontalLayout_2.addWidget(@execute)
|
88
|
+
|
89
|
+
@clear = Qt::PushButton.new(commandToolWidget)
|
90
|
+
@clear.objectName = "clear"
|
91
|
+
@sizePolicy1 = Qt::SizePolicy.new(Qt::SizePolicy::Preferred, Qt::SizePolicy::Fixed)
|
92
|
+
@sizePolicy1.setHorizontalStretch(0)
|
93
|
+
@sizePolicy1.setVerticalStretch(0)
|
94
|
+
@sizePolicy1.heightForWidth = @clear.sizePolicy.hasHeightForWidth
|
95
|
+
@clear.sizePolicy = @sizePolicy1
|
96
|
+
|
97
|
+
@horizontalLayout_2.addWidget(@clear)
|
98
|
+
|
99
|
+
@horizontalSpacer_2 = Qt::SpacerItem.new(40, 20, Qt::SizePolicy::Minimum, Qt::SizePolicy::Minimum)
|
100
|
+
|
101
|
+
@horizontalLayout_2.addItem(@horizontalSpacer_2)
|
102
|
+
|
103
|
+
@show_output = Qt::PushButton.new(commandToolWidget)
|
104
|
+
@show_output.objectName = "show_output"
|
105
|
+
@show_output.checkable = true
|
106
|
+
|
107
|
+
@horizontalLayout_2.addWidget(@show_output)
|
108
|
+
|
109
|
+
|
110
|
+
@verticalLayout_3.addLayout(@horizontalLayout_2)
|
111
|
+
|
112
|
+
@label.buddy = @editor
|
113
|
+
@output_label.buddy = @output
|
114
|
+
|
115
|
+
retranslateUi(commandToolWidget)
|
116
|
+
|
117
|
+
Qt::MetaObject.connectSlotsByName(commandToolWidget)
|
118
|
+
end # setupUi
|
119
|
+
|
120
|
+
def setup_ui(commandToolWidget)
|
121
|
+
setupUi(commandToolWidget)
|
122
|
+
end
|
123
|
+
|
124
|
+
def retranslateUi(commandToolWidget)
|
125
|
+
commandToolWidget.windowTitle = Qt::Application.translate("CommandToolWidget", "Form", nil, Qt::Application::UnicodeUTF8)
|
126
|
+
@label.text = Qt::Application.translate("CommandToolWidget", "&Command", nil, Qt::Application::UnicodeUTF8)
|
127
|
+
@output_label.text = Qt::Application.translate("CommandToolWidget", "Output", nil, Qt::Application::UnicodeUTF8)
|
128
|
+
@execute.text = Qt::Application.translate("CommandToolWidget", "&Execute", nil, Qt::Application::UnicodeUTF8)
|
129
|
+
@clear.text = Qt::Application.translate("CommandToolWidget", "C&lear output", nil, Qt::Application::UnicodeUTF8)
|
130
|
+
@show_output.text = Qt::Application.translate("CommandToolWidget", "&Show Output", nil, Qt::Application::UnicodeUTF8)
|
131
|
+
end # retranslateUi
|
132
|
+
|
133
|
+
def retranslate_ui(commandToolWidget)
|
134
|
+
retranslateUi(commandToolWidget)
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
138
|
+
|
139
|
+
module Ui
|
140
|
+
class CommandToolWidget < Ui_CommandToolWidget
|
141
|
+
end
|
142
|
+
end # module Ui
|
143
|
+
|
@@ -0,0 +1,147 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<ui version="4.0">
|
3
|
+
<class>CommandToolWidget</class>
|
4
|
+
<widget class="QWidget" name="CommandToolWidget">
|
5
|
+
<property name="geometry">
|
6
|
+
<rect>
|
7
|
+
<x>0</x>
|
8
|
+
<y>0</y>
|
9
|
+
<width>645</width>
|
10
|
+
<height>307</height>
|
11
|
+
</rect>
|
12
|
+
</property>
|
13
|
+
<property name="windowTitle">
|
14
|
+
<string>Form</string>
|
15
|
+
</property>
|
16
|
+
<layout class="QVBoxLayout" name="verticalLayout_3">
|
17
|
+
<item>
|
18
|
+
<layout class="QHBoxLayout" name="horizontalLayout">
|
19
|
+
<item>
|
20
|
+
<layout class="QVBoxLayout" name="verticalLayout">
|
21
|
+
<item>
|
22
|
+
<widget class="QLabel" name="label">
|
23
|
+
<property name="text">
|
24
|
+
<string>&Command</string>
|
25
|
+
</property>
|
26
|
+
<property name="alignment">
|
27
|
+
<set>Qt::AlignCenter</set>
|
28
|
+
</property>
|
29
|
+
<property name="buddy">
|
30
|
+
<cstring>editor</cstring>
|
31
|
+
</property>
|
32
|
+
</widget>
|
33
|
+
</item>
|
34
|
+
<item>
|
35
|
+
<widget class="QPlainTextEdit" name="editor">
|
36
|
+
<property name="lineWrapMode">
|
37
|
+
<enum>QPlainTextEdit::NoWrap</enum>
|
38
|
+
</property>
|
39
|
+
<property name="tabStopWidth">
|
40
|
+
<number>80</number>
|
41
|
+
</property>
|
42
|
+
</widget>
|
43
|
+
</item>
|
44
|
+
</layout>
|
45
|
+
</item>
|
46
|
+
<item>
|
47
|
+
<layout class="QVBoxLayout" name="verticalLayout_2">
|
48
|
+
<item>
|
49
|
+
<widget class="QLabel" name="output_label">
|
50
|
+
<property name="text">
|
51
|
+
<string>Output</string>
|
52
|
+
</property>
|
53
|
+
<property name="alignment">
|
54
|
+
<set>Qt::AlignCenter</set>
|
55
|
+
</property>
|
56
|
+
<property name="buddy">
|
57
|
+
<cstring>output</cstring>
|
58
|
+
</property>
|
59
|
+
</widget>
|
60
|
+
</item>
|
61
|
+
<item>
|
62
|
+
<widget class="QPlainTextEdit" name="output">
|
63
|
+
<property name="focusPolicy">
|
64
|
+
<enum>Qt::NoFocus</enum>
|
65
|
+
</property>
|
66
|
+
<property name="tabChangesFocus">
|
67
|
+
<bool>true</bool>
|
68
|
+
</property>
|
69
|
+
<property name="lineWrapMode">
|
70
|
+
<enum>QPlainTextEdit::NoWrap</enum>
|
71
|
+
</property>
|
72
|
+
<property name="readOnly">
|
73
|
+
<bool>true</bool>
|
74
|
+
</property>
|
75
|
+
<property name="tabStopWidth">
|
76
|
+
<number>80</number>
|
77
|
+
</property>
|
78
|
+
<property name="textInteractionFlags">
|
79
|
+
<set>Qt::TextSelectableByMouse</set>
|
80
|
+
</property>
|
81
|
+
</widget>
|
82
|
+
</item>
|
83
|
+
</layout>
|
84
|
+
</item>
|
85
|
+
</layout>
|
86
|
+
</item>
|
87
|
+
<item>
|
88
|
+
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
89
|
+
<item>
|
90
|
+
<widget class="QPushButton" name="execute">
|
91
|
+
<property name="sizePolicy">
|
92
|
+
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
93
|
+
<horstretch>0</horstretch>
|
94
|
+
<verstretch>0</verstretch>
|
95
|
+
</sizepolicy>
|
96
|
+
</property>
|
97
|
+
<property name="text">
|
98
|
+
<string>&Execute</string>
|
99
|
+
</property>
|
100
|
+
</widget>
|
101
|
+
</item>
|
102
|
+
<item>
|
103
|
+
<widget class="QPushButton" name="clear">
|
104
|
+
<property name="sizePolicy">
|
105
|
+
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
106
|
+
<horstretch>0</horstretch>
|
107
|
+
<verstretch>0</verstretch>
|
108
|
+
</sizepolicy>
|
109
|
+
</property>
|
110
|
+
<property name="text">
|
111
|
+
<string>C&lear output</string>
|
112
|
+
</property>
|
113
|
+
</widget>
|
114
|
+
</item>
|
115
|
+
<item>
|
116
|
+
<spacer name="horizontalSpacer_2">
|
117
|
+
<property name="orientation">
|
118
|
+
<enum>Qt::Horizontal</enum>
|
119
|
+
</property>
|
120
|
+
<property name="sizeType">
|
121
|
+
<enum>QSizePolicy::Minimum</enum>
|
122
|
+
</property>
|
123
|
+
<property name="sizeHint" stdset="0">
|
124
|
+
<size>
|
125
|
+
<width>40</width>
|
126
|
+
<height>20</height>
|
127
|
+
</size>
|
128
|
+
</property>
|
129
|
+
</spacer>
|
130
|
+
</item>
|
131
|
+
<item>
|
132
|
+
<widget class="QPushButton" name="show_output">
|
133
|
+
<property name="text">
|
134
|
+
<string>&Show Output</string>
|
135
|
+
</property>
|
136
|
+
<property name="checkable">
|
137
|
+
<bool>true</bool>
|
138
|
+
</property>
|
139
|
+
</widget>
|
140
|
+
</item>
|
141
|
+
</layout>
|
142
|
+
</item>
|
143
|
+
</layout>
|
144
|
+
</widget>
|
145
|
+
<resources/>
|
146
|
+
<connections/>
|
147
|
+
</ui>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
=begin
|
2
2
|
** Form generated from reading ui file 'config_widget.ui'
|
3
3
|
**
|
4
|
-
** Created:
|
5
|
-
** by: Qt User Interface Compiler version 4.7.
|
4
|
+
** Created: mer gen 12 12:12:11 2011
|
5
|
+
** by: Qt User Interface Compiler version 4.7.1
|
6
6
|
**
|
7
7
|
** WARNING! All changes made in this file will be lost when recompiling ui file!
|
8
8
|
=end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
=begin
|
2
2
|
** Form generated from reading ui file 'find_in_files_widget.ui'
|
3
3
|
**
|
4
|
-
** Created:
|
5
|
-
** by: Qt User Interface Compiler version 4.7.
|
4
|
+
** Created: mer gen 12 12:12:11 2011
|
5
|
+
** by: Qt User Interface Compiler version 4.7.1
|
6
6
|
**
|
7
7
|
** WARNING! All changes made in this file will be lost when recompiling ui file!
|
8
8
|
=end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
=begin
|
2
2
|
** Form generated from reading ui file 'add_quick_task_widget.ui'
|
3
3
|
**
|
4
|
-
** Created:
|
5
|
-
** by: Qt User Interface Compiler version 4.7.
|
4
|
+
** Created: mer gen 12 12:12:11 2011
|
5
|
+
** by: Qt User Interface Compiler version 4.7.1
|
6
6
|
**
|
7
7
|
** WARNING! All changes made in this file will be lost when recompiling ui file!
|
8
8
|
=end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
=begin
|
2
2
|
** Form generated from reading ui file 'choose_task_widget.ui'
|
3
3
|
**
|
4
|
-
** Created:
|
5
|
-
** by: Qt User Interface Compiler version 4.7.
|
4
|
+
** Created: mer gen 12 12:12:11 2011
|
5
|
+
** by: Qt User Interface Compiler version 4.7.1
|
6
6
|
**
|
7
7
|
** WARNING! All changes made in this file will be lost when recompiling ui file!
|
8
8
|
=end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
=begin
|
2
2
|
** Form generated from reading ui file 'config_widget.ui'
|
3
3
|
**
|
4
|
-
** Created:
|
5
|
-
** by: Qt User Interface Compiler version 4.7.
|
4
|
+
** Created: mer gen 12 12:12:11 2011
|
5
|
+
** by: Qt User Interface Compiler version 4.7.1
|
6
6
|
**
|
7
7
|
** WARNING! All changes made in this file will be lost when recompiling ui file!
|
8
8
|
=end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
=begin
|
2
2
|
** Form generated from reading ui file 'project_widget.ui'
|
3
3
|
**
|
4
|
-
** Created:
|
5
|
-
** by: Qt User Interface Compiler version 4.7.
|
4
|
+
** Created: mer gen 12 12:12:11 2011
|
5
|
+
** by: Qt User Interface Compiler version 4.7.1
|
6
6
|
**
|
7
7
|
** WARNING! All changes made in this file will be lost when recompiling ui file!
|
8
8
|
=end
|
data/plugins/rspec/plugin.yaml
CHANGED
@@ -10,6 +10,12 @@ class: Ruber::RSpec::Plugin
|
|
10
10
|
require: rspec
|
11
11
|
deps: [ruby_development, autosave]
|
12
12
|
ui_file: rspecui.rc
|
13
|
+
config_options:
|
14
|
+
rspec:
|
15
|
+
switch_behaviour: {default: 0}
|
16
|
+
auto_expand: {default: :expand_first}
|
17
|
+
config_widgets:
|
18
|
+
- {class: Ruber::RSpec::ConfigWidget, caption: RSpec}
|
13
19
|
project_widgets:
|
14
20
|
- {caption: RSpec, class: 'Ruber::RSpec::ProjectWidget', pixmap: rspec.png}
|
15
21
|
project_options:
|
@@ -22,8 +28,7 @@ project_options:
|
|
22
28
|
full_backtraces: {default: true}
|
23
29
|
tool_widgets: {class: 'Ruber::RSpec::ToolWidget', pixmap: rspec.png, caption: RSpec}
|
24
30
|
actions:
|
25
|
-
rspec-
|
26
|
-
rspec-go_to_file: {text: Switch to &File, shortcut: 'Alt+Shift+R, F', slot: go_to_file(), states: [active_project_exists, current_document]}
|
31
|
+
rspec-switch: {text: 'Switch to &Spec', shortcut: 'Shift+F12', slot: switch(), states: [active_project_exists, current_document]}
|
27
32
|
rspec-run_all: {text: Run &Project Specs, shortcut: 'Alt+Shift+R, P', slot: run_all(), states: [active_project_exists, rspec_running]}
|
28
33
|
rspec-run_current: {text: Run Specs for &Current File, shortcut: 'Alt+Shift+R, C', slot: run_current(), states: [active_project_exists, current_document, rspec_running]}
|
29
34
|
rspec-run_current_line: {text: Run Current Spec, shortcut: 'Alt+Shift+R, L', slot: run_current_line(), states: [active_project_exists, current_document, rspec_running]}
|
data/plugins/rspec/rspec.rb
CHANGED
@@ -1,5 +1,26 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (C) 2010,2011 by Stefano Crocco
|
3
|
+
stefano.crocco@alice.it
|
4
|
+
|
5
|
+
This program is free software; you can redistribute it andor modify
|
6
|
+
it under the terms of the GNU General Public License as published by
|
7
|
+
the Free Software Foundation; either version 2 of the License, or
|
8
|
+
(at your option) any later version.
|
9
|
+
|
10
|
+
This program is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
GNU General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU General Public License
|
16
|
+
along with this program; if not, write to the
|
17
|
+
Free Software Foundation, Inc.,
|
18
|
+
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
19
|
+
=end
|
20
|
+
|
1
21
|
require 'ruby_runner/ruby_runner'
|
2
22
|
require_relative 'ui/rspec_project_widget'
|
23
|
+
require_relative 'ui/config_widget'
|
3
24
|
|
4
25
|
require 'strscan'
|
5
26
|
require 'yaml'
|
@@ -58,6 +79,11 @@ The ending delimiter of the data written by the formatter
|
|
58
79
|
=end
|
59
80
|
ENDING_DELIMITER = /^####%%%%####KRUBY_END$/
|
60
81
|
|
82
|
+
=begin rdoc
|
83
|
+
Symbolic values associated with the @rspec/switch_behaviour@ settings
|
84
|
+
=end
|
85
|
+
SWITCH_BEHAVIOUR = [:new_tab, :horizontal, :vertical]
|
86
|
+
|
61
87
|
=begin rdoc
|
62
88
|
Finds the rspec program to use by default
|
63
89
|
|
@@ -75,7 +101,7 @@ if no rspec program was found
|
|
75
101
|
end
|
76
102
|
|
77
103
|
|
78
|
-
slots :
|
104
|
+
slots :run_all, :run_current, :run_current_line
|
79
105
|
|
80
106
|
=begin rdoc
|
81
107
|
@param [Ruber::PluginSpecification] the plugin specification object associated with
|
@@ -89,8 +115,7 @@ the plugin
|
|
89
115
|
Ruber[:main_window].set_state 'rspec_running', false
|
90
116
|
|
91
117
|
switch_prc = Proc.new{|states| states['active_project_exists'] and states['current_document']}
|
92
|
-
register_action_handler 'rspec-
|
93
|
-
register_action_handler 'rspec-go_to_spec', &switch_prc
|
118
|
+
register_action_handler 'rspec-switch', &switch_prc
|
94
119
|
register_action_handler 'rspec-run_all' do |states|
|
95
120
|
states['active_project_exists'] and !states['rspec_running']
|
96
121
|
end
|
@@ -100,12 +125,31 @@ the plugin
|
|
100
125
|
end
|
101
126
|
register_action_handler 'rspec-run_current', ¤t_prc
|
102
127
|
register_action_handler 'rspec-run_current_line', ¤t_prc
|
103
|
-
|
128
|
+
connect Ruber[:main_window], SIGNAL('current_document_changed(QObject*)'), self, SLOT('change_switch_name(QObject*)')
|
104
129
|
Ruber[:components].connect(SIGNAL('feature_loaded(QString, QObject*)')) do |f, o|
|
105
130
|
o.register_plugin self, true if f == 'autosave'
|
106
131
|
end
|
107
132
|
@output_widget = @widget
|
108
133
|
end
|
134
|
+
|
135
|
+
=begin rdoc
|
136
|
+
Whether a file is a spec file or a code file for a given project
|
137
|
+
|
138
|
+
It uses the @rspec/spec_directory@ and @rspec/spec_pattern@ options from the project
|
139
|
+
to find out whether the file is a spec file or not.
|
140
|
+
|
141
|
+
@param [String] file the file to test
|
142
|
+
@param [Project,nil] prj the project _file_ could be a spec for. If *nil*, the
|
143
|
+
current project, if any, will be used
|
144
|
+
@return [Boolean,nil] wheter or not _file_ is a spec file for the given project
|
145
|
+
or *nil* if no project was specified and there's no open project
|
146
|
+
=end
|
147
|
+
def spec_file? file, prj = Ruber[:projects].current
|
148
|
+
return nil unless prj
|
149
|
+
dir = prj[:rspec, :spec_directory, :absolute]
|
150
|
+
return false unless file.start_with? dir
|
151
|
+
File.fnmatch File.join(dir, prj[:rspec, :spec_files]), file
|
152
|
+
end
|
109
153
|
|
110
154
|
=begin rdoc
|
111
155
|
Runs rspec for the given files
|
@@ -157,10 +201,6 @@ as first argument to {Autosave::AutosavePlugin#autosave}
|
|
157
201
|
return false if @process.state != Qt::Process::NotRunning
|
158
202
|
@widget.clear_output
|
159
203
|
files = files.select{|f| File.exist? f}
|
160
|
-
# if files.empty?
|
161
|
-
# KDE::MessageBox.sorry nil, 'No spec file has been found. RSpec won\'t be run'
|
162
|
-
# return false
|
163
|
-
# end
|
164
204
|
if autosave_opts[:files]
|
165
205
|
plug = autosave_opts[:plugin] || self
|
166
206
|
what = autosave_opts[:files]
|
@@ -182,6 +222,24 @@ as first argument to {Autosave::AutosavePlugin#autosave}
|
|
182
222
|
|
183
223
|
private
|
184
224
|
|
225
|
+
=begin rdoc
|
226
|
+
Override of {PluginLike#delayed_initialize}
|
227
|
+
|
228
|
+
It sets the text of the @Switch@ action depending on whether the current document
|
229
|
+
(if any) is or not a spec file.
|
230
|
+
|
231
|
+
This can't be done from the {#initialize} method because project options haven't
|
232
|
+
already been added when that method is called.
|
233
|
+
|
234
|
+
@return [nil]
|
235
|
+
=end
|
236
|
+
def delayed_initialize
|
237
|
+
doc = Ruber[:main_window].current_document
|
238
|
+
change_switch_name doc if doc
|
239
|
+
nil
|
240
|
+
end
|
241
|
+
|
242
|
+
|
185
243
|
=begin rdoc
|
186
244
|
Override of {ExternalProgramPlugin#process_standard_output}
|
187
245
|
|
@@ -378,54 +436,35 @@ the project directory.
|
|
378
436
|
res[:full_backtraces] = prj[:rspec, :full_backtraces]
|
379
437
|
res
|
380
438
|
end
|
381
|
-
|
382
|
-
=begin rdoc
|
383
|
-
Opens the spec file(s) associated with the current document in the editor
|
384
|
-
|
385
|
-
@return [nil]
|
386
|
-
=end
|
387
|
-
def go_to_spec
|
388
|
-
prj = Ruber[:projects].current_project
|
389
|
-
unless prj
|
390
|
-
KDE::MessageBox.error nil, "You must have an open project to choose this entry.\nYOU SHOULD NEVER SEE THIS MESSAGE"
|
391
|
-
return
|
392
|
-
end
|
393
|
-
opts = options prj
|
394
|
-
doc = Ruber[:main_window].current_document
|
395
|
-
unless prj
|
396
|
-
KDE::MessageBox.error nil, "You must have an open document to choose this entry.\nYOU SHOULD NEVER SEE THIS MESSAGE"
|
397
|
-
return
|
398
|
-
end
|
399
|
-
files = specs_for_file opts, doc.path
|
400
|
-
files.each{|f| Ruber[:main_window].display_document f if File.exist? f}
|
401
|
-
nil
|
402
|
-
end
|
403
439
|
|
404
440
|
=begin rdoc
|
405
|
-
|
441
|
+
Slot associated with the @Switch@ action
|
406
442
|
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
@
|
443
|
+
Displays the spec or code file associated with the current document, according
|
444
|
+
to whether the current document is a code or spec file respectively.
|
445
|
+
|
446
|
+
It does nothing if the file corresponding to the current document isn't found
|
447
|
+
@note this method assumes that both the current project and a current document
|
448
|
+
exist
|
449
|
+
@return [EditorView,nil] an editor associated with the spec or code file associated
|
450
|
+
with the current document or *nil* if no such file is found
|
412
451
|
=end
|
413
|
-
def
|
452
|
+
def switch
|
453
|
+
file = Ruber[:main_window].current_document.path
|
414
454
|
prj = Ruber[:projects].current_project
|
415
|
-
|
416
|
-
|
417
|
-
return
|
455
|
+
if spec_file? file, prj then switch_to = file_for_spec prj, file
|
456
|
+
else switch_to = specs_for_file(options(prj), file)[0]
|
418
457
|
end
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
458
|
+
if switch_to and File.exist? switch_to
|
459
|
+
behaviour = Ruber[:config][:rspec, :switch_behaviour]
|
460
|
+
if behaviour != :new_tab
|
461
|
+
hints = {:strategy => :current_tab, :existing => :current_tab, :split => SWITCH_BEHAVIOUR[behaviour], :new => :current_tab}
|
462
|
+
else hints = {}
|
463
|
+
end
|
464
|
+
Ruber[:main_window].display_document switch_to, hints
|
424
465
|
end
|
425
|
-
file = file_for_spec prj, doc.path
|
426
|
-
Ruber[:main_window].display_document file if file and File.exist? file
|
427
|
-
nil
|
428
466
|
end
|
467
|
+
slots :switch
|
429
468
|
|
430
469
|
=begin rdoc
|
431
470
|
Determines all possible specs files associated with a code file
|
@@ -476,6 +515,27 @@ See {ExternalProgramPlugin#display_exit_message} for the meaning of the paramete
|
|
476
515
|
super unless reason.empty?
|
477
516
|
end
|
478
517
|
|
518
|
+
=begin rdoc
|
519
|
+
Changes the text of the @Switch to spec@ action depending on whether the given
|
520
|
+
document is a spec or code file
|
521
|
+
|
522
|
+
This method is usually called in response to the {MainWindow#current_document_changed}
|
523
|
+
signal.
|
524
|
+
|
525
|
+
@param [Document,nil] doc the document according to with to change the text of
|
526
|
+
the action
|
527
|
+
@return [nil]
|
528
|
+
=end
|
529
|
+
def change_switch_name doc
|
530
|
+
return unless doc
|
531
|
+
if spec_file? doc.path then text = 'Switch to &Code'
|
532
|
+
else text = 'Switch to &Spec'
|
533
|
+
end
|
534
|
+
action_collection.action('rspec-switch').text = i18n(text)
|
535
|
+
nil
|
536
|
+
end
|
537
|
+
slots 'change_switch_name(QObject*)'
|
538
|
+
|
479
539
|
end
|
480
540
|
|
481
541
|
=begin rdoc
|
@@ -562,12 +622,10 @@ While the examples are being run, a progress bar is shown.
|
|
562
622
|
def initialize parent = nil
|
563
623
|
super parent, :view => :tree, :filter => FilterModel.new
|
564
624
|
@ignore_word_wrap_option = true
|
565
|
-
view.
|
566
|
-
view.horizontal_scroll_mode = Qt::AbstractItemView::ScrollPerItem
|
567
|
-
# view.text_elide_mode = Qt::ElideNone
|
625
|
+
view.text_elide_mode = Qt::ElideNone
|
568
626
|
model.append_column [] if model.column_count < 2
|
569
627
|
@progress_bar = Qt::ProgressBar.new(self){|w| w.hide}
|
570
|
-
layout.add_widget @progress_bar,
|
628
|
+
layout.add_widget @progress_bar, 2,0
|
571
629
|
view.header_hidden = true
|
572
630
|
view.header.resize_mode = Qt::HeaderView::ResizeToContents
|
573
631
|
connect Ruber[:rspec], SIGNAL(:process_started), self, SLOT(:spec_started)
|
@@ -579,6 +637,13 @@ While the examples are being run, a progress bar is shown.
|
|
579
637
|
end
|
580
638
|
end
|
581
639
|
end
|
640
|
+
#without this, the horizontal scrollbars won't be shown
|
641
|
+
view.connect(SIGNAL('expanded(QModelIndex)')) do |_|
|
642
|
+
view.resize_column_to_contents 1
|
643
|
+
end
|
644
|
+
view.connect(SIGNAL('collapsed(QModelIndex)')) do |_|
|
645
|
+
view.resize_column_to_contents 1
|
646
|
+
end
|
582
647
|
setup_actions
|
583
648
|
end
|
584
649
|
|
@@ -801,6 +866,30 @@ It hides the progress widget and restores the default cursor.
|
|
801
866
|
model.insert "spec wasn't able to run the examples", :message_bad, nil
|
802
867
|
end
|
803
868
|
end
|
869
|
+
auto_expand_items
|
870
|
+
nil
|
871
|
+
end
|
872
|
+
|
873
|
+
=begin rdoc
|
874
|
+
Expands items according to the @rspec/auto_expand@ option
|
875
|
+
|
876
|
+
If the option is @:expand_first@, the first failed example is expanded; if the
|
877
|
+
option is @:expand_all@, all failed or pending examples are expanded. If the option
|
878
|
+
is @:expand_none@, nothing is done
|
879
|
+
@return [nil]
|
880
|
+
=end
|
881
|
+
def auto_expand_items
|
882
|
+
if model.row_count > 1
|
883
|
+
case Ruber[:config][:rspec, :auto_expand]
|
884
|
+
when :expand_first
|
885
|
+
item = model.each_row.find{|items| items[0].has_children}
|
886
|
+
view.expand filter_model.map_from_source(item[0].index) if item
|
887
|
+
when :expand_all
|
888
|
+
model.each_row do |items|
|
889
|
+
view.expand filter_model.map_from_source(items[0].index)
|
890
|
+
end
|
891
|
+
end
|
892
|
+
end
|
804
893
|
nil
|
805
894
|
end
|
806
895
|
|
@@ -930,7 +1019,43 @@ quotes around them keep them, as described in {Shellwords.split_with_quotes})
|
|
930
1019
|
end
|
931
1020
|
|
932
1021
|
end
|
933
|
-
|
1022
|
+
|
1023
|
+
class ConfigWidget < Qt::Widget
|
1024
|
+
|
1025
|
+
=begin rdoc
|
1026
|
+
The symbols associated with the entries in the @_rake__auto_expand@ widget
|
1027
|
+
=end
|
1028
|
+
AUTO_EXPAND = [:expand_none, :expand_first, :expand_all]
|
1029
|
+
|
1030
|
+
=begin rdoc
|
1031
|
+
@param [Qt::Widget,nil] parent the parent widget
|
1032
|
+
=end
|
1033
|
+
def initialize parent = nil
|
1034
|
+
super
|
1035
|
+
@ui = Ui::RSpecConfigWidget.new
|
1036
|
+
@ui.setup_ui self
|
1037
|
+
end
|
1038
|
+
|
1039
|
+
=begin rdoc
|
1040
|
+
Writer method for the @rspec/auto_expand@ option
|
1041
|
+
@param [Symbol] value the value of the option. It may be any value contained in
|
1042
|
+
the {AUTO_EXPAND} constant
|
1043
|
+
@return [Symbol] _value_
|
1044
|
+
=end
|
1045
|
+
def auto_expand= value
|
1046
|
+
@ui._rspec__auto_expand.current_index = AUTO_EXPAND.index value
|
1047
|
+
end
|
1048
|
+
|
1049
|
+
=begin rdoc
|
1050
|
+
Store method for the @rspec/auto_expand@ option
|
1051
|
+
@return [Symbol] the symbol associated with the current entry in the @_rake__auto_expand@
|
1052
|
+
widget
|
1053
|
+
=end
|
1054
|
+
def auto_expand
|
1055
|
+
AUTO_EXPAND[@ui._rspec__auto_expand.current_index]
|
1056
|
+
end
|
1057
|
+
|
1058
|
+
end
|
934
1059
|
|
935
1060
|
end
|
936
1061
|
|