Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrated Rake for the build system. Updated define.js after running…
… through jslint. Grabbed the latest version of amdjs-tests.
- Loading branch information
Darren Schnare
committed
Mar 10, 2012
1 parent
21e0656
commit 8b128f3
Showing
241 changed files
with
16,451 additions
and
338 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source :rubygems | ||
|
||
gem 'sinatra', '1.3.2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
rack (1.4.1) | ||
rack-protection (1.2.0) | ||
rack | ||
sinatra (1.3.2) | ||
rack (~> 1.3, >= 1.3.6) | ||
rack-protection (~> 1.2) | ||
tilt (~> 1.3, >= 1.3.3) | ||
tilt (1.3.3) | ||
|
||
PLATFORMS | ||
x86-mingw32 | ||
|
||
DEPENDENCIES | ||
sinatra (= 1.3.2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Copyright (c) 2012 Darren Schnare | ||
|
||
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: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: bundle exec ruby -Cweb app.rb -p $PORT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
#!/usr/bin/ruby | ||
#coding: utf-8 | ||
|
||
########## | ||
# CONFIG # | ||
########## | ||
|
||
ENCODING = Encoding::UTF_8 | ||
|
||
SRC_DIR = 'src' | ||
MIN_DIR = 'min' | ||
WEB_SCRIPTS_DIR = File.join('web', 'public', 'scripts') | ||
|
||
SRC_GLOB = File.join(SRC_DIR, '**', '*.js') | ||
MIN_GLOB = File.join(MIN_DIR, '**', '*.js') | ||
|
||
RHINOJAR = File.join('vendor', 'rhino.jar') | ||
JSLINT_PATH = File.join('vendor', 'jslint.js') | ||
|
||
# Define our minify method. Change this if you want to minify using something of your choice. | ||
def minify (*input, output) | ||
Kernel.system("vendor/ajaxmin.exe -js -global:define,window -clobber:true #{input.join(' ')} -out #{output}") | ||
end | ||
|
||
desc "Minifies all AMD modules in '#{SRC_DIR}' and copies the minified versions of each module to 'web/public/scripts'. A copy of '#{SRC_DIR}/define.js' is also copied to 'web/public/amdjs-tests/impl/definejs'." | ||
task :default | ||
|
||
# Make sure we have a min directory. | ||
directory MIN_DIR | ||
|
||
|
||
############## | ||
# SYNTHESIZE # | ||
############## | ||
|
||
=begin | ||
Here we synthesize a file task for each source JavaScript file. This file task | ||
will minify the source file and save the minified version to JS_OUT_DIR. | ||
Finally this block adds each newly created file task as a dependency to the 'default' task. | ||
=end | ||
FileList[SRC_GLOB].each do |src| | ||
path = File.dirname(src) | ||
extname = File.extname(src) | ||
filename = File.basename(src, extname) | ||
js_minified_file = File.join(MIN_DIR, "#{filename}#{extname}") | ||
|
||
file js_minified_file => src do |t| | ||
minify(src, t.name) | ||
end | ||
end | ||
|
||
=begin | ||
Creates a task that copies all files from the srcGlob to a destination. | ||
Usage: | ||
create_copy_task 'articles/*.gif', 'articles', :articles | ||
Reference: | ||
http://martinfowler.com/articles/rake.html | ||
=end | ||
def create_copy_task srcGlob, targetDir, taskSymbol | ||
mkdir_p(targetDir, :verbose => false) | ||
FileList[srcGlob].each do |f| | ||
target = File.join(targetDir, File.basename(f)) | ||
file target => [f] do |t| | ||
cp f, target | ||
end | ||
task taskSymbol => target | ||
end | ||
end | ||
|
||
|
||
######### | ||
# TASKS # | ||
######### | ||
|
||
# Create the task to copy all our unminified source files. | ||
create_copy_task(MIN_GLOB, 'web/public/scripts', :scripts) | ||
# Copy the source define.js to the appropriate directory in amdjs-tests. | ||
create_copy_task(File.join(MIN_DIR, 'define.js'), 'web/public/amdjs-tests/impl/definejs', :scripts) | ||
|
||
# Add all file tasks to the default task. | ||
Rake.application.tasks.each do |t| | ||
if t.kind_of? Rake::FileTask | ||
task :default => [t.name] | ||
end | ||
end | ||
|
||
desc "Check JavaScript source in the '#{SRC_DIR}' with JSLint - exit with status 1 if a file fails." | ||
task :jslint do |t, args| | ||
FileList["#{SRC_DIR}/**/*.js"].exclude("**/_*.js").each do |fname| | ||
cmd = "java -cp #{RHINOJAR} org.mozilla.javascript.tools.shell.Main #{JSLINT_PATH} #{fname}" | ||
results = %x{#{cmd}} | ||
|
||
unless results.length == 0 | ||
puts "#{fname}:" | ||
puts results | ||
exit 1 | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
define("browser",{window:window,document:document,navigator:window.navigator,console:window.console||{}}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.