netzke-core 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
- # v0.8.0 - WIP
1
+ # v0.8.1 - 2012-12-15
2
+ * bug fix
3
+ * in production, JS comment stripping could cause modification of form_authenticity_token (issue #43) - by @scho
4
+
5
+ # v0.8.0 - 2012-12-09
2
6
  ## Misc
3
7
  * many backward-incompatible API changes, see below
4
8
  * major code clean-up and refactor
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 netzke
1
+ Copyright (c) 2012 nomadcoder
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
data/README.md CHANGED
@@ -365,6 +365,6 @@ For RSpec tests (from `test/core_test_app`):
365
365
  * [Twitter](http://twitter.com/netzke) - latest news about the framework
366
366
 
367
367
  ---
368
- Copyright (c) 2008-2012 [netzke](https://twitter.com/netzke), released under the MIT license (see LICENSE).
368
+ Copyright (c) 2008-2012 [nomadcoder](https://twitter.com/nomadcoder), released under the MIT license (see LICENSE).
369
369
 
370
370
  **Note** that Ext JS is licensed [differently](http://www.sencha.com/products/extjs/license/), and you may need to purchase a commercial license in order to use it in your projects!
@@ -92,7 +92,7 @@ module Netzke::Core
92
92
  # It includes JS-classes for the parents, eagerly loaded child components, and itself.
93
93
  def js_missing_code(cached = [])
94
94
  code = dependency_classes.inject("") do |r,k|
95
- cached.include?(k.js_config.xtype) ? r : r + k.js_config.code_with_dependencies#.strip_js_comments
95
+ cached.include?(k.js_config.xtype) ? r : r + k.js_config.code_with_dependencies.strip_js_comments
96
96
  end
97
97
  code.blank? ? nil : code
98
98
  end
@@ -11,12 +11,12 @@ class String
11
11
 
12
12
  # removes JS-comments (both single- and multi-line) from the string
13
13
  def strip_js_comments
14
- regexp = /\/\/.*$|(?m:\/\*.*?\*\/)/
15
- self.gsub!(regexp, '')
16
-
17
- # also remove empty lines
18
- regexp = /^\s*\n/
19
- self.gsub!(regexp, '')
14
+ if defined?(::Rails) && Rails.application.assets.js_compressor
15
+ compressor = Rails.application.assets.js_compressor
16
+ compressor.processor.call(nil, self)
17
+ else
18
+ self
19
+ end
20
20
  end
21
21
 
22
22
  # "false" => false, "whatever_else" => true
@@ -3,7 +3,7 @@ module Netzke
3
3
  module Version
4
4
  MAJOR = 0
5
5
  MINOR = 8
6
- PATCH = 0
6
+ PATCH = 1
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
9
9
  end
data/netzke-core.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "netzke-core"
8
- s.version = "0.8.0"
8
+ s.version = "0.8.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["nomadcoder"]
12
- s.date = "2012-12-09"
12
+ s.date = "2012-12-15"
13
13
  s.description = "Allows building complex RIA by greatly facilitating modular development"
14
14
  s.email = "nmcoder@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -4,6 +4,9 @@ gem 'rails', '~>3.2.0'
4
4
 
5
5
  gem 'sqlite3'
6
6
 
7
+ gem 'uglifier'
8
+ gem 'execjs'
9
+
7
10
  # Bundle gems for the local environment. Make sure to
8
11
  # put test-only gems in this group so their generators
9
12
  # and rake tasks are available in development mode:
@@ -52,9 +52,10 @@ GEM
52
52
  database_cleaner (0.9.1)
53
53
  diff-lcs (1.1.3)
54
54
  erubis (2.7.0)
55
- ffi (1.2.0)
55
+ execjs (1.4.0)
56
+ multi_json (~> 1.0)
57
+ ffi (1.1.5)
56
58
  gherkin (2.11.5)
57
- json (>= 1.4.6)
58
59
  hike (1.2.1)
59
60
  i18n (0.6.1)
60
61
  journey (1.0.4)
@@ -124,6 +125,9 @@ GEM
124
125
  polyglot
125
126
  polyglot (>= 0.3.1)
126
127
  tzinfo (0.3.35)
128
+ uglifier (1.3.0)
129
+ execjs (>= 0.3.0)
130
+ multi_json (~> 1.0, >= 1.0.2)
127
131
  websocket (1.0.4)
128
132
  xpath (0.1.4)
129
133
  nokogiri (~> 1.3)
@@ -136,6 +140,8 @@ DEPENDENCIES
136
140
  cucumber
137
141
  cucumber-rails
138
142
  database_cleaner
143
+ execjs
139
144
  rails (~> 3.2.0)
140
145
  rspec-rails
141
146
  sqlite3
147
+ uglifier
@@ -44,5 +44,8 @@ module RailsApp
44
44
 
45
45
  # Enable the asset pipeline
46
46
  config.assets.enabled = true
47
+
48
+ config.assets.compress = true
49
+ config.assets.js_compressor = :uglifier
47
50
  end
48
51
  end
@@ -16,4 +16,12 @@ describe "Core extensions" do
16
16
  it "should properly do deep_map" do
17
17
  {a: [1,2,{b:3},{c:[4,5]}], d: 6}.deep_map{|el| el.is_a?(Hash) ? el.merge(e:7) : el + 10}.should == { a: [11,12,{e:7, b:3},{e:7, c:[14,15]}], d: 6}
18
18
  end
19
+
20
+ it "should strip js comments" do
21
+ "var test;//commment".strip_js_comments.should == "var test;"
22
+ end
23
+
24
+ it "should not strip // in strings" do
25
+ 'var someVar = "abc//def";'.strip_js_comments.should == 'var someVar="abc//def";'
26
+ end
19
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netzke-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-09 00:00:00.000000000 Z
12
+ date: 2012-12-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport