redcar-dev 0.12.17dev → 0.12.18dev

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.
Files changed (155) hide show
  1. data/CHANGES +4 -2
  2. data/README.md +5 -41
  3. data/Rakefile +3 -35
  4. data/lib/redcar.rb +19 -17
  5. data/lib/redcar/runner.rb +1 -7
  6. data/lib/redcar_quick_start.rb +5 -5
  7. data/plugins/application/features/main_menu.feature +1 -1
  8. data/plugins/application/features/step_definitions/command_steps.rb +8 -7
  9. data/plugins/application/features/step_definitions/filter_list_dialog_steps.rb +25 -10
  10. data/plugins/application/features/step_definitions/key_steps.rb +6 -4
  11. data/plugins/application/features/step_definitions/menu_steps.rb +27 -26
  12. data/plugins/application/features/step_definitions/speedbar_steps.rb +28 -16
  13. data/plugins/application/features/step_definitions/tree_steps.rb +88 -64
  14. data/plugins/application/features/step_definitions/window_steps.rb +14 -10
  15. data/plugins/application/features/support/env.rb +85 -83
  16. data/plugins/application/spec/application/application_spec.rb +1 -1
  17. data/plugins/application/spec/application/clipboard_spec.rb +1 -1
  18. data/plugins/application/spec/application/command/executor_spec.rb +1 -1
  19. data/plugins/application/spec/application/command/history_spec.rb +1 -1
  20. data/plugins/application/spec/application/command_spec.rb +1 -1
  21. data/plugins/application/spec/application/keymap/builder_spec.rb +1 -1
  22. data/plugins/application/spec/application/menu/builder_spec.rb +1 -1
  23. data/plugins/application/spec/application/menu/menu_item_spec.rb +1 -1
  24. data/plugins/application/spec/application/menu_spec.rb +1 -1
  25. data/plugins/application/spec/application/navigation_history_spec.rb +2 -0
  26. data/plugins/application/spec/application/notebook_spec.rb +1 -1
  27. data/plugins/application/spec/application/sensitive_spec.rb +1 -1
  28. data/plugins/application/spec/application/speedbar_spec.rb +1 -1
  29. data/plugins/application/spec/application/treebook_spec.rb +1 -1
  30. data/plugins/application/spec/application/window_spec.rb +1 -1
  31. data/plugins/application/spec/spec_helper.rb +4 -6
  32. data/plugins/application_swt/lib/application_swt/dialogs/filter_list_dialog_controller.rb +1 -1
  33. data/plugins/application_swt/lib/application_swt/gradient.rb +15 -5
  34. data/plugins/application_swt/lib/application_swt/window.rb +1 -1
  35. data/plugins/application_swt/spec/application_swt/gradient_spec.rb +13 -14
  36. data/plugins/application_swt/spec/application_swt/menu/binding_translator_spec.rb +1 -1
  37. data/plugins/application_swt/spec/application_swt/menu_spec.rb +1 -1
  38. data/plugins/application_swt/spec/spec_helper.rb +1 -19
  39. data/plugins/auto_completer/features/auto_complete.feature +7 -7
  40. data/plugins/auto_completer/features/step_definitions/auto_complete_steps.rb +3 -1
  41. data/plugins/auto_completer/features/step_definitions/dependency_steps.rb +0 -0
  42. data/plugins/auto_indenter/features/java_style_indentation.feature +5 -3
  43. data/plugins/auto_indenter/features/ruby_style_indentation.feature +13 -13
  44. data/plugins/auto_indenter/features/step_definitions/indentation_steps.rb +3 -1
  45. data/plugins/auto_indenter/spec/auto_indenter/analyzer_spec.rb +1 -1
  46. data/plugins/auto_indenter/spec/spec_helper.rb +1 -5
  47. data/plugins/auto_pairer/features/auto_pairer.feature +1 -1
  48. data/plugins/comment/features/line_comment.feature +31 -26
  49. data/plugins/comment/features/selection_comment.feature +1 -1
  50. data/plugins/comment/features/step_definitions/comment_steps.rb +6 -2
  51. data/plugins/comment/vendor/comment_lib.json +2 -0
  52. data/plugins/core/lib/core.rb +26 -0
  53. data/plugins/core/spec/core/base_storage_spec.rb +1 -1
  54. data/plugins/core/spec/core/gui_spec.rb +1 -1
  55. data/plugins/core/spec/core/observable_spec.rb +2 -1
  56. data/plugins/core/spec/core/persistent_cache_spec.rb +1 -1
  57. data/plugins/core/spec/core/shared_storage_spec.rb +1 -1
  58. data/plugins/core/spec/core/storage_spec.rb +1 -1
  59. data/plugins/core/spec/core/task_queue_spec.rb +1 -3
  60. data/plugins/core/spec/spec_helper.rb +1 -4
  61. data/plugins/declarations/spec/declarations/file_spec.rb +1 -1
  62. data/plugins/declarations/spec/spec_helper.rb +1 -5
  63. data/plugins/document_search/features/find.feature +39 -39
  64. data/plugins/document_search/features/step_definitions/find_steps.rb +6 -2
  65. data/plugins/edit_view/features/align_assignment.feature +6 -82
  66. data/plugins/edit_view/features/case_change.feature +22 -22
  67. data/plugins/edit_view/features/cursor_navigation.feature +2 -2
  68. data/plugins/edit_view/features/cut_and_paste.feature +9 -9
  69. data/plugins/edit_view/features/indentation_commands.feature +8 -8
  70. data/plugins/edit_view/features/line_delimiter.feature +7 -7
  71. data/plugins/edit_view/features/multiple_windows.feature +48 -48
  72. data/plugins/edit_view/features/step_definitions/dependency_steps.rb +0 -0
  73. data/plugins/edit_view/features/step_definitions/editing_steps.rb +237 -127
  74. data/plugins/edit_view/features/step_definitions/grammar_steps.rb +5 -1
  75. data/plugins/edit_view/features/step_definitions/notebook_steps.rb +38 -24
  76. data/plugins/edit_view/features/step_definitions/tab_steps.rb +83 -45
  77. data/plugins/edit_view/features/step_definitions/window_steps.rb +75 -54
  78. data/plugins/edit_view/features/support/env.rb +4 -23
  79. data/plugins/edit_view/lib/edit_view/commands/align_assignment_command.rb +29 -30
  80. data/plugins/edit_view/lib/edit_view/document.rb +23 -0
  81. data/plugins/edit_view/spec/edit_view/commands/align_assignment_command_spec.rb +83 -0
  82. data/plugins/edit_view/spec/edit_view/document/indentation_spec.rb +1 -1
  83. data/plugins/edit_view/spec/edit_view/document_spec.rb +1 -1
  84. data/plugins/edit_view/spec/spec_helper.rb +1 -4
  85. data/plugins/edit_view_swt/spec/edit_view_swt/word_movement_spec.rb +1 -1
  86. data/plugins/edit_view_swt/spec/spec_helper.rb +1 -4
  87. data/plugins/html_view/features/fixtures/sample.html +1 -1
  88. data/plugins/html_view/features/step_definitions/html_view_steps.rb +40 -39
  89. data/plugins/java/features/syntax_check_java.feature +18 -16
  90. data/plugins/line_tools/features/step_definitions/line_tools_steps.rb +18 -6
  91. data/plugins/macros/features/block_selection_in_macros.feature +47 -47
  92. data/plugins/macros/features/step_definitions/macro_steps.rb +9 -3
  93. data/plugins/macros/features/step_definitions/prediction_steps.rb +6 -2
  94. data/plugins/macros/plugin.rb +2 -1
  95. data/plugins/macros/spec/macros/predictive/sequence_finder_spec.rb +1 -1
  96. data/plugins/macros/spec/spec_helper.rb +1 -6
  97. data/plugins/outline_view/features/outline_view.feature +5 -5
  98. data/plugins/outline_view/features/step_definitions/outline_steps.rb +29 -17
  99. data/plugins/plugin_manager_ui/lib/plugin_manager_ui.rb +1 -1
  100. data/plugins/project/features/close_directory_tree.feature +0 -12
  101. data/plugins/project/features/open_directory_tree.feature +1 -2
  102. data/plugins/project/features/step_definitions/directory_steps.rb +13 -5
  103. data/plugins/project/features/step_definitions/file_steps.rb +23 -9
  104. data/plugins/project/features/step_definitions/find_file_steps.rb +6 -2
  105. data/plugins/project/features/step_definitions/project_tree_steps.rb +6 -2
  106. data/plugins/project/features/watch_for_modified_files.feature +1 -1
  107. data/plugins/project/spec/project/adapters/remote_protocols/ftp_spec.rb +1 -1
  108. data/plugins/project/spec/project/adapters/remote_protocols/sftp_spec.rb +1 -1
  109. data/plugins/project/spec/project/adapters/remote_spec.rb +1 -1
  110. data/plugins/project/spec/project/dir_mirror_spec.rb +1 -1
  111. data/plugins/project/spec/project/file_list_spec.rb +1 -1
  112. data/plugins/project/spec/project/file_mirror_spec.rb +2 -1
  113. data/plugins/project/spec/spec_helper.rb +1 -4
  114. data/plugins/project_search/spec/project_search/binary_data_detector_spec.rb +1 -1
  115. data/plugins/project_search/spec/project_search/word_search_spec.rb +1 -1
  116. data/plugins/project_search/spec/spec_helper.rb +1 -4
  117. data/plugins/{application → redcar}/features/navigation_history.feature +8 -8
  118. data/plugins/redcar/features/step_definitions/font_steps.rb +9 -5
  119. data/plugins/redcar/redcar.rb +0 -26
  120. data/plugins/repl/features/step_definitions/repl_steps.rb +15 -5
  121. data/plugins/repl/plugin.rb +1 -1
  122. data/plugins/repl/spec/repl/repl_mirror_spec.rb +1 -1
  123. data/plugins/repl/spec/spec_helper.rb +1 -4
  124. data/plugins/ruby/spec/ruby/repl_mirror_spec.rb +1 -1
  125. data/plugins/ruby/spec/spec_helper.rb +1 -5
  126. data/plugins/runnables/features/parameter_input.feature +43 -43
  127. data/plugins/runnables/features/step_definitions/runnable_steps.rb +9 -3
  128. data/plugins/runnables/plugin.rb +2 -2
  129. data/plugins/runnables/spec/runnables/output_processor_spec.rb +1 -1
  130. data/plugins/runnables/spec/spec_helper.rb +1 -5
  131. data/plugins/scm_svn/features/add_and_commit.feature +1 -0
  132. data/plugins/scm_svn/features/checkout.feature +1 -0
  133. data/plugins/scm_svn/features/edit_and_index.feature +1 -0
  134. data/plugins/scm_svn/features/ignore_files.feature +1 -0
  135. data/plugins/scm_svn/features/merge.feature +1 -0
  136. data/plugins/scm_svn/features/resolve_conflict.feature +1 -0
  137. data/plugins/scm_svn/features/revert_and_delete.feature +1 -0
  138. data/plugins/scm_svn/features/step_definitions/branch_and_merge_steps.rb +14 -9
  139. data/plugins/scm_svn/features/support/env.rb +4 -4
  140. data/plugins/scm_svn/features/switch_branches.feature +1 -0
  141. data/plugins/scm_svn/features/update.feature +1 -0
  142. data/plugins/strip_trailing_spaces/features/strip_trailing_spaces.feature +4 -4
  143. data/plugins/test_runner/plugin.rb +3 -1
  144. data/plugins/test_runner/spec/run_test_command_spec.rb +58 -50
  145. data/plugins/test_runner/spec/spec_helper.rb +1 -5
  146. data/plugins/textmate/features/step_definitions/tree_steps.rb +2 -0
  147. data/plugins/todo_list/features/todo_list.feature +1 -1
  148. data/plugins/todo_list/spec/spec_helper.rb +1 -4
  149. data/plugins/todo_list/spec/todo_list/file_parser_spec.rb +1 -1
  150. data/plugins/tree_view_swt/lib/tree_view_swt.rb +2 -1
  151. data/plugins/web_bookmarks/features/step_definitions/web_steps.rb +1 -1
  152. metadata +48 -48
  153. data/lib/redcar/installer.rb +0 -178
  154. data/plugins/key_bindings/spec/spec_helper.rb +0 -5
  155. data/plugins/scm/spec/spec_helper.rb +0 -5
data/CHANGES CHANGED
@@ -1,8 +1,8 @@
1
1
  Version 0.12 (TBA)
2
2
  ==================
3
3
 
4
- * Features run all the way through again, and can be run in the background
5
- (the test window no longer needs to be focussed) (Dan Lucraft)
4
+ * Features run all the way through again, and use Swtbot in places to
5
+ allow us to simulate events more accurately (Helpful for macros) (Dan Lucraft)
6
6
  * Added --no-splash option (Dan Lucraft)
7
7
  * Fix runnables for JRuby 1.6.1 (Chris Nelson)
8
8
  * Improved developer first experience (Dr Nic Williams)
@@ -22,6 +22,8 @@ Version 0.12 (TBA)
22
22
  * Project tree has colourful icons (Delisa Mason)
23
23
  * Uses gems to install everything (Dan Lucraft)
24
24
  * Wildcards permitted in project search (Delisa Mason)
25
+ * Installation entirely through Rubygems (Dan Lucraft)
26
+ * Rad new icon (Delisa Mason)
25
27
 
26
28
  Version 0.11 (23 March 2011)
27
29
  ============================
data/README.md CHANGED
@@ -43,34 +43,6 @@ To see full usage details.
43
43
  * Irc at #redcar on irc.freenode.net
44
44
  * Mailing list at http://groups.google.com/group/redcar-editor
45
45
 
46
- ## INSTALLING FROM SOURCE
47
-
48
- If you want to contribute to Redcar, you can install it from the source code and make modifications before submitting a patch.
49
-
50
- If you're on any platform, you'll need the bundler and rake gems installed as prerequisites.
51
- If you're running Windows, you'll also need to install the rubyzip gem:
52
-
53
- $ gem install rubyzip
54
-
55
- Download from github, checkout the submodules and install the jars:
56
-
57
- $ git clone http://github.com/redcar/redcar.git
58
- $ cd redcar
59
- $ bundle
60
- $ rake initialise
61
- $ ruby bin/redcar install
62
-
63
- To run:
64
-
65
- $ ruby bin/redcar
66
-
67
- ### Updating a source build
68
-
69
- If you are running a source version of Redcar and you have pulled updates from master, then you may have to update your local repo:
70
-
71
- $ rake initialise
72
- $ ruby bin/redcar install
73
-
74
46
  ## TESTS
75
47
 
76
48
  NB. Redcar features are known to work with Cucumber 0.9.2, and known NOT to work with Cucumber < 0.9
@@ -79,7 +51,7 @@ To run the tests you need JRuby installed. You also need rspec and cucumber inst
79
51
 
80
52
  To install the necessary gems:
81
53
 
82
- $ jruby -S bundle install
54
+ $ jruby -S bundle install
83
55
 
84
56
  To run all specs and all features:
85
57
 
@@ -87,27 +59,19 @@ To run all specs and all features:
87
59
 
88
60
  ### Specs
89
61
 
90
- On OSX:
91
-
92
- $ jruby -J-XstartOnFirstThread -S spec plugins/#{plugin_name}/spec/
93
-
94
- On Linux/Windows:
95
-
96
- $ jruby -S spec plugins/#{plugin_name}/spec/
97
-
98
- To just run all specs:
62
+ To run all specs:
99
63
 
100
- $ rake specs
64
+ $ rspec plugins/*/spec/
101
65
 
102
66
  ### Features
103
67
 
104
68
  On OSX:
105
69
 
106
- $ jruby -J-XstartOnFirstThread bin/cucumber --exclude ".*fixtures.*" plugins/#{plugin_name}/features
70
+ $ jruby -J-XstartOnFirstThread swt_cucumber plugins/#{plugin_name}/features
107
71
 
108
72
  On Linux/Windows:
109
73
 
110
- $ jruby bin/cucumber --exclude ".*fixtures.*" plugins/#{plugin_name}/features/
74
+ $ jruby -J-XstartOnFirstThread swt_cucumber plugins/#{plugin_name}/features
111
75
 
112
76
  To just run all features:
113
77
 
data/Rakefile CHANGED
@@ -1,13 +1,8 @@
1
1
  require 'bundler'
2
- REDCAR_VERSION = "0.12.0dev" # also change in lib/redcar.rb!
3
2
  require 'fileutils'
4
3
 
5
- # explitely use rspec < 2.0
6
- gem 'rspec', '<2.0'
7
- require 'spec/rake/spectask'
8
4
  require 'cucumber/rake/task'
9
- require "rake/gempackagetask"
10
- require "rake/rdoctask"
5
+
11
6
  Dir[File.expand_path("../lib/tasks/*.rake", __FILE__)].each { |f| load f }
12
7
 
13
8
  if RUBY_PLATFORM =~ /mswin|mingw/
@@ -136,13 +131,8 @@ task :default => ["specs", "cucumber"]
136
131
 
137
132
  desc "Run all specs"
138
133
  task :specs do
139
- files = Dir['plugins/*/spec/*/*_spec.rb'] + Dir['plugins/*/spec/*/*/*_spec.rb'] + Dir['plugins/*/spec/*/*/*/*_spec.rb']
140
- case Config::CONFIG["host_os"]
141
- when "darwin"
142
- sh("jruby -J-XstartOnFirstThread -S bundle exec spec -c #{files.join(" ")} && echo 'done'")
143
- else
144
- sh("jruby -S bundle exec spec -c #{files.join(" ")} && echo 'done'")
145
- end
134
+ plugin_spec_dirs = Dir["plugins/*/spec"]
135
+ sh("jruby -S bundle exec rspec -c #{plugin_spec_dirs.join(" ")}")
146
136
  end
147
137
 
148
138
  desc "Run all features"
@@ -191,28 +181,6 @@ task :run_ci do
191
181
  contrl.run
192
182
  end
193
183
 
194
- desc "Release gem"
195
- task :release => :gem do
196
- require 'aws/s3'
197
- credentials = YAML.load(File.read("/Users/danlucraft/.s3-creds.yaml"))
198
- AWS::S3::Base.establish_connection!(
199
- :access_key_id => credentials['access_key_id'],
200
- :secret_access_key => credentials["secret_access_key"]
201
- )
202
-
203
- redcar_bucket = AWS::S3::Bucket.find('redcar')
204
- s3_uploads = {
205
- "vendor/java-mateview/release/java-mateview.jar" => "java-mateview-#{REDCAR_VERSION}.jar",
206
- "plugins/application_swt/lib/dist/application_swt.jar" => "application_swt-#{REDCAR_VERSION}.jar",
207
- "pkg/redcar-#{REDCAR_VERSION}.gem" => "redcar-#{REDCAR_VERSION}.gem"
208
- }
209
-
210
- s3_uploads.each do |source, target|
211
- p [source, target]
212
- AWS::S3::S3Object.store(target, open(source), 'redcar', :access => :public_read)
213
- end
214
- end
215
-
216
184
  namespace :redcar do
217
185
  def hash_with_hash_default
218
186
  Hash.new {|h,k| h[k] = hash_with_hash_default }
@@ -1,7 +1,5 @@
1
1
 
2
2
  $:.push(File.expand_path(File.join(File.dirname(__FILE__))))
3
- $:.push(File.expand_path(File.join(File.dirname(__FILE__), %w{.. vendor spoon lib})))
4
- $:.push(File.expand_path(File.join(File.dirname(__FILE__), %w{.. vendor ffi lib})))
5
3
 
6
4
  require 'redcar/usage'
7
5
 
@@ -16,14 +14,17 @@ require 'uri'
16
14
  require 'fileutils'
17
15
 
18
16
  require 'rubygems'
17
+ require "bundler/setup"
19
18
  require 'redcar-icons'
20
19
 
21
20
  begin
22
21
  if Config::CONFIG["RUBY_INSTALL_NAME"] == "jruby"
22
+ =begin
23
23
  gem "spoon"
24
24
  require 'spoon'
25
25
  module Redcar; SPOON_AVAILABLE = true; end
26
26
  else
27
+ =end
27
28
  module Redcar; SPOON_AVAILABLE = false; end
28
29
  end
29
30
  rescue LoadError
@@ -57,7 +58,7 @@ end
57
58
  #
58
59
  # and so on.
59
60
  module Redcar
60
- VERSION = '0.12.17dev' # also change in the gemspec!
61
+ VERSION = '0.12.18dev' # also change in the gemspec!
61
62
  VERSION_MAJOR = 0
62
63
  VERSION_MINOR = 12
63
64
  VERSION_RELEASE = 0
@@ -103,10 +104,12 @@ module Redcar
103
104
  def self.add_plugin_sources(manager)
104
105
  manager.add_plugin_source(File.join(root, "plugins"))
105
106
  manager.add_plugin_source(File.join(user_dir, "plugins"))
106
- manager.add_gem_plugin_source
107
+ unless Redcar.environment == :test
108
+ manager.add_gem_plugin_source
109
+ end
107
110
  end
108
111
 
109
- def self.load_prerequisites
112
+ def self.load_prerequisites(options={})
110
113
  exit if ARGV.include?("--quit-immediately")
111
114
  require 'java'
112
115
 
@@ -127,18 +130,17 @@ module Redcar
127
130
 
128
131
  gem 'swt'
129
132
  require 'swt/minimal'
133
+
134
+ unless no_gui_mode?
135
+ gui = Redcar::Gui.new("swt")
136
+ gui.register_event_loop(Swt::EventLoop.new)
137
+ gui.register_features_runner(Swt::CucumberRunner.new)
138
+ Redcar.gui = gui
130
139
 
131
- gui = Redcar::Gui.new("swt")
132
- gui.register_event_loop(Swt::EventLoop.new)
133
- gui.register_features_runner(Swt::CucumberRunner.new)
134
- Redcar.gui = gui
135
-
136
- plugin_manager.load("splash_screen")
140
+ plugin_manager.load("splash_screen")
141
+ end
137
142
  end
138
143
 
139
- def self.load_useful_libraries
140
- end
141
-
142
144
  def self.load_plugins
143
145
  begin
144
146
  exit if ARGV.include?("--quit-after-splash")
@@ -174,8 +176,8 @@ module Redcar
174
176
  end
175
177
  end
176
178
 
177
- def self.load_unthreaded
178
- load_prerequisites
179
+ def self.load_unthreaded(options={})
180
+ load_prerequisites(options)
179
181
  load_plugins
180
182
  end
181
183
 
@@ -286,7 +288,7 @@ module Redcar
286
288
  end
287
289
 
288
290
  def self.show_log?
289
- ARGV.include?("--show-log")
291
+ ARGV.include?("--show-log") or ENV["REDCAR_SHOW_LOG"]
290
292
  end
291
293
 
292
294
  def self.custom_log_level
@@ -2,7 +2,7 @@ module Redcar
2
2
  # Cribbed from ruby-processing. Many thanks!
3
3
  class Runner
4
4
  def run
5
- forking = ARGV.include?("--fork") and ARGV.first != "install"
5
+ forking = ARGV.include?("--fork")
6
6
  no_runner = ARGV.include?("--no-sub-jruby")
7
7
  jruby = Config::CONFIG["RUBY_INSTALL_NAME"] == "jruby"
8
8
  osx = (not [:linux, :windows].include?(Redcar.platform))
@@ -60,11 +60,6 @@ module Redcar
60
60
  end
61
61
 
62
62
  jruby_complete = RedcarJRuby.jar_path
63
- unless File.exist?(jruby_complete)
64
- puts "\nCan't find jruby jar at #{jruby_complete}, did you run 'redcar install' ?"
65
- exit 1
66
- end
67
-
68
63
  command = (RUBY_PLATFORM.downcase =~ /mswin|mingw|win32/ ? ["javaw"] : ["java"])
69
64
  command.push(*java_args)
70
65
  command.push("-Xbootclasspath/a:#{jruby_complete}")
@@ -89,7 +84,6 @@ module Redcar
89
84
  arg
90
85
  end
91
86
  end
92
- result.delete("install")
93
87
  result
94
88
  end
95
89
 
@@ -5,14 +5,14 @@ module Redcar
5
5
  DRB_PORTS = {"user" => 10021, "test" => 10022, "development" => 10021}
6
6
  DONT_READ_STDIN_ARG = "--ignore-stdin"
7
7
 
8
- def self.environment
9
- :user
10
- end
11
-
12
8
  def self.drb_port
13
9
  DRB_PORTS[Redcar.environment.to_s]
14
10
  end
15
11
 
12
+ def self.environment
13
+ :user
14
+ end
15
+
16
16
  def self.read_stdin
17
17
  if not $stdin.tty? and not ARGV.include?(DONT_READ_STDIN_ARG)
18
18
  data = ""
@@ -51,7 +51,7 @@ module Redcar
51
51
  if arg =~ /--untitled-file=(.*)/
52
52
  path = $1 if File.file?($1)
53
53
  untitled = true
54
- elsif arg !~ /^--/ # not --something
54
+ elsif arg !~ /^-/ # not --something
55
55
  path = File.expand_path(arg)
56
56
  if !File.exist?(path)
57
57
  require 'fileutils'
@@ -6,4 +6,4 @@ Feature: Main menu
6
6
 
7
7
  Scenario: There should be a File|New entry
8
8
  Then there should be a main menu
9
- And the "File" menu should contain a "New" entry
9
+ And the "File" menu should contain a "New" entry
@@ -1,10 +1,11 @@
1
-
2
1
  When /^I run the command ([^\s]+)$/ do |command_name|
3
- command_class = eval(command_name)
4
- command = command_class.new
5
- if command.is_a?(Redcar::DocumentCommand)
6
- command.run(:env => {:edit_view => implicit_edit_view})
7
- else
8
- command.run
2
+ Swt.sync_exec do
3
+ command_class = eval(command_name)
4
+ command = command_class.new
5
+ if command.is_a?(Redcar::DocumentCommand)
6
+ command.run(:env => {:edit_view => implicit_edit_view})
7
+ else
8
+ command.run
9
+ end
9
10
  end
10
11
  end
@@ -8,35 +8,50 @@ def filter_dialog_items
8
8
  end
9
9
 
10
10
  Then /^there should be a filter dialog open$/ do
11
- filter_dialog.should_not be_nil
11
+ Swt.sync_exec do
12
+ filter_dialog.should_not be_nil
13
+ end
12
14
  end
13
15
 
14
16
  Then /^there should be no filter dialog open$/ do
15
- filter_dialog.should be_nil
17
+ Swt.sync_exec do
18
+ filter_dialog.should be_nil
19
+ end
16
20
  end
17
21
 
18
22
  When /^I set the filter to "(.*)"$/ do |text|
19
- filter_dialog.text.set_text(text)
23
+ Swt.sync_exec do
24
+ filter_dialog.text.set_text(text)
25
+ end
20
26
  end
21
27
 
22
28
  When /^I select in the filter dialog$/ do
23
- filter_dialog.controller.selected
29
+ Swt.sync_exec do
30
+ filter_dialog.controller.selected
31
+ end
24
32
  end
25
33
 
26
34
  When /^I wait "(.*)" seconds?$/ do |time|
27
- Cucumber::Ast::StepInvocation.wait_time = time.to_f
35
+ s = Time.now + time.to_f
36
+ sleep 0.1 until Time.now > s
28
37
  end
29
38
 
30
39
  Then /^the filter dialog should have (no|\d+) entr(?:y|ies)$/ do |num|
31
- num = (num == "no" ? 0 : num.to_i)
32
- filter_dialog_items.length.should == num
40
+ Swt.sync_exec do
41
+ num = (num == "no" ? 0 : num.to_i)
42
+ filter_dialog_items.length.should == num
43
+ end
33
44
  end
34
45
 
35
46
  Then /^I should see "(.*)" at (\d+) the filter dialog$/ do |text, pos|
36
- pos = pos.to_i
37
- filter_dialog_items[pos].should == text
47
+ Swt.sync_exec do
48
+ pos = pos.to_i
49
+ filter_dialog_items[pos].should == text
50
+ end
38
51
  end
39
52
 
40
53
  Then /^I should not see "(.*)" in the filter dialog$/ do |text|
41
- filter_dialog_items.include?(text).should be_false
54
+ Swt.sync_exec do
55
+ filter_dialog_items.include?(text).should be_false
56
+ end
42
57
  end
@@ -10,9 +10,11 @@ key_presses = {
10
10
  }
11
11
  key_presses.each do |const,text|
12
12
  When "I press the #{text} key" do
13
- tab = Redcar.app.focussed_window.focussed_notebook_tab
14
- widget = tab.edit_view.controller.mate_text.get_control
15
- key = Swt::SWT.const_get(const)
16
- FakeKeyEvent.new(key,widget)
13
+ Swt.sync_exec do
14
+ tab = Redcar.app.focussed_window.focussed_notebook_tab
15
+ widget = tab.edit_view.controller.mate_text.get_control
16
+ key = Swt::SWT.const_get(const)
17
+ FakeKeyEvent.new(key,widget)
18
+ end
17
19
  end
18
20
  end
@@ -1,42 +1,43 @@
1
1
 
2
2
  Then /^there should be a main menu$/ do
3
- main_menu.should_not be_nil
3
+ Swt.bot.menu("File").should_not be_nil
4
4
  end
5
5
 
6
6
  Then /^the main menu should contain "([^\"]*)" entries$/ do |entries|
7
- entries = entries.split(",").map {|e| e.strip }
8
- items = main_menu.get_items.to_a
9
- items.should_not be_empty
10
- texts = items.map {|item| item.get_text }
11
- entries.all? {|e| texts.include?(get_menu_name(e))}.should be_true
7
+ Swt.sync_exec do
8
+ entry_names = entries.split(",").map {|e| e.strip }
9
+ entry_names.each {|name| Swt.bot.menu(name).should_not be_nil }
10
+ end
12
11
  end
13
12
 
14
13
  Then /^the "([^\"]*)" menu should contain a "([^\"]*)" entry$/ do |menu_text, entry_text|
15
- items = main_menu.get_items.to_a
16
- menu = items.detect {|i| i.text == get_menu_name(menu_text)}
17
- items = menu.get_menu.get_items.to_a
18
- menu_texts = items.map{|i| i.text.split("\t").first}
19
- menu_texts.detect {|t| t == entry_text}.should_not be_nil
14
+ Swt.bot.menu(menu_text).menu(entry_text).should_not be_nil
20
15
  end
21
16
 
22
17
  Then /^the menu item "([^\"]*)\|([^\"]*)" should be (active|inactive)$/ do |menu_name, menu_item, active|
23
- items = main_menu.get_items.to_a
24
- menu = items.detect {|i| i.text == get_menu_name(menu_name)}
25
- items = menu.get_menu.get_items.to_a
26
- item = items.detect {|i| i.text.split("\t").first == menu_item }
27
- case active
28
- when "active"
29
- item.enabled.should be_true
30
- when "inactive"
31
- item.enabled.should be_false
18
+ Swt.sync_exec do
19
+ item = Swt.bot.menu(menu_name).menu(menu_item)
20
+ case active
21
+ when "active"
22
+ item.should be_enabled
23
+ when "inactive"
24
+ item.should_not be_enabled
25
+ end
32
26
  end
33
27
  end
34
28
 
35
29
  When /^I (?:open the|click) "([^"]*)" from the "([^"]*)" menu$/ do |menu_item, menu_name|
36
- menu_items = menu_name.split("/").inject(main_menu.get_items.to_a.dup) do |items, item_name|
37
- m = items.detect {|i| i.text == get_menu_name(item_name)}
38
- items = m.get_menu.get_items.to_a
30
+ raise "use 'I select menu item ()' instead"
31
+ end
32
+
33
+ When /I select menu item "(.*)"/ do |menu_path|
34
+ Swt.sync_exec do
35
+ bits = menu_path.split(/\||\//)
36
+ curr = Swt.bot
37
+ bits.each { |bit| curr = curr.menu(bit) }
38
+ curr.click
39
39
  end
40
- item = menu_items.detect {|i| i.text.split("\t").first == menu_item }
41
- FakeEvent.new(Swt::SWT::Selection, item)
42
- end
40
+ end
41
+
42
+
43
+