Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 223 lines (192 sloc) 6.269 kb
3c5a729d » danlucraft
2009-09-20 Cleaned up the load path; can now run plugin specs
1
304ebe7d » mscharley
2010-08-27 Implemented the spoon gem into the --fork option.
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})))
3c5a729d » danlucraft
2009-09-20 Cleaned up the load path; can now run plugin specs
5
1fa016d2 » danlucraft
2010-01-23 Bumped version number to 0.3.3dev and merged boot.rb into redcar.rb
6 require 'redcar/usage'
7
8 require 'redcar/ruby_extensions'
9 require 'redcar/instance_exec'
58640fbc » danlucraft
2010-01-09 Move install command help into usage.rb
10 require 'redcar/usage'
97096458 » danlucraft
2010-03-01 Spawn a sub jruby process unless --no-sub-jruby is specified. This ma…
11 require 'regex_replace'
58640fbc » danlucraft
2010-01-09 Move install command help into usage.rb
12
1fa016d2 » danlucraft
2010-01-23 Bumped version number to 0.3.3dev and merged boot.rb into redcar.rb
13 require 'forwardable'
14 require 'yaml'
284dcb4b » danlucraft
2010-06-25 Make sure URI is required, some users having problems
15 require 'uri'
1fa016d2 » danlucraft
2010-01-23 Bumped version number to 0.3.3dev and merged boot.rb into redcar.rb
16
304ebe7d » mscharley
2010-08-27 Implemented the spoon gem into the --fork option.
17 begin
18 if Config::CONFIG["RUBY_INSTALL_NAME"] == "jruby"
19 require 'spoon'
20 module Redcar; SPOON_AVAILABLE = true; end
21 else
d491a209 » mscharley
2010-08-27 Added null device support for Windows.
22 module Redcar; SPOON_AVAILABLE = false; end
304ebe7d » mscharley
2010-08-27 Implemented the spoon gem into the --fork option.
23 end
24 rescue LoadError
25 module Redcar; SPOON_AVAILABLE = false; end
26 end
27
1fa016d2 » danlucraft
2010-01-23 Bumped version number to 0.3.3dev and merged boot.rb into redcar.rb
28 # ## Loading and Initialization
29 #
4bf5b18d » danlucraft
2010-01-25 Speculative jmv change
30 # Every feature in Redcar is written as a plugin. This module contains a few
1fa016d2 » danlucraft
2010-01-23 Bumped version number to 0.3.3dev and merged boot.rb into redcar.rb
31 # methods to bootstrap the plugins by loading the PluginManager.
32 #
4bf5b18d » danlucraft
2010-01-25 Speculative jmv change
33 # Once loaded, bin/redcar will start the gui pump, which will run
34 # Redcar.gui.start. This starts the GUI library's event loop and hands over
1fa016d2 » danlucraft
2010-01-23 Bumped version number to 0.3.3dev and merged boot.rb into redcar.rb
35 # control to the GUI.
36 #
37 # ## Application
38 #
4bf5b18d » danlucraft
2010-01-25 Speculative jmv change
39 # The top class of Redcar is a {Redcar::Application}, which handles the creation
1fa016d2 » danlucraft
2010-01-23 Bumped version number to 0.3.3dev and merged boot.rb into redcar.rb
40 # of Redcar::Windows. {Redcar::Application} is a good place to start
4bf5b18d » danlucraft
2010-01-25 Speculative jmv change
41 # to see how the Redcar models are created.
1fa016d2 » danlucraft
2010-01-23 Bumped version number to 0.3.3dev and merged boot.rb into redcar.rb
42 #
43 # {Redcar::ApplicationSWT} is the start point for the SWT GUI, which listens
ae36d029 » danlucraft
2010-02-13 Soft tabs should respect tab stops
44 # for events from the {Redcar::Application} model and reflects them in the GUI.
1fa016d2 » danlucraft
2010-01-23 Bumped version number to 0.3.3dev and merged boot.rb into redcar.rb
45 #
46 # This structure of a model and a controller that listens to it is repeated for
47 # each part of Redcar reflected in the GUI.
48 #
ae36d029 » danlucraft
2010-02-13 Soft tabs should respect tab stops
49 # * {Redcar::Window} has {Redcar::ApplicationSWT::Window}
50 # * {Redcar::Notebook} has {Redcar::ApplicationSWT::Notebook}
51 # * {Redcar::EditTab} has {Redcar::EditViewSWT::EditTab}
1fa016d2 » danlucraft
2010-01-23 Bumped version number to 0.3.3dev and merged boot.rb into redcar.rb
52 #
53 # and so on.
926d3dd3 » danlucraft
2010-01-09 Changed the install process so it requires a 'sudo redcar install' st…
54 module Redcar
558a3727 » mscharley
2010-08-24 Bumped Redcar back to a dev version for those of us using git.
55 VERSION = '0.5.0dev'
926d3dd3 » danlucraft
2010-01-09 Changed the install process so it requires a 'sudo redcar install' st…
56 VERSION_MAJOR = 0
558a3727 » mscharley
2010-08-24 Bumped Redcar back to a dev version for those of us using git.
57 VERSION_MINOR = 5
4d143712 » danlucraft
2010-08-23 Bump to version 0.4
58 VERSION_RELEASE = 0
f6fcfa1a » rdp
2010-02-08 attempt to startup using drb if another redcar instance is available
59
3f454912 » danlucraft
2010-02-14 Fix storage spec and added Redcar.environment
60 ENVIRONMENTS = [:user, :debug, :test]
11d608bf » danlucraft
2010-04-11 Halve startup time (warm)
61
62 PROCESS_START_TIME = Time.now
0a03cb10 » mscharley
2010-08-24 Added a global icon directory constant to aide in the use of these ic…
63
aa61ceda » mscharley
2010-08-24 Fixed some bugs in my last commit.
64 ICONS_DIRECTORY = File.expand_path(File.join(File.dirname(__FILE__), %w{.. share icons}))
3f454912 » danlucraft
2010-02-14 Fix storage spec and added Redcar.environment
65
66 def self.environment=(env)
67 unless ENVIRONMENTS.include?(env)
68 raise "environment must be one of #{ENVIRONMENTS.inspect}"
69 end
70 @environment = env
71 end
72
73 def self.environment
07f2d74c » danlucraft
2010-05-26 Raise an error if the environment is not set
74 raise "no environment set" unless @environment
3f454912 » danlucraft
2010-02-14 Fix storage spec and added Redcar.environment
75 @environment
76 end
77
97096458 » danlucraft
2010-03-01 Spawn a sub jruby process unless --no-sub-jruby is specified. This ma…
78 def self.spin_up
59b05f61 » mscharley
2010-07-26 Added a --fork commandline option. This can only be accessed via nati…
79 forking = ARGV.include?("--fork")
80 no_runner = ARGV.include?("--no-sub-jruby")
190d7486 » mscharley
2010-07-26 Fixed some minor logic errors in the way the --fork command works.
81 jruby = Config::CONFIG["RUBY_INSTALL_NAME"] == "jruby"
304ebe7d » mscharley
2010-08-27 Implemented the spoon gem into the --fork option.
82 osx = (not [:linux, :windows].include?(platform))
fecb54d4 » mscharley
2010-07-26 Syntax error fix. Oops, should try running before commiting...
83
91990f0a » mscharley
2010-08-13 Added a rescue clause around the fork code so that systems that don't…
84 begin
85 if forking and not jruby
86 # jRuby doesn't support fork() because of the runtime stuff...
87 forking = false
88 puts 'Forking failed, attempting to start anyway...' if (pid = fork) == -1
89 exit unless pid.nil? # kill the parent process
90
91 if pid.nil?
92 # reopen the standard pipes to nothingness
d491a209 » mscharley
2010-08-27 Added null device support for Windows.
93 STDIN.reopen Redcar.null_device
94 STDOUT.reopen Redcar.null_device, 'a'
91990f0a » mscharley
2010-08-13 Added a rescue clause around the fork code so that systems that don't…
95 STDERR.reopen STDOUT
96 end
304ebe7d » mscharley
2010-08-27 Implemented the spoon gem into the --fork option.
97 elsif forking and SPOON_AVAILABLE and ::Spoon.supported?
91990f0a » mscharley
2010-08-13 Added a rescue clause around the fork code so that systems that don't…
98 # so we need to try something different...
304ebe7d » mscharley
2010-08-27 Implemented the spoon gem into the --fork option.
99
100 forking = false
101 require 'redcar/runner'
102 runner = Redcar::Runner.new
103 runner.spin_up do |command|
e4f5d988 » mscharley
2010-08-27 Changed --forked to the much more descriptive --silent
104 command.push('--silent')
304ebe7d » mscharley
2010-08-27 Implemented the spoon gem into the --fork option.
105 ::Spoon.spawnp(*command)
106 end
107 exit 0
108 elsif forking
109 raise NotImplementedError, "Something weird has happened. Please contact us."
190d7486 » mscharley
2010-07-26 Fixed some minor logic errors in the way the --fork command works.
110 end
d7d7b3a1 » danlucraft
2010-08-15 Fix syntax error in lib/redcar.rb
111 rescue NotImplementedError
304ebe7d » mscharley
2010-08-27 Implemented the spoon gem into the --fork option.
112 puts $!.class.name + ": " + $!.message
91990f0a » mscharley
2010-08-13 Added a rescue clause around the fork code so that systems that don't…
113 puts "Forking isn't supported on this system. Sorry."
114 puts "Starting normally..."
59b05f61 » mscharley
2010-07-26 Added a --fork commandline option. This can only be accessed via nati…
115 end
116
117 return if no_runner
190d7486 » mscharley
2010-07-26 Fixed some minor logic errors in the way the --fork command works.
118 return if jruby and not osx
ec89d405 » danlucraft
2010-03-02 Don't spin up a child process if we are on linux/windows and already …
119
120 require 'redcar/runner'
121 runner = Redcar::Runner.new
304ebe7d » mscharley
2010-08-27 Implemented the spoon gem into the --fork option.
122 runner.spin_up do |command|
123 exec(*command)
124 end
926d3dd3 » danlucraft
2010-01-09 Changed the install process so it requires a 'sudo redcar install' st…
125 end
4bf5b18d » danlucraft
2010-01-25 Speculative jmv change
126
1fa016d2 » danlucraft
2010-01-23 Bumped version number to 0.3.3dev and merged boot.rb into redcar.rb
127 def self.root
128 File.expand_path(File.join(File.dirname(__FILE__), ".."))
129 end
4bf5b18d » danlucraft
2010-01-25 Speculative jmv change
130
1fa016d2 » danlucraft
2010-01-23 Bumped version number to 0.3.3dev and merged boot.rb into redcar.rb
131 def self.plugin_manager
132 @plugin_manager ||= begin
133 m = PluginManager.new
134 m.add_plugin_source(File.join(root, "plugins"))
135 m.add_plugin_source(File.join(user_dir, "plugins"))
136 m
137 end
138 end
4bf5b18d » danlucraft
2010-01-25 Speculative jmv change
139
64ea71b9 » danlucraft
2010-02-13 Writing documentation
140 # Tells the plugin manager to load plugins, and prints debug output.
1fa016d2 » danlucraft
2010-01-23 Bumped version number to 0.3.3dev and merged boot.rb into redcar.rb
141 def self.load
e5ab655d » danlucraft
2010-02-21 Load the openssl gem after we are sure we are not installing
142 $:.push File.expand_path(File.join(File.dirname(__FILE__), "plugin_manager", "lib"))
143 require 'plugin_manager'
144
547e8797 » danlucraft
2010-06-14 Add json submodule
145 $:.push File.expand_path(File.join(File.dirname(__FILE__), "json", "lib"))
146 require 'json'
147
af6e4daa » danlucraft
2010-09-04 Binary assets are loaded directly from ~/.redcar
148 $:.push File.expand_path(File.join(Redcar.asset_dir))
149
c5607c40 » danlucraft
2010-07-14 Move openssl require to lib/redcar.rb, as lots of stuff will need it
150 $:.push File.expand_path(File.join(File.dirname(__FILE__), "openssl", "lib"))
151 require 'openssl'
152
1fa016d2 » danlucraft
2010-01-23 Bumped version number to 0.3.3dev and merged boot.rb into redcar.rb
153 plugin_manager.load
154 if plugin_manager.unreadable_definitions.any?
155 puts "Couldn't read definition files: "
156 puts plugin_manager.unreadable_definitions.map {|d| " * " + d}
157 end
158 if plugin_manager.plugins_with_errors.any?
5b1be1a4 » rdp
2010-02-06 add some helper methods to window and document
159 puts "There was an error loading plugins: "
1fa016d2 » danlucraft
2010-01-23 Bumped version number to 0.3.3dev and merged boot.rb into redcar.rb
160 puts plugin_manager.plugins_with_errors.map {|d| " * " + d.name}
161 end
162 if ENV["PLUGIN_DEBUG"]
163 puts "Loaded plugins:"
164 puts plugin_manager.loaded_plugins.map {|d| " * " + d.name}
165 puts
166 puts "Unloaded plugins:"
167 puts plugin_manager.unloaded_plugins.map {|d| " * " + d.name}
168 end
169 end
170
64ea71b9 » danlucraft
2010-02-13 Writing documentation
171 # Starts the GUI.
4bf5b18d » danlucraft
2010-01-25 Speculative jmv change
172 def self.pump
1fa016d2 » danlucraft
2010-01-23 Bumped version number to 0.3.3dev and merged boot.rb into redcar.rb
173 Redcar.gui.start
174 end
4bf5b18d » danlucraft
2010-01-25 Speculative jmv change
175
1fa016d2 » danlucraft
2010-01-23 Bumped version number to 0.3.3dev and merged boot.rb into redcar.rb
176 # Platform specific ~/.redcar
177 #
178 # @return [String] expanded path
179 def self.user_dir
fbad936c » danlucraft
2010-04-19 Use a clean environment for features
180 dirname = {
181 :user => ".redcar",
182 :test => ".redcar_test",
183 :debug => ".redcar_debug"
184 }[Redcar.environment]
8a7e7b97 » danlucraft
2010-07-09 Add Redcar.home_dir method for getting the user's ~/
185 File.expand_path(File.join(home_dir, dirname))
186 end
187
fbeecd75 » danlucraft
2010-09-04 Clean up some stuff
188 # Platform specific ~/.redcar/assets
af6e4daa » danlucraft
2010-09-04 Binary assets are loaded directly from ~/.redcar
189 def self.asset_dir
fbeecd75 » danlucraft
2010-09-04 Clean up some stuff
190 File.join(user_dir, "assets")
191 end
192
8a7e7b97 » danlucraft
2010-07-09 Add Redcar.home_dir method for getting the user's ~/
193 # Platform specific ~/
194 #
195 # @return [String] expanded path
196 def self.home_dir
1fa016d2 » danlucraft
2010-01-23 Bumped version number to 0.3.3dev and merged boot.rb into redcar.rb
197 if platform == :windows
198 if ENV['USERPROFILE'].nil?
8a7e7b97 » danlucraft
2010-07-09 Add Redcar.home_dir method for getting the user's ~/
199 userdir = "C:/My Documents/"
1fa016d2 » danlucraft
2010-01-23 Bumped version number to 0.3.3dev and merged boot.rb into redcar.rb
200 else
8a7e7b97 » danlucraft
2010-07-09 Add Redcar.home_dir method for getting the user's ~/
201 userdir = ENV['USERPROFILE']
1fa016d2 » danlucraft
2010-01-23 Bumped version number to 0.3.3dev and merged boot.rb into redcar.rb
202 end
203 else
8a7e7b97 » danlucraft
2010-07-09 Add Redcar.home_dir method for getting the user's ~/
204 userdir = ENV['HOME'] unless ENV['HOME'].nil?
1fa016d2 » danlucraft
2010-01-23 Bumped version number to 0.3.3dev and merged boot.rb into redcar.rb
205 end
62aa218f » danlucraft
2010-01-09 Fix specs and features for new code loading
206 end
64ea71b9 » danlucraft
2010-02-13 Writing documentation
207
208 class << self
209 attr_accessor :app
210 attr_reader :gui
211 end
c8954198 » danlucraft
2010-06-05 Read input from STDIN and open in a tab
212
64ea71b9 » danlucraft
2010-02-13 Writing documentation
213 # Set the application GUI.
214 def self.gui=(gui)
215 raise "can't set gui twice" if @gui
216 @gui = gui
217 end
926d3dd3 » danlucraft
2010-01-09 Changed the install process so it requires a 'sudo redcar install' st…
218 end
219
58640fbc » danlucraft
2010-01-09 Move install command help into usage.rb
220 usage = Redcar::Usage.new
221 usage.version_string
222 usage.version_requested
223 usage.help_requested
Something went wrong with that request. Please try again.