rugui 1.2.1 → 1.2.2
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/Changelog +54 -0
- data/Rakefile +4 -42
- data/lib/rugui/tasks/release_framework.rake +39 -0
- data/lib/rugui/version.rb +1 -1
- data/rugui_generators/controller/USAGE +1 -0
- data/rugui_generators/controller/controller_generator.rb +35 -0
- data/rugui_generators/controller/templates/controller.erb +3 -0
- data/rugui_generators/generators_support.rb +75 -0
- data/rugui_generators/model/USAGE +1 -0
- data/rugui_generators/model/model_generator.rb +35 -0
- data/rugui_generators/model/templates/model.erb +3 -0
- data/rugui_generators/pack/USAGE +1 -0
- data/rugui_generators/pack/pack_generator.rb +40 -0
- data/rugui_generators/pack/templates/README +3 -0
- data/rugui_generators/rugui/USAGE +1 -0
- data/rugui_generators/rugui/rugui_generator.rb +163 -0
- data/rugui_generators/rugui/templates/GTK/application_controller.rb +4 -0
- data/rugui_generators/rugui/templates/GTK/application_view.rb +4 -0
- data/rugui_generators/rugui/templates/GTK/application_view_helper.rb +4 -0
- data/rugui_generators/rugui/templates/GTK/environment.rb +39 -0
- data/rugui_generators/rugui/templates/GTK/main.rc +23 -0
- data/rugui_generators/rugui/templates/GTK/main_controller.rb +17 -0
- data/rugui_generators/rugui/templates/GTK/main_view.glade +33 -0
- data/rugui_generators/rugui/templates/GTK/main_view.rb +10 -0
- data/rugui_generators/rugui/templates/GTK/main_view_helper.rb +3 -0
- data/rugui_generators/rugui/templates/Qt4/application_controller.rb +4 -0
- data/rugui_generators/rugui/templates/Qt4/application_view.rb +4 -0
- data/rugui_generators/rugui/templates/Qt4/application_view_helper.rb +4 -0
- data/rugui_generators/rugui/templates/Qt4/environment.rb +39 -0
- data/rugui_generators/rugui/templates/Qt4/main_controller.rb +13 -0
- data/rugui_generators/rugui/templates/Qt4/main_view.rb +10 -0
- data/rugui_generators/rugui/templates/Qt4/main_view.ui +37 -0
- data/rugui_generators/rugui/templates/Qt4/main_view_helper.rb +3 -0
- data/rugui_generators/rugui/templates/README +3 -0
- data/rugui_generators/rugui/templates/Rakefile +7 -0
- data/rugui_generators/rugui/templates/boot.rb +81 -0
- data/rugui_generators/rugui/templates/development.rb.sample +21 -0
- data/rugui_generators/rugui/templates/main.rb +11 -0
- data/rugui_generators/rugui/templates/main_executable.bat.erb +8 -0
- data/rugui_generators/rugui/templates/main_executable.erb +17 -0
- data/rugui_generators/rugui/templates/production.rb.sample +21 -0
- data/rugui_generators/rugui/templates/rcov.opts +1 -0
- data/rugui_generators/rugui/templates/spec.opts +4 -0
- data/rugui_generators/rugui/templates/spec_helper.rb +12 -0
- data/rugui_generators/rugui/templates/test.rb.sample +21 -0
- data/rugui_generators/rugui/templates/test_helper.rb +12 -0
- data/rugui_generators/view/USAGE +1 -0
- data/rugui_generators/view/templates/toplevels/about_dialog.glade +32 -0
- data/rugui_generators/view/templates/toplevels/assistant.glade +30 -0
- data/rugui_generators/view/templates/toplevels/color_selection_dialog.glade +60 -0
- data/rugui_generators/view/templates/toplevels/dialog_box.glade +35 -0
- data/rugui_generators/view/templates/toplevels/file_chooser_dialog.glade +35 -0
- data/rugui_generators/view/templates/toplevels/font_selection_dialog.glade +58 -0
- data/rugui_generators/view/templates/toplevels/input_dialog.glade +35 -0
- data/rugui_generators/view/templates/toplevels/message_dialog.glade +35 -0
- data/rugui_generators/view/templates/toplevels/recent_chooser_dialog.glade +33 -0
- data/rugui_generators/view/templates/toplevels/window.glade +11 -0
- data/rugui_generators/view/templates/view.erb +11 -0
- data/rugui_generators/view/templates/view.glade +4 -0
- data/rugui_generators/view/templates/view.ui +18 -0
- data/rugui_generators/view/templates/view_helper.erb +3 -0
- data/rugui_generators/view/view_generator.rb +36 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- metadata +67 -5
- data/VERSION.yml +0 -4
data/Changelog
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
1.2.0
|
2
|
+
- Added support for gems dependency mechanism
|
3
|
+
|
4
|
+
1.1.2
|
5
|
+
- Updated README docs
|
6
|
+
|
7
|
+
1.1.1
|
8
|
+
- Added support to prevent root widgets of views from being displayed by passing false to use_builder class method.
|
9
|
+
- Created a find_child in QT adapter since QT's one is not working.
|
10
|
+
- Fixing a error when creating views which doesn't use builder files.
|
11
|
+
- Removed unnecessary requires in framework files
|
12
|
+
|
13
|
+
1.1.0
|
14
|
+
- Added support to Qt4 as well as GTK as backend GUI frameworks.
|
15
|
+
- Added a DSL to connect signals to controllers and views.
|
16
|
+
|
17
|
+
1.0.0
|
18
|
+
- Created a RuGUI::BaseObject which implements the inspect method for RuGUI related objects.
|
19
|
+
- Added some generators (for models, controllers and views with its resources).
|
20
|
+
- Added support for before/after initialize hooks for Controller, View, ViewHelper and Model base classes.
|
21
|
+
- Using Pathname to wrap Configuration#root_path. Now you can use configuration.root_path.join('my_path'), instead of File.join(configuration.root_path, 'my_path')
|
22
|
+
|
23
|
+
0.6.0
|
24
|
+
- Added a method to quickly get the main controller from any BaseController.
|
25
|
+
- Now the application generator creates a /bin directory with a bash and bat scripts to run the application
|
26
|
+
- Fixing a small bug with update_observable_properties method
|
27
|
+
|
28
|
+
0.5.0
|
29
|
+
- Added a method to update observable properties values.
|
30
|
+
- Added support to set initial values of observable properties while instancing an object, using a map (property + value).
|
31
|
+
- Added a method to get all observable properties of an object with theirs values.
|
32
|
+
- Using class_inheritable_accessor instead of using class variables for observable properties options in ObservablePropertySupport
|
33
|
+
- Using class_inheritable_accessor instead of creating fake class attributes in BaseView
|
34
|
+
- Added method setup_view_helpers in BaseView, so that one can register more helpers if needed.
|
35
|
+
- Fixed a bug where named observable property change methods were not being called when an observable property was changed.
|
36
|
+
- Added :prevent_reset option to observable properties.
|
37
|
+
- Added :boolean options to observable properties, which automatically creates 'question' methods for the properties.
|
38
|
+
- Added a method to copy all observable properties from one observable to another.
|
39
|
+
- Fixed an issue which caused observable properties not to be copied when a hash with string keys was given when creating an observable or when updating its observable properties
|
40
|
+
- Boolean observable properties 'question' accessors now can be used directly in if's
|
41
|
+
|
42
|
+
0.4.0
|
43
|
+
- Added plugins support
|
44
|
+
|
45
|
+
0.3.0
|
46
|
+
- PropertyObserver was receiving notifications from named observables even when the name of the observer was the same as the class name.
|
47
|
+
- Migrated tests from TestUnit to RSpec.
|
48
|
+
- Added application generator.
|
49
|
+
|
50
|
+
0.2.1
|
51
|
+
- Adding support to execute RuGUI application in various environments
|
52
|
+
|
53
|
+
0.2.0
|
54
|
+
- Initial Release, forked from RubyGtkMvc code.
|
data/Rakefile
CHANGED
@@ -7,6 +7,8 @@ require 'rake'
|
|
7
7
|
require 'rake/testtask'
|
8
8
|
require 'rake/rdoctask'
|
9
9
|
require 'rubygems'
|
10
|
+
require 'lib/rugui/tasks/rugui_framework'
|
11
|
+
|
10
12
|
|
11
13
|
begin
|
12
14
|
require 'jeweler'
|
@@ -19,52 +21,12 @@ begin
|
|
19
21
|
gemspec.authors = ["Vicente Mundim", "Felipe Mesquita", "Claudio Escudero"]
|
20
22
|
gemspec.add_dependency(%q<activesupport>, [">= 2.1.1"])
|
21
23
|
gemspec.add_dependency(%q<rubigen>, [">= 1.5.1"])
|
22
|
-
gemspec.version = "1.2.
|
24
|
+
gemspec.version = "1.2.2"
|
23
25
|
gemspec.date = %q{2009-04-01}
|
24
26
|
gemspec.rubyforge_project = "rugui"
|
25
27
|
gemspec.executables = ['rugui']
|
28
|
+
gemspec.files = FileList["bin/*", "lib/**/*", "rugui_generators/**/*", "script/*", "spec/**/*", "Changelog", "LICENSE", "Rakefile", "README"].to_a
|
26
29
|
end
|
27
30
|
rescue LoadError
|
28
31
|
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
29
32
|
end
|
30
|
-
|
31
|
-
require 'rake/rdoctask'
|
32
|
-
Rake::RDocTask.new do |rdoc|
|
33
|
-
if File.exist?('VERSION.yml')
|
34
|
-
config = YAML.load(File.read('VERSION.yml'))
|
35
|
-
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
36
|
-
else
|
37
|
-
version = ""
|
38
|
-
end
|
39
|
-
|
40
|
-
rdoc.rdoc_dir = 'rdoc'
|
41
|
-
rdoc.title = "RuGUI #{version}"
|
42
|
-
rdoc.rdoc_files.include('README*')
|
43
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
44
|
-
end
|
45
|
-
|
46
|
-
begin
|
47
|
-
require 'rake/contrib/sshpublisher'
|
48
|
-
namespace :rubyforge do
|
49
|
-
|
50
|
-
desc "Release gem and RDoc documentation to RubyForge"
|
51
|
-
task :release => ["rubyforge:release:gem", "rubyforge:release:docs"]
|
52
|
-
|
53
|
-
namespace :release do
|
54
|
-
desc "Publish RDoc to RubyForge."
|
55
|
-
task :docs => [:rdoc] do
|
56
|
-
config = YAML.load(
|
57
|
-
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
58
|
-
)
|
59
|
-
|
60
|
-
host = "#{config['username']}@rubyforge.org"
|
61
|
-
remote_dir = "/var/www/gforge-projects/rugui"
|
62
|
-
local_dir = 'rdoc'
|
63
|
-
|
64
|
-
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
rescue LoadError
|
69
|
-
puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured."
|
70
|
-
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
Rake::RDocTask.new do |rdoc|
|
2
|
+
if File.exist?('VERSION.yml')
|
3
|
+
config = YAML.load(File.read('VERSION.yml'))
|
4
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
5
|
+
else
|
6
|
+
version = ""
|
7
|
+
end
|
8
|
+
|
9
|
+
rdoc.rdoc_dir = 'rdoc'
|
10
|
+
rdoc.title = "RuGUI #{version}"
|
11
|
+
rdoc.rdoc_files.include('README*')
|
12
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
13
|
+
end
|
14
|
+
|
15
|
+
begin
|
16
|
+
require 'rake/contrib/sshpublisher'
|
17
|
+
namespace :rubyforge do
|
18
|
+
|
19
|
+
desc "Release gem and RDoc documentation to RubyForge"
|
20
|
+
task :release => ["rubyforge:release:gem", "rubyforge:release:docs"]
|
21
|
+
|
22
|
+
namespace :release do
|
23
|
+
desc "Publish RDoc to RubyForge."
|
24
|
+
task :docs => [:rdoc] do
|
25
|
+
config = YAML.load(
|
26
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
27
|
+
)
|
28
|
+
|
29
|
+
host = "#{config['username']}@rubyforge.org"
|
30
|
+
remote_dir = "/var/www/gforge-projects/rugui"
|
31
|
+
local_dir = 'rdoc'
|
32
|
+
|
33
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
rescue LoadError
|
38
|
+
puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured."
|
39
|
+
end
|
data/lib/rugui/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "../generators_support")
|
2
|
+
|
3
|
+
class ControllerGenerator < RubiGen::Base
|
4
|
+
include GeneratorsSupport
|
5
|
+
|
6
|
+
default_options :author => nil
|
7
|
+
|
8
|
+
attr_reader :name
|
9
|
+
|
10
|
+
def initialize(runtime_args, runtime_options = {})
|
11
|
+
super
|
12
|
+
usage if args.empty?
|
13
|
+
@name = args.shift
|
14
|
+
extract_options
|
15
|
+
end
|
16
|
+
|
17
|
+
def manifest
|
18
|
+
record do |m|
|
19
|
+
build_controller_templates(m)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
protected
|
24
|
+
def banner
|
25
|
+
<<-EOS
|
26
|
+
Creates a RuGUI controller.
|
27
|
+
|
28
|
+
USAGE: script/generate controller YOUR_CONTROLLER_NAME
|
29
|
+
EOS
|
30
|
+
end
|
31
|
+
|
32
|
+
def add_options!(opts)
|
33
|
+
controller_add_options!(opts)
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
module GeneratorsSupport
|
2
|
+
protected
|
3
|
+
# Build controller templates.
|
4
|
+
def build_controller_templates(m)
|
5
|
+
m.template "../../controller/templates/controller.erb", "app/controllers/#{@name.underscore}_controller.rb", :assigns => { :controller_name => @name.camelize }
|
6
|
+
end
|
7
|
+
|
8
|
+
# Build view templates.
|
9
|
+
def build_view_templates(m)
|
10
|
+
# app/views
|
11
|
+
m.template "../../view/templates/view.erb", "app/views/#{@name.underscore}_view.rb", :assigns => { :view_name => @name.camelize, :uses_builder => uses_builder? }
|
12
|
+
# app/views/helpers
|
13
|
+
m.template "../../view/templates/view_helper.erb", "app/views/helpers/#{@name.underscore}_view_helper.rb", :assigns => { :view_name => @name.camelize }
|
14
|
+
if uses_builder?
|
15
|
+
if framework_based_on_directory_structure == 'GTK'
|
16
|
+
# app/resources/glade
|
17
|
+
m.file glade_template, "app/resources/glade/#{@name.underscore}_view.glade"
|
18
|
+
else
|
19
|
+
# app/resources/ui
|
20
|
+
m.file ui_template, "app/resources/ui/#{@name.underscore}_view.ui"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# Implements add_options!(opts) for views.
|
26
|
+
def view_add_options!(opts)
|
27
|
+
opts.separator ' '
|
28
|
+
opts.on("-x", "--without-builder", "Create the view without a glade.") { |o| @uses_builder = false }
|
29
|
+
opts.on("-e", "--default-builder", "Create the view with a default builder.") { |o| @toplevel = nil }
|
30
|
+
opts.on("-w", "--window", option_phrase_for('window')) { |o| @toplevel = "window" }
|
31
|
+
opts.on("-d", "--dialog-box", option_phrase_for('dialog box')) { |o| @toplevel = "dialog_box" }
|
32
|
+
opts.on("-a", "--about-dialog", option_phrase_for('about dialog')) { |o| @toplevel = "about_dialog" }
|
33
|
+
opts.on("-u", "--color-selection-dialog", option_phrase_for('color selection dialog')) { |o| @toplevel = "color_selection_dialog" }
|
34
|
+
opts.on("-j", "--file-chooser-dialog", option_phrase_for('file chooser dialog')) { |o| @toplevel = "file_chooser_dialog" }
|
35
|
+
opts.on("-n", "--font-selection-dialog", option_phrase_for('font selection dialog')) { |o| @toplevel = "font_selection_dialog" }
|
36
|
+
opts.on("-i", "--input-dialog", option_phrase_for('input dialog')) { |o| @toplevel = "input_dialog" }
|
37
|
+
opts.on("-m", "--message-dialog", option_phrase_for('message dialog')) { |o| @toplevel = "message_dialog" }
|
38
|
+
opts.on("-r", "--recent-chooser-dialog", option_phrase_for('recent chooser dialog')) { |o| @toplevel = "recent_chooser_dialog" }
|
39
|
+
end
|
40
|
+
|
41
|
+
# Implements add_options!(opts) for controllers.
|
42
|
+
def controller_add_options!(opts)
|
43
|
+
opts.separator ' '
|
44
|
+
end
|
45
|
+
|
46
|
+
def option_phrase_for(toplevel)
|
47
|
+
"Create the view with a glade file using #{toplevel} template as toplevel (GTK only)."
|
48
|
+
end
|
49
|
+
|
50
|
+
# Gets the correct glade template.
|
51
|
+
def glade_template
|
52
|
+
return "../../view/templates/view.glade" if @toplevel.nil?
|
53
|
+
return "../../view/templates/toplevels/#{@toplevel}.glade"
|
54
|
+
end
|
55
|
+
|
56
|
+
# Gets the correct glade template.
|
57
|
+
def ui_template
|
58
|
+
return "../../view/templates/view.ui"
|
59
|
+
end
|
60
|
+
|
61
|
+
def uses_builder?
|
62
|
+
!!@uses_builder
|
63
|
+
end
|
64
|
+
|
65
|
+
def extract_options
|
66
|
+
end
|
67
|
+
|
68
|
+
def framework_based_on_directory_structure
|
69
|
+
if File.exist?("app/resources/ui")
|
70
|
+
'Qt4'
|
71
|
+
else
|
72
|
+
'GTK'
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class ModelGenerator < RubiGen::Base
|
2
|
+
|
3
|
+
default_options :author => nil
|
4
|
+
|
5
|
+
attr_reader :name
|
6
|
+
|
7
|
+
def initialize(runtime_args, runtime_options = {})
|
8
|
+
super
|
9
|
+
usage if args.empty?
|
10
|
+
@name = args.shift
|
11
|
+
extract_options
|
12
|
+
end
|
13
|
+
|
14
|
+
def manifest
|
15
|
+
record do |m|
|
16
|
+
m.template "model.erb", "app/models/#{@name.underscore}.rb", :assigns => { :model_name => @name.camelize }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
protected
|
21
|
+
def banner
|
22
|
+
<<-EOS
|
23
|
+
Creates a RuGUI model.
|
24
|
+
|
25
|
+
USAGE: script/generate model YOUR_MODEL_NAME
|
26
|
+
EOS
|
27
|
+
end
|
28
|
+
|
29
|
+
def add_options!(opts)
|
30
|
+
opts.separator ' '
|
31
|
+
end
|
32
|
+
|
33
|
+
def extract_options
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "../generators_support")
|
2
|
+
|
3
|
+
class PackGenerator < RubiGen::Base
|
4
|
+
include GeneratorsSupport
|
5
|
+
|
6
|
+
default_options :author => nil
|
7
|
+
|
8
|
+
attr_reader :name
|
9
|
+
|
10
|
+
def initialize(runtime_args, runtime_options = {})
|
11
|
+
@uses_builder = true
|
12
|
+
super
|
13
|
+
usage if args.empty?
|
14
|
+
@name = args.shift
|
15
|
+
extract_options
|
16
|
+
end
|
17
|
+
|
18
|
+
def manifest
|
19
|
+
record do |m|
|
20
|
+
build_controller_templates(m)
|
21
|
+
build_view_templates(m)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
protected
|
26
|
+
def banner
|
27
|
+
<<-EOS
|
28
|
+
Creates a RuGUI controller and view with its resources.
|
29
|
+
|
30
|
+
USAGE: script/generate pack YOUR_CONTROLLER_AND_VIEW_NAME [options]
|
31
|
+
EOS
|
32
|
+
end
|
33
|
+
|
34
|
+
def add_options!(opts)
|
35
|
+
view_add_options!(opts)
|
36
|
+
end
|
37
|
+
|
38
|
+
def extract_options
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,163 @@
|
|
1
|
+
class RuguiGenerator < RubiGen::Base
|
2
|
+
|
3
|
+
DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
|
4
|
+
Config::CONFIG['ruby_install_name'])
|
5
|
+
|
6
|
+
|
7
|
+
attr_reader :name
|
8
|
+
|
9
|
+
def initialize(runtime_args, runtime_options = {})
|
10
|
+
set_initial_values
|
11
|
+
super
|
12
|
+
usage if args.empty?
|
13
|
+
@destination_root = File.expand_path(args.shift)
|
14
|
+
@name = base_name
|
15
|
+
extract_options
|
16
|
+
end
|
17
|
+
|
18
|
+
def manifest
|
19
|
+
record do |m|
|
20
|
+
# Ensure appropriate folder(s) exists
|
21
|
+
m.directory ''
|
22
|
+
BASEDIRS.each { |path| m.directory path }
|
23
|
+
FRAMEWORK_SPECIFIC_DIRS[@framework].each { |path| m.directory path }
|
24
|
+
|
25
|
+
# Root files
|
26
|
+
m.file_copy_each %w(README Rakefile)
|
27
|
+
# app/
|
28
|
+
m.file "main.rb", "app/main.rb"
|
29
|
+
# app/controllers
|
30
|
+
%w(main application).each do |file|
|
31
|
+
m.file "#{@framework}/#{file}_controller.rb", "app/controllers/#{file}_controller.rb"
|
32
|
+
end
|
33
|
+
# app/views
|
34
|
+
%w(main application).each do |file|
|
35
|
+
m.file "#{@framework}/#{file}_view.rb", "app/views/#{file}_view.rb"
|
36
|
+
end
|
37
|
+
# app/view/helpers
|
38
|
+
%w(main application).each do |file|
|
39
|
+
m.file "#{@framework}/#{file}_view_helper.rb", "app/views/helpers/#{file}_view_helper.rb"
|
40
|
+
end
|
41
|
+
|
42
|
+
case @framework
|
43
|
+
when 'GTK'
|
44
|
+
# app/resources/glade
|
45
|
+
m.file "#{@framework}/main_view.glade", "app/resources/glade/main_view.glade"
|
46
|
+
# app/resources/styles
|
47
|
+
m.file "#{@framework}/main.rc", "app/resources/styles/main.rc"
|
48
|
+
when 'Qt4'
|
49
|
+
# app/resources/ui
|
50
|
+
m.file "#{@framework}/main_view.ui", "app/resources/ui/main_view.ui"
|
51
|
+
end
|
52
|
+
|
53
|
+
# config/boot.rb
|
54
|
+
m.file "boot.rb", "config/boot.rb"
|
55
|
+
# config/environment.rb
|
56
|
+
m.file "#{@framework}/environment.rb", "config/environment.rb"
|
57
|
+
# config/environments
|
58
|
+
%w(development test production).each do |file|
|
59
|
+
m.file "#{file}.rb.sample", "config/environments/#{file}.rb.sample"
|
60
|
+
end
|
61
|
+
|
62
|
+
# bin/
|
63
|
+
m.template "main_executable.bat.erb", "bin/#{@name}.bat", :assigns => { :application_root => @name }
|
64
|
+
m.file "main_executable.erb", "bin/#{@name}"
|
65
|
+
|
66
|
+
# test/
|
67
|
+
if @test_suite.include?("unit")
|
68
|
+
TEST_DIRS.each { |path| m.directory path }
|
69
|
+
m.file "test_helper.rb", "test/test_helper.rb"
|
70
|
+
end
|
71
|
+
|
72
|
+
# spec/
|
73
|
+
if @test_suite.include?("rspec")
|
74
|
+
RSPEC_DIRS.each { |path| m.directory path }
|
75
|
+
%w(rcov.opts spec.opts spec_helper.rb).each { |file| m.file file, "spec/#{file}" }
|
76
|
+
end
|
77
|
+
|
78
|
+
# scripts/
|
79
|
+
m.dependency "install_rubigen_scripts", [destination_root, 'rugui'],
|
80
|
+
:shebang => options[:shebang], :collision => :force
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
protected
|
85
|
+
def banner
|
86
|
+
<<-EOS
|
87
|
+
Creates a RuGUI application.
|
88
|
+
|
89
|
+
USAGE: #{spec.name} YOUR_PROJECT_NAME
|
90
|
+
EOS
|
91
|
+
end
|
92
|
+
|
93
|
+
def add_options!(opts)
|
94
|
+
opts.separator ' '
|
95
|
+
opts.separator 'Options:'
|
96
|
+
opts.on("-r", "--rspec", "Add RSpec support to the project.") { |o| @test_suite << "rspec" }
|
97
|
+
opts.on("-o", "--only-rspec", "Use RSpec instead of Test::Unit::TestCase.") { |o| @test_suite = ["rspec"] }
|
98
|
+
opts.on("--qt4", "Use Qt4 templates for this application.") { |o| @framework = 'Qt4' }
|
99
|
+
opts.on("-v", "--version", "Show the RuGUI version number and quit.")
|
100
|
+
end
|
101
|
+
|
102
|
+
# Set initial values.
|
103
|
+
def set_initial_values
|
104
|
+
@test_suite = ["unit"]
|
105
|
+
@framework = "GTK"
|
106
|
+
end
|
107
|
+
|
108
|
+
def extract_options
|
109
|
+
end
|
110
|
+
|
111
|
+
BASEDIRS = [
|
112
|
+
# bin directory contains executables for the application.
|
113
|
+
'bin',
|
114
|
+
# app directory contains the controllers, models, resources, and views.
|
115
|
+
'app',
|
116
|
+
'app/controllers',
|
117
|
+
'app/models',
|
118
|
+
'app/resources',
|
119
|
+
'app/views',
|
120
|
+
'app/views/helpers',
|
121
|
+
# config directory contains environments configuration, boot file and
|
122
|
+
# other configuration stuff.
|
123
|
+
'config',
|
124
|
+
'config/environments',
|
125
|
+
# lib directory contains utility libraries which doesn't fit into a
|
126
|
+
# separate gem or plugin. Also it contains additional rake tasks which
|
127
|
+
# will be automatically added if present in lib/tasks.
|
128
|
+
'lib',
|
129
|
+
'lib/tasks',
|
130
|
+
# log directory contains default log files for the application.
|
131
|
+
'log',
|
132
|
+
# vendor directory contains third-party software.
|
133
|
+
'vendor'
|
134
|
+
]
|
135
|
+
|
136
|
+
TEST_DIRS = [
|
137
|
+
'test',
|
138
|
+
'test/controllers',
|
139
|
+
'test/models',
|
140
|
+
'test/views',
|
141
|
+
'test/views/helpers',
|
142
|
+
'test/lib'
|
143
|
+
]
|
144
|
+
|
145
|
+
RSPEC_DIRS = [
|
146
|
+
'spec',
|
147
|
+
'spec/controllers',
|
148
|
+
'spec/models',
|
149
|
+
'spec/views',
|
150
|
+
'spec/views/helpers',
|
151
|
+
'spec/lib'
|
152
|
+
]
|
153
|
+
|
154
|
+
FRAMEWORK_SPECIFIC_DIRS = {
|
155
|
+
'GTK' => [
|
156
|
+
'app/resources/glade',
|
157
|
+
'app/resources/styles',
|
158
|
+
],
|
159
|
+
'Qt4' => [
|
160
|
+
'app/resources/ui',
|
161
|
+
]
|
162
|
+
}
|
163
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Uncomment below to force the RuGUI application into production mode
|
2
|
+
# ENV['RUGUI_ENV'] ||= 'production'
|
3
|
+
|
4
|
+
# Bootstrap the RuGUI environment, and default configuration
|
5
|
+
require File.join(File.dirname(__FILE__), 'boot')
|
6
|
+
|
7
|
+
RuGUI::Initializer.run do |config|
|
8
|
+
# Settings in config/environments/* take precedence over those specified here.
|
9
|
+
# Application configuration should go into files in config/initializers
|
10
|
+
# -- all .rb files in that directory are automatically loaded.
|
11
|
+
# See RuGUI::Configuration for more options.
|
12
|
+
|
13
|
+
# Changes the framework adapter. Currently the only implemented framework
|
14
|
+
# adapters are GTK and Qt4. Defaults to GTK.
|
15
|
+
# config.framework_adapter = 'Qt4'
|
16
|
+
|
17
|
+
# Add additional load paths for your own custom dirs
|
18
|
+
# config.load_paths += %W( #{APPLICATION_ROOT}/extras )
|
19
|
+
|
20
|
+
# The log output, by default it is :stdout, but can be :stderr or any valid
|
21
|
+
# filename. Defaults to :stdout.
|
22
|
+
#config.logger[:output] = :stdout
|
23
|
+
|
24
|
+
# The level for logging. You can use :debug, :info, :warn, :error or :fatal
|
25
|
+
# That is the sequence of severity. Defaults to :info.
|
26
|
+
#config.logger[:level] = :info
|
27
|
+
|
28
|
+
# The format of timestamp. See the formatting for Time.strftime
|
29
|
+
#
|
30
|
+
# See with more details here:
|
31
|
+
# http://www.rubybrain.com/api/ruby-1.8.7/doc/index.html?a=M000253&name=strftime
|
32
|
+
#config.logger[:format] = "%Y-%m-%d %H:%M:%S"
|
33
|
+
|
34
|
+
# Specify gems that this application depends on.
|
35
|
+
# They can then be installed with "rake gems:install" on new installations.
|
36
|
+
# config.gem "bj"
|
37
|
+
# config.gem "hapricot", :version => '>0.8', :source => "http://code.whytheluckystiff.net"
|
38
|
+
# config.gem "aws-s3", :lib => "aws/s3"
|
39
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# This is a sample gtkrc file used to add application specific styles to the
|
2
|
+
# application. Styles defined here will override any theme style defined by the
|
3
|
+
# GTK theme machinery.
|
4
|
+
#
|
5
|
+
# The root path of the application can be obtained by using '{ROOT_PATH}'. So,
|
6
|
+
# to set the pixmap path, for example, one would write this in the head of this
|
7
|
+
# file:
|
8
|
+
#
|
9
|
+
# pixmap_path "{ROOT_PATH}/app/resources/styles/images"
|
10
|
+
#
|
11
|
+
|
12
|
+
# Just a sample style setting:
|
13
|
+
#
|
14
|
+
#style "message_label"
|
15
|
+
#{
|
16
|
+
# fg[NORMAL] = "#5a0000"
|
17
|
+
# fg[ACTIVE] = "#5a0000"
|
18
|
+
# fg[PRELIGHT] = "#5a0000"
|
19
|
+
# fg[SELECTED] = "#5a0000"
|
20
|
+
# fg[INSENSITIVE] = "#5a0000"
|
21
|
+
# font_name = "Arial Bold 18px"
|
22
|
+
#}
|
23
|
+
#widget "*message_label" style "message_label"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# The main controller for the application.
|
2
|
+
#
|
3
|
+
# NOTE: This controller doesn't inherit from ApplicationController, instead, it
|
4
|
+
# inherits from RuGUI::BaseMainController. Use it only as a starting point.
|
5
|
+
# Commonly it is used only to register global models and controllers, as well as
|
6
|
+
# the main view, but this is entirely up to you.
|
7
|
+
class MainController < RuGUI::BaseMainController
|
8
|
+
# Add your stuff here.
|
9
|
+
|
10
|
+
def setup_views
|
11
|
+
register_view :main_view
|
12
|
+
end
|
13
|
+
|
14
|
+
on :main_window, 'delete-event' do |widget, event|
|
15
|
+
quit
|
16
|
+
end
|
17
|
+
end
|