red 4.1.6 → 4.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,3 @@
1
- History.txt
2
- License.txt
3
- Manifest.txt
4
- PostInstall.txt
5
- README.txt
6
- Rakefile
7
1
  bin/red
8
2
  config/website.yml
9
3
  lib/red.rb
@@ -41,13 +35,12 @@ lib/source/redshift/user_events.rb
41
35
  lib/source/redshift/validator.rb
42
36
  lib/source/redshift/window.rb
43
37
  lib/source/redspec/index.html
44
- lib/source/redspec/lib
45
- lib/source/redspec/lib/red_spec
46
38
  lib/source/redspec/lib/red_spec/red_spec.red
47
39
  lib/source/redspec/lib/stylesheets/specs.sass
48
- script/console
49
- script/destroy
50
- script/generate
40
+ License.txt
41
+ Manifest.txt
42
+ Rakefile
43
+ README.txt
51
44
  spec/array.red
52
45
  spec/hash.red
53
46
  spec/object.red
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ $hoe = Hoe.new('red', Red::VERSION) do |p|
7
7
  p.developer('Jesse Sielaff', 'jesse.sielaff@gmail.com')
8
8
  p.description = 'Red writes like Ruby and runs like JavaScript.'
9
9
  p.changes = '' #p.paragraphs_of("History.txt", 0..1).join("\n\n")
10
- p.post_install_message = 'PostInstall.txt'
10
+ p.post_install_message = 'For more information on Red, see http://github.com/backtik/red/wikis'
11
11
  p.name = 'red'
12
12
  p.rubyforge_name = 'red-js'
13
13
  p.extra_deps = [
data/lib/red.rb CHANGED
@@ -16,7 +16,7 @@ require 'red/nodes/logic_nodes'
16
16
  require 'red/nodes/variable_nodes'
17
17
 
18
18
  module Red # :nodoc:
19
- VERSION = '4.1.6'
19
+ VERSION = '4.1.7'
20
20
 
21
21
  ARRAY_NODES = {
22
22
  :and => LogicNode::Conjunction::And,
@@ -256,4 +256,10 @@ module Red # :nodoc:
256
256
  def self.rails
257
257
  require 'red/plugin'
258
258
  end
259
+
260
+ def javascript_safe_succ!(string)
261
+ string.succ!
262
+ string.succ! if %w(as break byte case catch char class const do else enum false final float for goto if in int is long on new null short super this throw true try use var void while with).include?(string)
263
+ return string
264
+ end
259
265
  end
@@ -3,7 +3,7 @@ module Red # :nodoc:
3
3
  @files ||= ''
4
4
  self.make_plugin_directory('vendor/plugins/red', true)
5
5
  self.create_plugin_file(:open, 'vendor/plugins/red/init.rb', "require 'rubygems'\nrequire 'red'\n\nRed.rails\n")
6
- self.make_plugin_directory('public/javascripts/red')
6
+ self.make_plugin_directory('public/javascripts/red/lib')
7
7
 
8
8
  return unless display_message
9
9
  puts @files && exit
@@ -46,7 +46,7 @@ module Red
46
46
  def initialize(variable_name_sexp, expression_sexp, options)
47
47
  variable_name = variable_name_sexp.red!
48
48
  expression = expression_sexp.red!(:as_assignment => true)
49
- a = @@red_boolean.succ!.dup
49
+ a = javascript_safe_succ!(@@red_boolean).dup
50
50
  if options[:as_argument_default]
51
51
  self << "%s=$T($.%s=%s)?$.%s:%s" % [variable_name, a, variable_name, a, expression]
52
52
  else
@@ -50,9 +50,9 @@ module Red
50
50
  end
51
51
 
52
52
  def self.string # :nodoc:
53
- a = @@red_boolean.succ!.dup
54
- b = @@red_boolean.succ!.dup
55
- c = @@red_boolean.succ!.dup
53
+ a = javascript_safe_succ!(@@red_boolean).dup
54
+ b = javascript_safe_succ!(@@red_boolean).dup
55
+ c = javascript_safe_succ!(@@red_boolean).dup
56
56
  "(($.%s=$T(%s))?(($.%s=$T($.%s=%s))?$.%s:$.%s):$.%s)" % [a, '%s', c, b, '%s', b, c, a]
57
57
  end
58
58
  end
@@ -66,7 +66,7 @@ module Red
66
66
  end
67
67
 
68
68
  def self.string
69
- a = @@red_boolean.succ!.dup
69
+ a = javascript_safe_succ!(@@red_boolean).dup
70
70
  "($T($.%s=%s)?$.%s:%s)" % [a, '%s', a, '%s']
71
71
  end
72
72
  end
@@ -1,7 +1,7 @@
1
1
  require 'element'
2
2
 
3
3
  class Element
4
- `c$Element.__keyed_attributes__={class:'className',for:'htmlFor'}`
4
+ `c$Element.__keyed_attributes__={'class':'className','for':'htmlFor'}`
5
5
  `c$Element.__boolean_attributes__={checked:'checked',declare:'declare',defer:'defer',disabled:'disabled',ismap:'ismap',multiple:'multiple',noresize:'noresize',noshade:'noshade',readonly:'readonly',selected:'selected'}`
6
6
 
7
7
  # call-seq:
@@ -72,7 +72,7 @@ class Cookie
72
72
  # Cookie.new(:user_jds, '8557acb0') unless Cookie.read(:user_jds)
73
73
  #
74
74
  def self.read(key)
75
- value = `#{OPTIONS[:document].native}.cookie.match('(?:^|;)\\s*' + #{Regexp.escape(key)}.__value__ + '=([^;]*)')`
75
+ value = `#{OPTIONS[:document]}.__native__.cookie.match('(?:^|;)\\s*' + #{Regexp.escape(key)}.__value__ + '=([^;]*)')`
76
76
  return value ? `$q(decodeURIComponent(value[1]))` : nil
77
77
  end
78
78
 
@@ -1,4 +1,6 @@
1
1
  require 'selectors'
2
+ require 'user_events'
3
+ require 'window'
2
4
 
3
5
  # The +Document+ object enables access to top-level HTML elements like
4
6
  # <i><head></i>, <i><html></i>, and <i><body></i>.
@@ -8,7 +10,6 @@ require 'selectors'
8
10
  # powerful <tt>Document.[]</tt> method.
9
11
  #
10
12
  module Document
11
-
12
13
  `document.head=document.getElementsByTagName('head')[0]`
13
14
  `document.html=document.getElementsByTagName('html')[0]`
14
15
  `document.window=(document.defaultView||document.parentWindow)`
@@ -413,5 +413,6 @@ class Element
413
413
  # FIX: Incomplete
414
414
  #
415
415
  def to_s
416
+
416
417
  end
417
418
  end
@@ -222,8 +222,8 @@ class Event
222
222
  # _evnt_.
223
223
  #
224
224
  def prevent_default
225
- native = `this.__native__`
226
- `native.preventDefault?native.preventDefault():native.returnValue=false`
225
+ `var Native = this.__native__`
226
+ `Native.preventDefault?Native.preventDefault():Native.returnValue=false`
227
227
  return self
228
228
  end
229
229
 
@@ -264,8 +264,8 @@ class Event
264
264
  # Instructs the event to stop propagating, then returns _evnt_.
265
265
  #
266
266
  def stop_propagation
267
- native = `this.__native__`
268
- `native.stopPropagation?native.stopPropagation():native.cancelBubble=true`
267
+ `var Native = this.__native__`
268
+ `Native.stopPropagation?Native.stopPropagation():Native.cancelBubble=true`
269
269
  return self
270
270
  end
271
271
 
@@ -174,9 +174,9 @@ module Situated
174
174
  end
175
175
 
176
176
  def offsets
177
- `var native = this.__native__`
177
+ `var Native = this.__native__`
178
178
  if trident?
179
- `var bound = native.getBoundingClientRect()`
179
+ `var bound = Native.getBoundingClientRect()`
180
180
  `var html = this.m$document.__native__.documentElement`
181
181
  return {
182
182
  :x => `bound.left + html.scrollLeft - html.clientLeft`,
@@ -188,7 +188,7 @@ module Situated
188
188
  return {:x => `position.x`, :y => `position.y`} if self.is_body?
189
189
  `
190
190
 
191
- element = native
191
+ element = Native
192
192
  while (element && !c$Situated.c$Utilities.m$is_body_bool(element)){
193
193
  position.x += element.offsetLeft;
194
194
  position.y += element.offsetTop;
@@ -211,17 +211,17 @@ module Situated
211
211
  element = element.offsetParent;
212
212
  }
213
213
 
214
- if (#{gecko?} && !c$Situated.c$Utilities.m$border_box(native)){
215
- position.x -= c$Situated.c$Utilities.m$left_border(native);
216
- position.y -= c$Situated.c$Utilities.m$top_border(native);
214
+ if (#{gecko?} && !c$Situated.c$Utilities.m$border_box(Native)){
215
+ position.x -= c$Situated.c$Utilities.m$left_border(Native);
216
+ position.y -= c$Situated.c$Utilities.m$top_border(Native);
217
217
  }
218
218
  `
219
219
  return {:x => `position.x`, :y => `position.y`}
220
220
  end
221
221
 
222
222
  def position_at(x,y)
223
- native = `this.__native__`
224
- h = {:left => x - Situated::Utilities.styleNumber(native, `'margin-left'`), :top => y - Situated::Utilities.styleNumber(native, `'margin-top'`), :position => 'absolute'}
223
+ `var Native = this.__native__`
224
+ h = {:left => x - Situated::Utilities.styleNumber(`Native`, `'margin-left'`), :top => y - Situated::Utilities.styleNumber(`Native`, `'margin-top'`), :position => 'absolute'}
225
225
  self.set_styles(h)
226
226
  end
227
227
 
@@ -51,6 +51,7 @@
51
51
  var includer=Red.inferConstantFromString(x);
52
52
  Red.donateMethodsToSingleton(module,includer,false);
53
53
  Red.donateMethodsToClass(module.prototype,includer.prototype,false);
54
+ if(includer == window){return nil;};
54
55
  switch(includer.m$class().__name__){case 'Module':Red.updateIncluders(includer);break;case 'Class':Red.updateChildren(includer);break;};
55
56
  };
56
57
  },
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: red
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.6
4
+ version: 4.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Sielaff
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-07 00:00:00 -05:00
12
+ date: 2008-11-08 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -60,18 +60,10 @@ executables:
60
60
  extensions: []
61
61
 
62
62
  extra_rdoc_files:
63
- - History.txt
64
63
  - License.txt
65
64
  - Manifest.txt
66
- - PostInstall.txt
67
65
  - README.txt
68
66
  files:
69
- - History.txt
70
- - License.txt
71
- - Manifest.txt
72
- - PostInstall.txt
73
- - README.txt
74
- - Rakefile
75
67
  - bin/red
76
68
  - config/website.yml
77
69
  - lib/red.rb
@@ -109,20 +101,19 @@ files:
109
101
  - lib/source/redshift/validator.rb
110
102
  - lib/source/redshift/window.rb
111
103
  - lib/source/redspec/index.html
112
- - lib/source/redspec/lib
113
- - lib/source/redspec/lib/red_spec
114
104
  - lib/source/redspec/lib/red_spec/red_spec.red
115
105
  - lib/source/redspec/lib/stylesheets/specs.sass
116
- - script/console
117
- - script/destroy
118
- - script/generate
106
+ - License.txt
107
+ - Manifest.txt
108
+ - Rakefile
109
+ - README.txt
119
110
  - spec/array.red
120
111
  - spec/hash.red
121
112
  - spec/object.red
122
113
  - spec/string.red
123
114
  has_rdoc: true
124
115
  homepage: Red takes the Ruby you write and turns it into JavaScript for your browser.
125
- post_install_message: PostInstall.txt
116
+ post_install_message: For more information on Red, see http://github.com/backtik/red/wikis
126
117
  rdoc_options:
127
118
  - --main
128
119
  - README.txt
File without changes
@@ -1,2 +0,0 @@
1
-
2
- For more information on Red, see http://github.com/jessesielaff/red/wikis
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # File: script/console
3
- irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
-
5
- libs = " -r irb/completion"
6
- # Perhaps use a console_lib to store any extra methods I may want available in the console
7
- # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
- libs << " -r #{File.dirname(__FILE__) + '/../lib/red.rb'}"
9
- puts "Loading red gem"
10
- exec "#{irb} #{libs} --simple-prompt"
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/destroy'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Destroy.new.run(ARGV)
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/generate'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Generate.new.run(ARGV)