Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

try to fix #60

  • Loading branch information...
commit 308ff1e3259be7f56b014b9ca9ecb8fd112bf087 1 parent e2b5824
@tka tka authored
View
1  .gitignore
@@ -7,6 +7,5 @@ update_url
src/compile_version.rb
.rvmrc
.rbenv-version
-src/compile_version.rb
.bundle
tmp
View
4 src/app.rb
@@ -17,14 +17,14 @@ def compile_version
end
- CONFIG_DIR = File.join( java.lang.System.getProperty("user.home") , '.fire-app' )
- AUTOCOMPLTETE_CACHE_DIR = File.join( java.lang.System.getProperty("user.home") , '.fire-app', 'autocomplete_cache' )
+ AUTOCOMPLTETE_CACHE_DIR = File.join( CONFIG_DIR , 'autocomplete_cache' )
Dir.mkdir( CONFIG_DIR ) unless File.exists?( CONFIG_DIR )
Dir.mkdir( AUTOCOMPLTETE_CACHE_DIR ) unless File.exists?( AUTOCOMPLTETE_CACHE_DIR )
HISTORY_FILE = File.join( CONFIG_DIR, 'history')
CONFIG_FILE = File.join( CONFIG_DIR, 'config')
+
@notifications = []
def notifications
@notifications
View
4 src/compile_version.rb
@@ -1,5 +1,5 @@
module CompileVersion
- REVISION = 'd9cb4f4ea0'
- COMPILE_TIME = '201208251257'
+ REVISION = 'e2b58245ea'
+ COMPILE_TIME = '201210020822'
UPDATE_URL = ''
end
View
28 src/main.rb
@@ -23,10 +23,34 @@
require "ui/#{f}"
end
-require "app.rb"
+require 'optparse'
+options = {}
+OptionParser.new do |opts|
+ opts.banner = "Usage: example.rb [options]"
+
+ options[:config_dir] = File.join( java.lang.System.getProperty("user.home") , '.fire-app' )
+ opts.on("-c PATH", "--config-dir PATH", "config dir path") do |v|
+ options[:config_dir] = v
+ end
+
+ options[:watch] = nil
+ opts.on("-w PATH", "--watch-dir PATH", "default watch path") do |v|
+ options[:watch_dir] = v
+ end
+end.parse!
+puts options.inspect
begin
+ # TODO: dirty, need refactor
+ if File.directory?(File.dirname(options[:config_dir])) && File.writable?(File.dirname(options[:config_dir]))
+ CONFIG_DIR = options[:config_dir]
+ else
+ CONFIG_DIR = File.join(Dir.pwd, 'config')
+ Alert.new("Can't Create #{options[:config_dir]}, just put config folder to #{CONFIG_DIR}")
+ end
+
+ require "app.rb"
App.require_compass
begin
@@ -58,7 +82,7 @@
App.clear_autocomplete_cache
- Tray.instance.run(:watch => ARGV[0])
+ Tray.instance.run(:watch => options[:watch_dir])
rescue Exception => e
puts e.message
View
71 src/ui/alert.rb
@@ -2,47 +2,48 @@ class Alert
def initialize(msg, target_display = nil, &block)
target_display = Swt::Widgets::Display.get_current unless target_display
- @shell = Swt::Widgets::Shell.new(target_display, Swt::SWT::DIALOG_TRIM)
- @shell.setText("Fire.app")
- @shell.setBackgroundMode(Swt::SWT::INHERIT_DEFAULT)
- @shell.setSize(800,480)
- layout = Swt::Layout::GridLayout.new
- layout.numColumns = 2;
- @shell.layout = layout
+ @shell = Swt::Widgets::Shell.new(target_display, Swt::SWT::DIALOG_TRIM)
+ @shell.setText("Fire.app")
+ @shell.setBackgroundMode(Swt::SWT::INHERIT_DEFAULT)
+ @shell.setSize(800,480)
+ layout = Swt::Layout::GridLayout.new
+ layout.numColumns = 2;
+ @shell.layout = layout
- gridData = Swt::Layout::GridData.new
- gridData.horizontalAlignment = Swt::SWT::LEFT;
- gridData.verticalAlignment = Swt::SWT::TOP;
- gridData.verticalSpan=1
+ gridData = Swt::Layout::GridData.new
+ gridData.horizontalAlignment = Swt::SWT::LEFT;
+ gridData.verticalAlignment = Swt::SWT::TOP;
+ gridData.verticalSpan=1
+ if defined? App
@label = Swt::Widgets::Label.new(@shell, Swt::SWT::LEFT)
@label.setImage( App.create_image('icon/32.png') )
@label.setLayoutData(gridData)
-
- gridData = Swt::Layout::GridData.new
- @label = Swt::Widgets::Label.new(@shell, Swt::SWT::LEFT)
- @label.setText(msg)
- @label.setLayoutData(gridData)
+ end
+ gridData = Swt::Layout::GridData.new
+ @label = Swt::Widgets::Label.new(@shell, Swt::SWT::LEFT)
+ @label.setText(msg)
+ @label.setLayoutData(gridData)
- gridData = Swt::Layout::GridData.new
- gridData.horizontalAlignment = Swt::SWT::RIGHT;
- gridData.verticalAlignment = Swt::SWT::BOTTOM;
- gridData.grabExcessHorizontalSpace = false;
- gridData.grabExcessVerticalSpace = false;
- gridData.horizontalSpan=2
- btn = Swt::Widgets::Button.new(@shell, Swt::SWT::PUSH | Swt::SWT::CENTER)
- btn.setText('OK')
- btn.setLayoutData(gridData)
- btn.addListener(Swt::SWT::Selection,Swt::Widgets::Listener.impl do |method, evt|
- block.call if block_given?
- evt.widget.shell.dispose();
- end)
- @shell.pack
- @monior=target_display.getPrimaryMonitor().getBounds();
- rect = @shell.getClientArea();
- @shell.setLocation((@monior.width-rect.width) /2, (@monior.height-rect.height) /2)
- @shell.open
- @shell.forceActive
+ gridData = Swt::Layout::GridData.new
+ gridData.horizontalAlignment = Swt::SWT::RIGHT;
+ gridData.verticalAlignment = Swt::SWT::BOTTOM;
+ gridData.grabExcessHorizontalSpace = false;
+ gridData.grabExcessVerticalSpace = false;
+ gridData.horizontalSpan=2
+ btn = Swt::Widgets::Button.new(@shell, Swt::SWT::PUSH | Swt::SWT::CENTER)
+ btn.setText('OK')
+ btn.setLayoutData(gridData)
+ btn.addListener(Swt::SWT::Selection,Swt::Widgets::Listener.impl do |method, evt|
+ block.call if block_given?
+ evt.widget.shell.dispose();
+ end)
+ @shell.pack
+ @monior=target_display.getPrimaryMonitor().getBounds();
+ rect = @shell.getClientArea();
+ @shell.setLocation((@monior.width-rect.width) /2, (@monior.height-rect.height) /2)
+ @shell.open
+ @shell.forceActive
end
def replace(msg)

1 comment on commit 308ff1e

@hlb
Owner

It fixes #57, not #60

Please sign in to comment.
Something went wrong with that request. Please try again.