asset_packager 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG ADDED
@@ -0,0 +1,122 @@
1
+ ------------------------------------------------------------------------
2
+ r52 | sbecker | 2007-11-04 01:38:21 -0400 (Sun, 04 Nov 2007) | 3 lines
3
+
4
+ * Allow configuration of which environments the helpers should merge scripts with the Synthesis::AssetPackage.merge_environments variable.
5
+ * Refactored tests so they can all run together, and not depend on what the RAILS_ENV constant is.
6
+ * Only add file extension if it was explicitly passed in, fixes other helpers in rails.
7
+ ------------------------------------------------------------------------
8
+ r51 | sbecker | 2007-10-26 16:24:48 -0400 (Fri, 26 Oct 2007) | 1 line
9
+
10
+ * Updated jsmin.rb to latest version from 2007-07-20
11
+ ------------------------------------------------------------------------
12
+ r50 | sbecker | 2007-10-23 23:16:07 -0400 (Tue, 23 Oct 2007) | 1 line
13
+
14
+ Updated CHANGELOG
15
+
16
+ ------------------------------------------------------------------------
17
+ r49 | sbecker | 2007-10-23 23:13:27 -0400 (Tue, 23 Oct 2007) | 1 line
18
+
19
+ * Finally committed the subdirectory patch. (Thanks James Coglan!)
20
+ ------------------------------------------------------------------------
21
+ r48 | sbecker | 2007-10-15 15:10:43 -0400 (Mon, 15 Oct 2007) | 1 line
22
+
23
+ * Speed up rake tasks and remove rails environment dependencies
24
+ ------------------------------------------------------------------------
25
+ r43 | sbecker | 2007-07-02 15:30:29 -0400 (Mon, 02 Jul 2007) | 1 line
26
+
27
+ * Updated the docs regarding testing.
28
+ ------------------------------------------------------------------------
29
+ r42 | sbecker | 2007-07-02 15:27:00 -0400 (Mon, 02 Jul 2007) | 1 line
30
+
31
+ * For production helper test, build packages once - on first setup.
32
+ ------------------------------------------------------------------------
33
+ r41 | sbecker | 2007-07-02 15:14:13 -0400 (Mon, 02 Jul 2007) | 1 line
34
+
35
+ * Put build_all in test setup and delete_all in test teardown so all tests will pass the on first run of test suite.
36
+ ------------------------------------------------------------------------
37
+ r40 | sbecker | 2007-07-02 14:55:28 -0400 (Mon, 02 Jul 2007) | 1 line
38
+
39
+ * Fix quotes, add contact info
40
+ ------------------------------------------------------------------------
41
+ r39 | sbecker | 2007-07-02 14:53:52 -0400 (Mon, 02 Jul 2007) | 1 line
42
+
43
+ * Add note on how to run the tests for asset packager.
44
+ ------------------------------------------------------------------------
45
+ r38 | sbecker | 2007-01-25 15:36:42 -0500 (Thu, 25 Jan 2007) | 1 line
46
+
47
+ added CHANGELOG w/ subversion log entries
48
+ ------------------------------------------------------------------------
49
+ r37 | sbecker | 2007-01-25 15:34:39 -0500 (Thu, 25 Jan 2007) | 1 line
50
+
51
+ updated jsmin with new version from 2007-01-23
52
+ ------------------------------------------------------------------------
53
+ r35 | sbecker | 2007-01-15 19:22:16 -0500 (Mon, 15 Jan 2007) | 1 line
54
+
55
+ require synthesis/asset_package in rake tasks, as Rails 1.2 seems to necessitate
56
+ ------------------------------------------------------------------------
57
+ r34 | sbecker | 2007-01-05 12:22:09 -0500 (Fri, 05 Jan 2007) | 1 line
58
+
59
+ do a require before including in action view, because when running migrations, the plugin lib files don't automatically get required, causing the include to error out
60
+ ------------------------------------------------------------------------
61
+ r33 | sbecker | 2006-12-23 02:03:41 -0500 (Sat, 23 Dec 2006) | 1 line
62
+
63
+ updating readme with various tweaks
64
+ ------------------------------------------------------------------------
65
+ r32 | sbecker | 2006-12-23 02:03:12 -0500 (Sat, 23 Dec 2006) | 1 line
66
+
67
+ updating readme with various tweaks
68
+ ------------------------------------------------------------------------
69
+ r31 | sbecker | 2006-12-23 01:52:25 -0500 (Sat, 23 Dec 2006) | 1 line
70
+
71
+ updated readme to show how to use different media for stylesheets
72
+ ------------------------------------------------------------------------
73
+ r28 | sbecker | 2006-11-27 21:02:14 -0500 (Mon, 27 Nov 2006) | 1 line
74
+
75
+ updated compute_public_path, added check for images
76
+ ------------------------------------------------------------------------
77
+ r27 | sbecker | 2006-11-10 18:28:29 -0500 (Fri, 10 Nov 2006) | 1 line
78
+
79
+ tolerate extra periods in source asset names. fixed subversion revision checking to be file specific, instead of repository specific.
80
+ ------------------------------------------------------------------------
81
+ r26 | sbecker | 2006-06-24 17:04:27 -0400 (Sat, 24 Jun 2006) | 1 line
82
+
83
+ convert asset_packages_yml var to a class var
84
+ ------------------------------------------------------------------------
85
+ r25 | sbecker | 2006-06-24 12:37:47 -0400 (Sat, 24 Jun 2006) | 1 line
86
+
87
+ Added ability to include assets by package name. In development, include all uncompressed asset files. In production, include the single compressed asset.
88
+ ------------------------------------------------------------------------
89
+ r24 | sbecker | 2006-06-19 21:57:23 -0400 (Mon, 19 Jun 2006) | 1 line
90
+
91
+ Updates to README and about.yml
92
+ ------------------------------------------------------------------------
93
+ r23 | sbecker | 2006-06-19 14:55:39 -0400 (Mon, 19 Jun 2006) | 2 lines
94
+
95
+ Modifying about.yml and README
96
+
97
+ ------------------------------------------------------------------------
98
+ r21 | sbecker | 2006-06-19 12:18:32 -0400 (Mon, 19 Jun 2006) | 2 lines
99
+
100
+ added "formerly known as MergeJS"
101
+
102
+ ------------------------------------------------------------------------
103
+ r20 | sbecker | 2006-06-19 12:14:46 -0400 (Mon, 19 Jun 2006) | 2 lines
104
+
105
+ Updating docs
106
+
107
+ ------------------------------------------------------------------------
108
+ r19 | sbecker | 2006-06-19 11:26:08 -0400 (Mon, 19 Jun 2006) | 2 lines
109
+
110
+ removing compiled test assets from subversion
111
+
112
+ ------------------------------------------------------------------------
113
+ r18 | sbecker | 2006-06-19 11:19:59 -0400 (Mon, 19 Jun 2006) | 2 lines
114
+
115
+ Initial import.
116
+
117
+ ------------------------------------------------------------------------
118
+ r17 | sbecker | 2006-06-19 11:18:56 -0400 (Mon, 19 Jun 2006) | 2 lines
119
+
120
+ Creating directory.
121
+
122
+ ------------------------------------------------------------------------
data/README ADDED
@@ -0,0 +1,178 @@
1
+ = AssetPackager
2
+
3
+ JavaScript and CSS Asset Compression for Production Rails Apps
4
+
5
+ == Description
6
+
7
+ When it comes time to deploy your new web application, instead of
8
+ sending down a dozen JavaScript and CSS files full of formatting
9
+ and comments, this Rails plugin makes it simple to merge and
10
+ compress JavaScript and CSS down into one or more files, increasing
11
+ speed and saving bandwidth.
12
+
13
+ When in development, it allows you to use your original versions
14
+ and retain formatting and comments for readability and debugging.
15
+
16
+ This code is released under the MIT license (like Ruby). You're free
17
+ to rip it up, enhance it, etc. And if you make any enhancements,
18
+ I'd like to know so I can add them back in. Thanks!
19
+
20
+ * Formerly known as MergeJS.
21
+
22
+ == Credit
23
+
24
+ This Rails Plugin was inspired by Cal Henderson's article
25
+ "Serving JavaScript Fast" on Vitamin:
26
+ http://www.thinkvitamin.com/features/webapps/serving-javascript-fast
27
+
28
+ It also uses the Ruby JavaScript Minifier created by
29
+ Douglas Crockford.
30
+ http://www.crockford.com/javascript/jsmin.html
31
+
32
+ == Key Features
33
+
34
+ * Merges and compresses JavaScript and CSS when running in production.
35
+ * Uses uncompressed originals when running in development.
36
+ * Generates packages on demand in production
37
+
38
+ == Components
39
+
40
+ * Rake tasks for managing packages
41
+ * Helper functions for including these JavaScript and CSS files in your views.
42
+ * YAML configuration file for mapping JavaScript and CSS files to packages.
43
+ * Rake Task for auto-generating the YAML file from your existing JavaScript files.
44
+
45
+ == Updates
46
+
47
+ November '08:
48
+ * Rails 2.2 compatibility fixes
49
+ * No more mucking with internal Rails functions, which means:
50
+ * Return to use of query-string timestamps. Greatly simplifies things.
51
+ * Multiple asset-hosts supported
52
+ * Filenames with "."'s in them, such as "jquery-x.x.x" are supported.
53
+ * Now compatible with any revision control system since it no longer uses revision numbers.
54
+ * Packages generated on demand in production mode. Running create_all rake task no longer necessary.
55
+
56
+ == How to Use:
57
+
58
+ 1. Download and install the plugin:
59
+ ./script/plugin install git://github.com/sbecker/asset_packager.git
60
+
61
+ 2. Run the rake task "asset:packager:create_yml" to generate the /config/asset_packages.yml
62
+ file the first time. You will need to reorder files under 'base' so dependencies are loaded
63
+ in correct order. Feel free to rename or create new file packages.
64
+
65
+ IMPORTANT: JavaScript files can break once compressed if each statement doesn't end with a semi-colon.
66
+ The minifier puts multiple statements on one line, so if the semi-colon is missing, the statement may no
67
+ longer makes sense and cause a syntax error.
68
+
69
+ == Examples of config/asset_packages.yml
70
+
71
+ Example from a fresh rails app after running the rake task. (Stylesheets is blank because a
72
+ default rails app has no stylesheets yet.):
73
+
74
+ ---
75
+ javascripts:
76
+ - base:
77
+ - prototype
78
+ - effects
79
+ - dragdrop
80
+ - controls
81
+ - application
82
+ stylesheets:
83
+ - base: []
84
+
85
+ Multiple packages:
86
+
87
+ ---
88
+ javascripts:
89
+ - base:
90
+ - prototype
91
+ - effects
92
+ - controls
93
+ - dragdrop
94
+ - application
95
+ - secondary:
96
+ - foo
97
+ - bar
98
+ stylesheets:
99
+ - base:
100
+ - screen
101
+ - header
102
+ - secondary:
103
+ - foo
104
+ - bar
105
+
106
+ 3. Run the rake task "asset:packager:build_all" to generate the compressed, merged versions
107
+ for each package. Whenever you rearrange the yaml file, you'll need to run this task again.
108
+
109
+ Merging and compressing is expensive, so this is something we want to do once, not every time
110
+ your app starts. Thats why its a rake task. You can run this task via Capistrano when deploying
111
+ to avoid an initially slow request the first time a page is generated.
112
+
113
+ Note: The package will be generated on the fly if it doesn't yet exist, so you don't *need*
114
+ to run the rake task when deploying, its just recommended for speeding up initial requests.
115
+
116
+ 4. Use the helper functions whenever including these files in your application. See below for examples.
117
+
118
+ 5. Potential warning: css compressor function currently removes CSS comments. This might blow
119
+ away some CSS hackery. To disable comment removal, comment out /lib/synthesis/asset_package.rb line 176.
120
+
121
+ == JavaScript Examples
122
+
123
+ Example call (based on above /config/asset_packages.yml):
124
+ <%= javascript_include_merged :base %>
125
+
126
+ In development, this generates:
127
+ <script type="text/javascript" src="/javascripts/prototype.js?1228027240"></script>
128
+ <script type="text/javascript" src="/javascripts/effects.js?1228027240"></script>
129
+ <script type="text/javascript" src="/javascripts/controls.js?1228027240"></script>
130
+ <script type="text/javascript" src="/javascripts/dragdrop.js?1228027240"></script>
131
+ <script type="text/javascript" src="/javascripts/application.js?1228027240"></script>
132
+
133
+ In production, this generates:
134
+ <script type="text/javascript" src="/javascripts/base_packaged.js?123456789"></script>
135
+
136
+ == Stylesheet Examples
137
+
138
+ Example call:
139
+ <%= stylesheet_link_merged :base %>
140
+
141
+ In development, this generates:
142
+ <link href="/stylesheets/screen.css?1228027240" media="screen" rel="Stylesheet" type="text/css" />
143
+ <link href="/stylesheets/header.css?1228027240" media="screen" rel="Stylesheet" type="text/css" />
144
+
145
+ In production this generates:
146
+ <link href="/stylesheets/base_packaged.css?1228027240" media="screen" rel="Stylesheet" type="text/css" />
147
+
148
+ == Different CSS Media
149
+
150
+ All options for stylesheet_link_tag still work, so if you want to specify a different media type:
151
+ <%= stylesheet_link_merged :secondary, 'media' => 'print' %>
152
+
153
+ == Rake tasks
154
+
155
+ rake asset:packager:build_all # Merge and compress assets
156
+ rake asset:packager:create_yml # Generate asset_packages.yml from existing assets
157
+ rake asset:packager:delete_all # Delete all asset builds
158
+
159
+ == Running the tests
160
+
161
+ This plugin has a full suite of tests. But since they
162
+ depend on rails, it has to be run in the context of a
163
+ rails app, in the vendor/plugins directory. Observe:
164
+
165
+ > rails newtestapp
166
+ > cd newtestapp
167
+ > ./script/plugin install ./script/plugin install git://github.com/sbecker/asset_packager.git
168
+ > rake test:plugins PLUGIN=asset_packager # all tests pass
169
+
170
+ == License
171
+ Copyright (c) 2006-2008 Scott Becker - http://synthesis.sbecker.net
172
+ Contact via Github for change requests, etc.
173
+
174
+ 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:
175
+
176
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
177
+
178
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,52 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "asset_packager"
8
+ gem.summary = %Q{Packager for rails js and css}
9
+ gem.description = %Q{Minify for rails js and css}
10
+ gem.email = "dieinzige@gmail.com"
11
+ gem.homepage = "http://github.com/Dieinzige/asset_packager"
12
+ gem.authors = ["Dieinzige"]
13
+ gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
14
+ end
15
+ Jeweler::GemcutterTasks.new
16
+ rescue LoadError
17
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
18
+ end
19
+
20
+ require 'rake/testtask'
21
+ Rake::TestTask.new(:test) do |test|
22
+ test.libs << 'lib' << 'test'
23
+ test.pattern = 'test/**/test_*.rb'
24
+ test.verbose = true
25
+ end
26
+
27
+ begin
28
+ require 'rcov/rcovtask'
29
+ Rcov::RcovTask.new do |test|
30
+ test.libs << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+ rescue LoadError
35
+ task :rcov do
36
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
37
+ end
38
+ end
39
+
40
+ task :test => :check_dependencies
41
+
42
+ task :default => :test
43
+
44
+ require 'rake/rdoctask'
45
+ Rake::RDocTask.new do |rdoc|
46
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
47
+
48
+ rdoc.rdoc_dir = 'rdoc'
49
+ rdoc.title = "asset_packager #{version}"
50
+ rdoc.rdoc_files.include('README*')
51
+ rdoc.rdoc_files.include('lib/**/*.rb')
52
+ end
data/about.yml ADDED
@@ -0,0 +1,8 @@
1
+ author: Scott Becker
2
+ name: AssetPackager
3
+ summary: JavaScript and CSS Asset Compression for Production Rails Apps
4
+ homepage: http://synthesis.sbecker.net/pages/asset_packager
5
+ plugin: http://sbecker.net/shared/plugins/asset_packager
6
+ license: MIT
7
+ version: 0.2
8
+ rails_version: 1.1.2+
data/init.rb ADDED
@@ -0,0 +1,2 @@
1
+ require 'synthesis/asset_package_helper'
2
+ ActionView::Base.send :include, Synthesis::AssetPackageHelper
data/install.rb ADDED
@@ -0,0 +1 @@
1
+ # Install hook code here
data/lib/jsmin.rb ADDED
@@ -0,0 +1,205 @@
1
+ #!/usr/bin/ruby
2
+ # jsmin.rb 2007-07-20
3
+ # Author: Uladzislau Latynski
4
+ # This work is a translation from C to Ruby of jsmin.c published by
5
+ # Douglas Crockford. Permission is hereby granted to use the Ruby
6
+ # version under the same conditions as the jsmin.c on which it is
7
+ # based.
8
+ #
9
+ # /* jsmin.c
10
+ # 2003-04-21
11
+ #
12
+ # Copyright (c) 2002 Douglas Crockford (www.crockford.com)
13
+ #
14
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of
15
+ # this software and associated documentation files (the "Software"), to deal in
16
+ # the Software without restriction, including without limitation the rights to
17
+ # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
18
+ # of the Software, and to permit persons to whom the Software is furnished to do
19
+ # so, subject to the following conditions:
20
+ #
21
+ # The above copyright notice and this permission notice shall be included in all
22
+ # copies or substantial portions of the Software.
23
+ #
24
+ # The Software shall be used for Good, not Evil.
25
+ #
26
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32
+ # SOFTWARE.
33
+
34
+ EOF = -1
35
+ $theA = ""
36
+ $theB = ""
37
+
38
+ # isAlphanum -- return true if the character is a letter, digit, underscore,
39
+ # dollar sign, or non-ASCII character
40
+ def isAlphanum(c)
41
+ return false if !c || c == EOF
42
+ return ((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') ||
43
+ (c >= 'A' && c <= 'Z') || c == '_' || c == '$' ||
44
+ c == '\\' || c[0] > 126)
45
+ end
46
+
47
+ # get -- return the next character from stdin. Watch out for lookahead. If
48
+ # the character is a control character, translate it to a space or linefeed.
49
+ def get()
50
+ c = $stdin.getc
51
+ return EOF if(!c)
52
+ c = c.chr
53
+ return c if (c >= " " || c == "\n" || c.unpack("c") == EOF)
54
+ return "\n" if (c == "\r")
55
+ return " "
56
+ end
57
+
58
+ # Get the next character without getting it.
59
+ def peek()
60
+ lookaheadChar = $stdin.getc
61
+ $stdin.ungetc(lookaheadChar)
62
+ return lookaheadChar.chr
63
+ end
64
+
65
+ # mynext -- get the next character, excluding comments.
66
+ # peek() is used to see if a '/' is followed by a '/' or '*'.
67
+ def mynext()
68
+ c = get
69
+ if (c == "/")
70
+ if(peek == "/")
71
+ while(true)
72
+ c = get
73
+ if (c <= "\n")
74
+ return c
75
+ end
76
+ end
77
+ end
78
+ if(peek == "*")
79
+ get
80
+ while(true)
81
+ case get
82
+ when "*"
83
+ if (peek == "/")
84
+ get
85
+ return " "
86
+ end
87
+ when EOF
88
+ raise "Unterminated comment"
89
+ end
90
+ end
91
+ end
92
+ end
93
+ return c
94
+ end
95
+
96
+
97
+ # action -- do something! What you do is determined by the argument: 1
98
+ # Output A. Copy B to A. Get the next B. 2 Copy B to A. Get the next B.
99
+ # (Delete A). 3 Get the next B. (Delete B). action treats a string as a
100
+ # single character. Wow! action recognizes a regular expression if it is
101
+ # preceded by ( or , or =.
102
+ def action(a)
103
+ if(a==1)
104
+ $stdout.write $theA
105
+ end
106
+ if(a==1 || a==2)
107
+ $theA = $theB
108
+ if ($theA == "\'" || $theA == "\"")
109
+ while (true)
110
+ $stdout.write $theA
111
+ $theA = get
112
+ break if ($theA == $theB)
113
+ raise "Unterminated string literal" if ($theA <= "\n")
114
+ if ($theA == "\\")
115
+ $stdout.write $theA
116
+ $theA = get
117
+ end
118
+ end
119
+ end
120
+ end
121
+ if(a==1 || a==2 || a==3)
122
+ $theB = mynext
123
+ if ($theB == "/" && ($theA == "(" || $theA == "," || $theA == "=" ||
124
+ $theA == ":" || $theA == "[" || $theA == "!" ||
125
+ $theA == "&" || $theA == "|" || $theA == "?" ||
126
+ $theA == "{" || $theA == "}" || $theA == ";" ||
127
+ $theA == "\n"))
128
+ $stdout.write $theA
129
+ $stdout.write $theB
130
+ while (true)
131
+ $theA = get
132
+ if ($theA == "/")
133
+ break
134
+ elsif ($theA == "\\")
135
+ $stdout.write $theA
136
+ $theA = get
137
+ elsif ($theA <= "\n")
138
+ raise "Unterminated RegExp Literal"
139
+ end
140
+ $stdout.write $theA
141
+ end
142
+ $theB = mynext
143
+ end
144
+ end
145
+ end
146
+
147
+ # jsmin -- Copy the input to the output, deleting the characters which are
148
+ # insignificant to JavaScript. Comments will be removed. Tabs will be
149
+ # replaced with spaces. Carriage returns will be replaced with linefeeds.
150
+ # Most spaces and linefeeds will be removed.
151
+ def jsmin
152
+ $theA = "\n"
153
+ action(3)
154
+ while ($theA != EOF)
155
+ case $theA
156
+ when " "
157
+ if (isAlphanum($theB))
158
+ action(1)
159
+ else
160
+ action(2)
161
+ end
162
+ when "\n"
163
+ case ($theB)
164
+ when "{","[","(","+","-"
165
+ action(1)
166
+ when " "
167
+ action(3)
168
+ else
169
+ if (isAlphanum($theB))
170
+ action(1)
171
+ else
172
+ action(2)
173
+ end
174
+ end
175
+ else
176
+ case ($theB)
177
+ when " "
178
+ if (isAlphanum($theA))
179
+ action(1)
180
+ else
181
+ action(3)
182
+ end
183
+ when "\n"
184
+ case ($theA)
185
+ when "}","]",")","+","-","\"","\\", "'", '"'
186
+ action(1)
187
+ else
188
+ if (isAlphanum($theA))
189
+ action(1)
190
+ else
191
+ action(3)
192
+ end
193
+ end
194
+ else
195
+ action(1)
196
+ end
197
+ end
198
+ end
199
+ end
200
+
201
+ ARGV.each do |anArg|
202
+ $stdout.write "// #{anArg}\n"
203
+ end
204
+
205
+ jsmin