rsence-pre 2.3.0.11 → 2.3.0.12

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.0.11.pre
1
+ 2.3.0.12.pre
@@ -85,9 +85,18 @@ HClass.prototype = {
85
85
  var _previous = this.base;
86
86
  // copies previous this.base from the direction from HClass
87
87
  this.base = _ancestor;
88
- // current class's method is called
89
- // now inside the function when called this.base points to parent method
90
- _returnValue = _method.apply(this, arguments);
88
+
89
+ // The current class's method is called with an exception handler to
90
+ // ignore the common mistake of calling super, while being in the class
91
+ // declaring the method; has no super.
92
+ try{
93
+ // now inside the function when called this.base points to parent method
94
+ _returnValue = _method.apply(this, arguments);
95
+ }
96
+ catch(e){
97
+ !this.isProduction && console.warn("An exception occurred while calling base: ",e);
98
+ _returnValue = null;
99
+ }
91
100
  // then because event this function can be called from child method
92
101
  // resets the base to as is was before calling this function
93
102
  this.base = _previous;
@@ -102,7 +111,8 @@ HClass.prototype = {
102
111
  }
103
112
  return this[_source] = _value;
104
113
  // this is called when called by HClass.extend
105
- } else if (_source) {
114
+ }
115
+ else if (_source) {
106
116
  _prototype = {toSource: null};
107
117
  _protected = ["toString", "valueOf"];
108
118
  // we want default constructor function
@@ -738,7 +738,16 @@ HView = HClass.extend({
738
738
  if(this.options.html){
739
739
  this.setHTML(this.options.html);
740
740
  }
741
- this.drawSubviews();
741
+ // Extended draw for components to define/extend.
742
+ // This is preferred over drawSubviews, when defining
743
+ // parts of a complex component.
744
+ if(typeof this.extDraw === 'function'){
745
+ this.extDraw();
746
+ }
747
+ // Extended draw for the purpose of drawing subviews.
748
+ if(typeof this.drawSubviews === 'function'){
749
+ this.drawSubviews();
750
+ }
742
751
  // if options contain a subviews function, call it with the namespace of self
743
752
  if(this.options.subviews && typeof this.options.subviews == 'function'){
744
753
  this.options.subviews.call( this );
@@ -159,7 +159,7 @@ module ArgvUtil
159
159
  config[:http_server][:port] = ask(str_http_port) do |q|
160
160
  q.default = config[:http_server][:port].to_s
161
161
  end
162
-
162
+
163
163
  say @strs[:initenv][:enter_tcp_ip]
164
164
  str_tcp_ip = @strs[:initenv][:tcp_ip]
165
165
  config[:http_server][:bind_address] = ask(str_tcp_ip) do |q|
@@ -171,6 +171,13 @@ module ArgvUtil
171
171
  config[:base_url] = ask(str_root_dir) do |q|
172
172
  q.default = config[:base_url]
173
173
  end
174
+
175
+ # possible workaround for highline on some systems:
176
+ config[:index_html][:title] = config[:index_html][:title].to_s
177
+ config[:database][:ses_db] = config[:database][:ses_db].to_s
178
+ config[:http_server][:port] = config[:http_server][:port].to_s.to_i
179
+ config[:http_server][:bind_address] = config[:http_server][:bind_address].to_s
180
+ config[:base_url] = config[:base_url].to_s
174
181
 
175
182
  test_url = "http://#{config[:http_server][:bind_address]}:#{config[:http_server][:port]}#{config[:base_url]}"
176
183
  say ERB.new( @strs[:initenv][:config_summary] ).result( binding )
@@ -210,7 +217,11 @@ module ArgvUtil
210
217
  readme_file = File.join( env_dir, 'README' )
211
218
  File.open( readme_file, 'w' ) {|f| f.write( ERB.new( @strs[:initenv][:readme] ).result( binding ) ) }
212
219
  version_file = File.join( env_dir, 'VERSION' )
213
- File.open( version_file, 'w' ) {|f| f.write( "RSence Environment Version #{version.to_f}" ) }
220
+ File.open( version_file, 'w' ) {|f| f.write( "RSence Environment Version #{version.to_f}\n" ) }
221
+ [ db_dir, log_dir, run_dir ].each do |ign_prefix|
222
+ gitignore_file = File.join( ign_prefix, '.gitignore' )
223
+ File.open( gitignore_file, 'w' ) {|f| f.write("*\n") }
224
+ end
214
225
  puts ERB.new( @strs[:initenv][:congratulations] ).result( binding )
215
226
  exit
216
227
  end
@@ -85,21 +85,106 @@ module RSence
85
85
  warn "install_client_pkgs: called with @client_pkgs defined (#{@client_pkgs.inspect}); returning" if RSence.args[:debug]
86
86
  return
87
87
  end
88
- @client_pkgs = yaml_read( 'client_pkgs.yaml' )
89
- if @client_pkgs
90
- if @client_pkgs.has_key?(:src_dirs)
91
- @client_pkgs[:src_dirs].each do |src_dir|
92
- src_dir = bundle_path( src_dir[2..-1] ) if src_dir.start_with?('./')
88
+ client_pkgs = yaml_read( 'client_pkgs.yaml' )
89
+ if client_pkgs
90
+
91
+ sleep 0.1 until client_pkg.ready?
92
+
93
+ if client_pkgs.has_key?('src_dir')
94
+ src_dirs = [ client_pkgs['src_dir'] ]
95
+ elsif client_pkgs.has_key?('src_dirs')
96
+ src_dirs = client_pkgs['src_dirs']
97
+ elsif client_pkgs.has_key?(:src_dirs)
98
+ src_dirs = client_pkgs[:src_dirs]
99
+ else
100
+ src_dirs = false
101
+ end
102
+
103
+ @client_pkgs = {}
104
+ if src_dirs
105
+ src_dirs.each do |src_dir|
106
+ if src_dir.start_with?('./')
107
+ src_dir = bundle_path( src_dir[2..-1] )
108
+ end
93
109
  client_pkg.add_src_dir( src_dir )
94
110
  end
111
+ @client_pkgs[:src_dirs] = src_dirs
95
112
  end
96
- sleep 0.1 until client_pkg.ready?
97
- client_pkg.add_packages( @client_pkgs[:packages ] ) if @client_pkgs.has_key?(:packages )
98
- client_pkg.add_compounds( @client_pkgs[:compound_packages] ) if @client_pkgs.has_key?(:compound_packages)
99
- client_pkg.add_themes( @client_pkgs[:theme_names ] ) if @client_pkgs.has_key?(:theme_names )
100
- client_pkg.add_gfx_formats( @client_pkgs[:gfx_formats ] ) if @client_pkgs.has_key?(:gfx_formats )
101
- client_pkg.add_reserved_names( @client_pkgs[:reserved_names] ) if @client_pkgs.has_key?(:reserved_names)
113
+
114
+ if client_pkgs.has_key?('packages')
115
+ packages = client_pkgs['packages']
116
+ elsif client_pkgs.has_key?(:packages)
117
+ packages = client_pkgs[:packages]
118
+ else
119
+ packages = false
120
+ end
121
+
122
+ if packages
123
+ client_pkg.add_packages( packages )
124
+ @client_pkgs[:packages] = packages
125
+ end
126
+
127
+
128
+ if client_pkgs.has_key?('compounds')
129
+ compounds = client_pkgs['compounds']
130
+ elsif client_pkgs.has_key?('compound_packages')
131
+ compounds = client_pkgs['compound_packages']
132
+ elsif client_pkgs.has_key?(:compound_packages)
133
+ compounds = client_pkgs[:compound_packages]
134
+ else
135
+ compounds = false
136
+ end
137
+
138
+ if compounds
139
+ client_pkg.add_compounds( compounds )
140
+ @client_pkgs[:compound_packages] = compounds
141
+ end
142
+
143
+
144
+ if client_pkgs.has_key?('themes')
145
+ theme_names = client_pkgs['themes']
146
+ elsif client_pkgs.has_key?('theme_names')
147
+ theme_names = client_pkgs['theme_names']
148
+ elsif client_pkgs.has_key?(:theme_names)
149
+ theme_names = client_pkgs[:theme_names]
150
+ else
151
+ theme_names = false
152
+ end
153
+
154
+ if theme_names
155
+ client_pkg.add_themes( theme_names )
156
+ @client_pkgs[:theme_names] = theme_names
157
+ end
158
+
159
+
160
+ if client_pkgs.has_key?('gfx_formats')
161
+ gfx_formats = client_pkgs['gfx_formats']
162
+ elsif client_pkgs.has_key?(:gfx_formats)
163
+ gfx_formats = client_pkgs[:gfx_formats]
164
+ else
165
+ gfx_formats = false
166
+ end
167
+
168
+ if gfx_formats
169
+ client_pkg.add_gfx_formats( gfx_formats )
170
+ @client_pkgs[:gfx_formats] = gfx_formats
171
+ end
172
+
173
+ if client_pkgs.has_key?('reserved_names')
174
+ reserved_names = client_pkgs['reserved_names']
175
+ elsif client_pkgs.has_key?(:reserved_names)
176
+ reserved_names = client_pkgs[:reserved_names]
177
+ else
178
+ reserved_names = false
179
+ end
180
+
181
+ if reserved_names
182
+ client_pkg.add_reserved_names( reserved_names )
183
+ @client_pkgs[:reserved_names] = reserved_names
184
+ end
185
+
102
186
  client_pkg.rebuild_client
187
+
103
188
  end
104
189
  end
105
190
 
@@ -241,7 +241,7 @@ class ClientPkgBuild
241
241
  @src_cache[:orig_size][src_path] = js_size
242
242
  end
243
243
  else
244
- js_data = %{console.log( "ERROR: CoffeeScript not suuported and no JS source available for #{bundle_path}" );}
244
+ js_data = %{console.log( "ERROR: CoffeeScript not supported and no JS source available for #{bundle_path}" );}
245
245
  js_size = js_data.bytesize
246
246
  min_size = js_size
247
247
  src_timestamp = 0
@@ -0,0 +1,19 @@
1
+
2
+ ### This file defines how to build custom client-side code.
3
+
4
+ # The source directory './' is a special prefix meaning the path of this plugin.
5
+ src_dir: ./js
6
+ # If you have several source directories, you can specify them in plural, like this:
7
+ # src_dirs:
8
+ # - ./js
9
+ # - /opt/src/examples/coffeescript
10
+ # - ~/proj/demo
11
+
12
+ # The packages of found bundles in the source directory are
13
+ # combined into packages.
14
+ packages:
15
+ # The following is the name of the package:
16
+ welcome_pkg:
17
+ # These are the bundles to include in the package:
18
+ - welcome_scrollcontainer
19
+ - welcome_view
@@ -0,0 +1,53 @@
1
+ ---
2
+
3
+ # RSence user interfaces can be defined as YAML files.
4
+ # The structure is converted to JSON for the client and "special"
5
+ # variables are processed by the server.
6
+ # The server tries to find a match in its gui_params for all values
7
+ # that begin with a colon (they are parsed as symbols on ruby).
8
+
9
+ # Read more about YAML on http://yaml.org/
10
+
11
+
12
+ # GUITree is used as the type identifier for
13
+ # user interface definition structures.
14
+ type: GUITree
15
+
16
+ # The version defines what version of the structure is used.
17
+ version: 1.0
18
+
19
+ # List of javascript packages the user interface needs.
20
+ # These are automatically loaded once per session.
21
+ dependencies:
22
+ - welcome_pkg # See client_pkgs.yaml
23
+
24
+ # The root level class for user interfaces must be an instance of
25
+ # HApplication (RSence.GUIApp is extended from the HApplication class).
26
+ class: RSence.GUIApp
27
+
28
+ # Each class takes a number of options for its constructor.
29
+ options:
30
+ label: Welcome App
31
+
32
+ # The subviews use the class defined above as their parent component.
33
+ subviews:
34
+
35
+ # The sheet is used as the main visual container for the gui in this app.
36
+ # HSheet is an component that dims the background and shows a dialog sheet
37
+ # while its value is 0.
38
+ - WelcomeView:
39
+
40
+ # For this rect, the rect defines the inner dialog
41
+ # size and position relave to the center position.
42
+ rect: [ 0, 0, 600, 500 ]
43
+
44
+ # Values are bound to their component responders using the bind -option.
45
+ bind: :values.close
46
+
47
+ options:
48
+ # Passes on the rest of the value id's as a reference to be used
49
+ # in the code. See js/welcome_view for details.
50
+ values: :values
51
+
52
+ # See the js/welcome_scrollcontainer for client-side usage of this:
53
+ welcomeText: :text.welcome
@@ -3,7 +3,7 @@
3
3
  title: Welcome message
4
4
 
5
5
  # The human-readable version of the package
6
- version: 1.0.2
6
+ version: 1.1
7
7
 
8
8
  # A brief description of the package (rdoc formatting supported)
9
9
  description: |
@@ -0,0 +1,37 @@
1
+ ###
2
+ This custom HScrollView contains a number of subviews that are inside
3
+ its scrollbars (if the inner content area is bigger than the outer
4
+ dimensions of HScrollView itself). ###
5
+ WelcomeScrollContainer = HScrollView.extend
6
+
7
+ ###
8
+ Subviews of the HScrollView; items inside are displayed
9
+ inside the scrollbars. ###
10
+ drawSubviews: ->
11
+ @base()
12
+ ###
13
+ The HInlineView is a simple HTML container, designed
14
+ to contain "flowing layout" html. ###
15
+ HInlineView.new( [ 0, 0, null, null, 0, 0 ], @,
16
+ ###
17
+ See the gui_params method of welcome.rb to understand how the
18
+ contents of the text/welcome.html files is linked like this. ###
19
+ html: @parent.options.welcomeText
20
+ style:
21
+ fontFamily: 'Helvetica, Arial, sans-serif'
22
+ fontSize: '16px'
23
+ lineHeight: '20px'
24
+ )
25
+
26
+ # The RSence logo image:
27
+ HImageView.extend(
28
+ click: ->
29
+ console.log 'clicked'
30
+ location.href="http://rsence.org/"
31
+ ).new( [ 20, 10, 559, 110 ], @,
32
+ # Images use the value as the URL of the image.
33
+ value: 'http://rsence.org/rsence_org_logo.gif'
34
+ scaleToFit: false
35
+ events:
36
+ click: true
37
+ )
@@ -0,0 +1,55 @@
1
+ ###
2
+ The sheet is used as the main visual container for the gui in this app.
3
+ HSheet is an component that dims the background and shows a dialog sheet
4
+ while its value is 0. ###
5
+ WelcomeView = HSheet.extend
6
+
7
+ ###
8
+ The extended refreshValue method that terminates its application,
9
+ including all the subviews. It's triggered when the value becomes 1,
10
+ as a result of the "Close" -button being clicked. ###
11
+ refreshValue: ->
12
+ @base()
13
+ @app.die() if @value == 1
14
+
15
+ ###
16
+ The drawSubviews is a method to extend, if you want to draw items,
17
+ when construction is completed. ###
18
+ drawSubviews: ->
19
+ @base()
20
+ ###
21
+ The values hash is set in the gui.yaml file for value id references
22
+ of the session-specific plugin values. ###
23
+ _values = @options.values
24
+
25
+ ###
26
+ A button in the lower right corner of the HSheet that triggers
27
+ destruction of this application (see WelcomeView#refreshValue) ###
28
+ HClickButton.new( [ null, null, 60, 24, 8, 8 ], @,
29
+ bind: _values.close
30
+ label: 'Close'
31
+ )
32
+
33
+ ###
34
+ A Check Box in the lower right corner of the HSheet that triggers
35
+ an server action to disable the whole plugin when combined with
36
+ the close button's value. ###
37
+ HCheckbox.new( [ null, null, 130, 24, 74, 8 ], @,
38
+ bind: _values.dont_show_again
39
+ label: "Don't show again"
40
+ )
41
+
42
+ ###
43
+ See welcome_scrollcontainer.coffee for details of this one.
44
+ The rectangle stretches the component to contain all of the parent's
45
+ space except the bottom-most 42 pixels and the minimum size
46
+ of 550 by 300 pixels. ###
47
+ WelcomeScrollContainer.new( [ 0, 0, 550, 300, 0, 42 ], @,
48
+ scrollX: false # Disables horizontal scroll bars.
49
+ scrollY: 'auto' # Makes vertical scroll bars appear
50
+ # automatically, when needed.
51
+ # Custom additional styling using style properties:
52
+ style:
53
+ backgroundColor: 'white'
54
+ borderBottom: '1px solid black'
55
+ )
@@ -2,7 +2,6 @@
2
2
  <div style="margin-left:40px;margin-top:140px;margin-right:20px">
3
3
  <h1>Congratulations!</h1>
4
4
  <p>This message is served to you by RSence running in your new environment.</p>
5
- <p>The next time you create an RSence environment, use the <code>--blank</code> option of the <code>rsence&nbsp;init</code> command to avoid this message.</p>
6
5
  <p>Use the <code>rsence help</code> command to learn more about the <code>rsence</code> command-line tool and its various commands and options.</p>
7
6
  <p>You may want to install or write some software to run in your new RSence environment next.</p>
8
7
  <p>Go to <a href="http://rsence.org/">rsence.org</a> to learn more about RSence.</p>
@@ -1,9 +1,9 @@
1
1
  # Value for the checkbox. When true combined with 1 of the close value, disables the plugin. See welcome.rb
2
- :dont_show_again:
3
- :value: false
2
+ dont_show_again:
3
+ data: false
4
4
 
5
5
  # Value for the close button.
6
- :close:
7
- :value: 0
8
- :responders: # See the 'close_button' method of welcome.rb to see what a responder is.
9
- - :method: close_button
6
+ close:
7
+ value: 0
8
+ # See the 'close_button' method of welcome.rb to see what a responder is.
9
+ responder: close_button
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsence-pre
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0.11
4
+ version: 2.3.0.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-11-16 00:00:00.000000000 Z
13
+ date: 2012-11-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rsence-deps
@@ -112,8 +112,11 @@ files:
112
112
  - lib/rsence/value.rb
113
113
  - lib/rsence/valuemanager.rb
114
114
  - lib/rsence.rb
115
- - setup/welcome/gui/welcome.yaml
115
+ - setup/welcome/client_pkgs.yaml
116
+ - setup/welcome/gui.yaml
116
117
  - setup/welcome/info.yaml
118
+ - setup/welcome/js/welcome_scrollcontainer/welcome_scrollcontainer.coffee
119
+ - setup/welcome/js/welcome_view/welcome_view.coffee
117
120
  - setup/welcome/text/welcome.html
118
121
  - setup/welcome/values.yaml
119
122
  - setup/welcome/welcome.rb
@@ -1,92 +0,0 @@
1
- # RSence user interfaces can be defined as YAML files.
2
- # The structure is converted to JSON for the client and "special" variables are processed by the server.
3
- # The server tries to find a match in its gui_params for all values that begin with a colon (they are parsed as symbols on ruby).
4
-
5
- # Read more about YAML on http://yaml.org/
6
-
7
- # GUITree is used as the type identifier for user interface definition structures.
8
- type: GUITree
9
- # The version defines what version of the structure is used. New features are added constantly, each incrementing the version by 0.1
10
- version: 0.6
11
-
12
- # List of javascript packages the user interface needs. These are automatically loaded once per session.
13
- dependencies:
14
- - default_theme # The default_theme package contains all the theme resources needed when using the default theme.
15
- - controls # The controls package contains the basic set of widget components.
16
-
17
- # The root level class for user interfaces must be an instance of HApplication (RSence.GUIApp is extended from the HApplication class).
18
- class: RSence.GUIApp
19
- # Each class takes a number of options for its constructor.
20
- options:
21
- label: Welcome App
22
- # The subviews use the class defined above as their parent component.
23
- subviews:
24
- # The sheet is used as the main visual container for the gui in this app.
25
- # HSheet is an component that dims the background and shows a dialog sheet while its value is 0.
26
- - class: HSheet
27
- rect: [ 0, 0, 600, 500 ] # For HSheet, the rect defines the inner dialog size (it's always centered).
28
- bind: :values.close # Values are bound to their component responders using the bind keyword.
29
- extend: # The extend keyword takes a dictionary of properties to extend the class with.
30
- # Extending refreshValue with a javascript function that terminates its application,
31
- # including all the subviews. It's triggered when the value becomes 1, when the Close button is clicked.
32
- refreshValue: |
33
- function(){
34
- this.base();
35
- if ( this.value==1 ) {
36
- this.app.die();
37
- }
38
- }
39
- # Subviews of the HSheet, nested visual-logical structure.
40
- subviews:
41
- # A button in the lower right corner of the HSheet that triggers destruction of this GUITree (see the extension of HSheet above)
42
- - class: HClickButton
43
- rect: [ null, null, 60, 24, 8, 8 ]
44
- bind: :values.close
45
- options:
46
- label: Close
47
- # A checkbox in the lower right corner of the HSheet that triggers an server action to disable the whole plugin when combined with the close button's value.
48
- - class: HCheckbox
49
- rect: [ null, null, 130, 24, 74, 8 ]
50
- bind: :values.dont_show_again
51
- options:
52
- label: Don't show again
53
- # The HScrollView contains a number of subviews that are inside its scrollbars (if the inner content area is bigger than the outer dimensions of HScrollView itself).
54
- - class: HScrollView
55
- rect: [ 0, 0, 550, 300, 0, 42 ] # This rectangle stretches the component to contain all of the parent's space except the bottom-most 42 pixels.
56
- options:
57
- scrollX: false # Disables horizontal scroll bars.
58
- scrollY: auto # Makes vertical scroll bars appear automatically when needed.
59
- style: # Custom styling using style properties. There are several ways to display nested arrays. This is one:
60
- - [ 'background-color', 'white' ]
61
- - [ 'border-bottom', '1px solid black' ]
62
- # Subviews of the HScrollView; items inside are displayed inside the scrollbars.
63
- subviews:
64
- # The RSence logo image:
65
- - class: HImageView
66
- rect: [ 18, 10, 559, 110 ]
67
- options:
68
- # Images use the value as the URL of the image.
69
- value: http://rsence.org/rsence_org_logo.gif
70
- # A plain view containing a hyperlink, positioned in the right bottom corner of the logo image.
71
- - class: HView
72
- rect: [ null, 95, 310, 25, 35, null ]
73
- options:
74
- html: |
75
- <i style="font-family:Helvetica,Arial,sans-serif;font-size:16px;">
76
- <a style="color:#28c;font-weight:bold" href="http://rsence.org/">http://www.rsence.org/</a>
77
- </i>
78
- style: # Another way to define nested arrays for the style:
79
- - - text-align
80
- - right
81
- # The HInlineView is a simple HTML container, designed to contain "flowing layout" html.
82
- - class: HInlineView
83
- rect: [ 0, 0, null, null, 0, 0 ]
84
- options:
85
- html: :text.welcome # See the gui_params method of welcome.rb to understand how the contents of the text/welcome.html files is linked like this.
86
- style:
87
- - - font-family
88
- - 'Helvetica, Arial, sans-serif'
89
- - - font-size
90
- - 16px
91
- - - line-height
92
- - 20px