rugui 1.3.3 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. data/Changelog +9 -0
  2. data/bin/rugui +4 -6
  3. data/lib/packing/release.rb +6 -5
  4. data/lib/rugui.rb +1 -1
  5. data/lib/rugui/framework_adapters/GTK.rb +21 -19
  6. data/lib/rugui/generators.rb +1 -0
  7. data/lib/rugui/generators/rugui/rugui.rb +89 -0
  8. data/{rugui_generators → lib/rugui/generators}/rugui/templates/README +0 -0
  9. data/{rugui_generators → lib/rugui/generators}/rugui/templates/Rakefile +0 -0
  10. data/{rugui_generators/rugui/templates → lib/rugui/generators/rugui/templates/app}/main.rb +0 -0
  11. data/{rugui_generators/rugui/templates/main_executable.erb → lib/rugui/generators/rugui/templates/bin/main_executable} +0 -0
  12. data/{rugui_generators/rugui/templates/main_executable.bat.erb → lib/rugui/generators/rugui/templates/bin/main_executable.bat} +1 -1
  13. data/{rugui_generators/rugui/templates → lib/rugui/generators/rugui/templates/config}/boot.rb +0 -0
  14. data/{rugui_generators/rugui/templates → lib/rugui/generators/rugui/templates/config/environments}/development.rb.sample +0 -0
  15. data/{rugui_generators/rugui/templates → lib/rugui/generators/rugui/templates/config/environments}/production.rb.sample +0 -0
  16. data/{rugui_generators/rugui/templates → lib/rugui/generators/rugui/templates/config/environments}/test.rb.sample +0 -0
  17. data/{rugui_generators/rugui/templates/GTK → lib/rugui/generators/rugui/templates/framework_specific/gtk/app/controllers}/application_controller.rb +0 -0
  18. data/{rugui_generators/rugui/templates/GTK → lib/rugui/generators/rugui/templates/framework_specific/gtk/app/controllers}/main_controller.rb +0 -0
  19. data/{rugui_generators/rugui/templates/GTK → lib/rugui/generators/rugui/templates/framework_specific/gtk/app/resources/glade}/main_view.glade +0 -0
  20. data/{rugui_generators/rugui/templates/GTK → lib/rugui/generators/rugui/templates/framework_specific/gtk/app/resources/styles}/main.rc +0 -0
  21. data/{rugui_generators/rugui/templates/GTK → lib/rugui/generators/rugui/templates/framework_specific/gtk/app/views}/application_view.rb +0 -0
  22. data/{rugui_generators/rugui/templates/GTK → lib/rugui/generators/rugui/templates/framework_specific/gtk/app/views}/main_view.rb +0 -0
  23. data/{rugui_generators/rugui/templates/GTK → lib/rugui/generators/rugui/templates/framework_specific/gtk/app/views/view_helpers}/application_view_helper.rb +0 -0
  24. data/{rugui_generators/rugui/templates/GTK → lib/rugui/generators/rugui/templates/framework_specific/gtk/app/views/view_helpers}/main_view_helper.rb +0 -0
  25. data/{rugui_generators/rugui/templates/Qt4 → lib/rugui/generators/rugui/templates/framework_specific/qt/app/controllers}/application_controller.rb +0 -0
  26. data/{rugui_generators/rugui/templates/Qt4 → lib/rugui/generators/rugui/templates/framework_specific/qt/app/controllers}/main_controller.rb +0 -0
  27. data/{rugui_generators/rugui/templates/Qt4 → lib/rugui/generators/rugui/templates/framework_specific/qt/app/resources/ui}/main_view.ui +0 -0
  28. data/{rugui_generators/rugui/templates/Qt4 → lib/rugui/generators/rugui/templates/framework_specific/qt/app/views}/application_view.rb +0 -0
  29. data/{rugui_generators/rugui/templates/Qt4 → lib/rugui/generators/rugui/templates/framework_specific/qt/app/views}/main_view.rb +0 -0
  30. data/{rugui_generators/rugui/templates/Qt4 → lib/rugui/generators/rugui/templates/framework_specific/qt/app/views/view_helpers}/application_view_helper.rb +0 -0
  31. data/{rugui_generators/rugui/templates/Qt4 → lib/rugui/generators/rugui/templates/framework_specific/qt/app/views/view_helpers}/main_view_helper.rb +0 -0
  32. data/{rugui_generators/rugui/templates → lib/rugui/generators/rugui/templates/spec}/rcov.opts +0 -0
  33. data/{rugui_generators/rugui/templates → lib/rugui/generators/rugui/templates/spec}/spec.opts +0 -0
  34. data/{rugui_generators/rugui/templates → lib/rugui/generators/rugui/templates/spec}/spec_helper.rb +0 -0
  35. data/{rugui_generators/rugui/templates → lib/rugui/generators/rugui/templates/test}/test_helper.rb +0 -0
  36. data/lib/rugui/observable_property_support.rb +2 -10
  37. data/script/spec +10 -0
  38. metadata +39 -81
  39. data/rugui_generators/controller/USAGE +0 -1
  40. data/rugui_generators/controller/controller_generator.rb +0 -35
  41. data/rugui_generators/controller/templates/controller.erb +0 -3
  42. data/rugui_generators/generators_support.rb +0 -75
  43. data/rugui_generators/model/USAGE +0 -1
  44. data/rugui_generators/model/model_generator.rb +0 -35
  45. data/rugui_generators/model/templates/model.erb +0 -3
  46. data/rugui_generators/pack/USAGE +0 -1
  47. data/rugui_generators/pack/pack_generator.rb +0 -40
  48. data/rugui_generators/pack/templates/README +0 -3
  49. data/rugui_generators/rugui/USAGE +0 -1
  50. data/rugui_generators/rugui/rugui_generator.rb +0 -163
  51. data/rugui_generators/rugui/templates/GTK/environment.rb +0 -39
  52. data/rugui_generators/rugui/templates/Qt4/environment.rb +0 -39
  53. data/rugui_generators/view/USAGE +0 -1
  54. data/rugui_generators/view/templates/toplevels/about_dialog.glade +0 -32
  55. data/rugui_generators/view/templates/toplevels/assistant.glade +0 -30
  56. data/rugui_generators/view/templates/toplevels/color_selection_dialog.glade +0 -60
  57. data/rugui_generators/view/templates/toplevels/dialog_box.glade +0 -35
  58. data/rugui_generators/view/templates/toplevels/file_chooser_dialog.glade +0 -35
  59. data/rugui_generators/view/templates/toplevels/font_selection_dialog.glade +0 -58
  60. data/rugui_generators/view/templates/toplevels/input_dialog.glade +0 -35
  61. data/rugui_generators/view/templates/toplevels/message_dialog.glade +0 -35
  62. data/rugui_generators/view/templates/toplevels/recent_chooser_dialog.glade +0 -33
  63. data/rugui_generators/view/templates/toplevels/window.glade +0 -11
  64. data/rugui_generators/view/templates/view.erb +0 -11
  65. data/rugui_generators/view/templates/view.glade +0 -4
  66. data/rugui_generators/view/templates/view.ui +0 -18
  67. data/rugui_generators/view/templates/view_helper.erb +0 -3
  68. data/rugui_generators/view/view_generator.rb +0 -36
@@ -1,35 +0,0 @@
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
@@ -1,3 +0,0 @@
1
- class <%= controller_name %>Controller < ApplicationController
2
- # Add your stuff here.
3
- end
@@ -1,75 +0,0 @@
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
@@ -1 +0,0 @@
1
-
@@ -1,35 +0,0 @@
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
@@ -1,3 +0,0 @@
1
- class <%= model_name %> < RuGUI::BaseModel
2
- # Add your stuff here.
3
- end
@@ -1 +0,0 @@
1
-
@@ -1,40 +0,0 @@
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
@@ -1,3 +0,0 @@
1
- Take a look at:
2
- ../../controller/templates/*
3
- ../../view/templates/*
@@ -1 +0,0 @@
1
-
@@ -1,163 +0,0 @@
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
@@ -1,39 +0,0 @@
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
@@ -1,39 +0,0 @@
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