Skip to content

Commit

Permalink
bundler
Browse files Browse the repository at this point in the history
  • Loading branch information
AE9RB committed Jun 26, 2011
1 parent c2696bf commit 6763e61
Show file tree
Hide file tree
Showing 18 changed files with 76 additions and 28 deletions.
20 changes: 20 additions & 0 deletions Gemfile
@@ -0,0 +1,20 @@
source 'http://rubygems.org'

# Closure Script itself only requires a version of Rack >= 1.0.0
# This bundle is strictly for development, testing, and packaging

gem 'rake'
gem 'minitest'
gem 'kramdown'
gem 'haml'
gem 'jruby-jars'
gem 'yard'
gem 'maruku'

# Older than 1.3 has a bug with spaces in the path to the jar
gem 'warbler', '>= 1.3'

# jruby-rack embeds a specific version of rack
# keep in sync so the jar distribution has the correct docs
gem 'jruby-rack', '= 1.0.9'
gem 'rack', '= 1.2.2'
35 changes: 35 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,35 @@
GEM
remote: http://rubygems.org/
specs:
haml (3.1.2)
jruby-jars (1.6.2)
jruby-rack (1.0.9)
kramdown (0.13.3)
maruku (0.6.0)
syntax (>= 1.0.0)
minitest (2.3.1)
rack (1.2.2)
rake (0.8.7)
rubyzip (0.9.4)
syntax (1.0.0)
warbler (1.3.1)
jruby-jars (>= 1.4.0)
jruby-rack (>= 1.0.0)
rake (~> 0.8.7)
rubyzip (>= 0.9.4)
yard (0.7.2)

PLATFORMS
ruby

DEPENDENCIES
haml
jruby-jars
jruby-rack (= 1.0.9)
kramdown
maruku
minitest
rack (= 1.2.2)
rake
warbler (>= 1.3)
yard
37 changes: 15 additions & 22 deletions Rakefile
@@ -1,20 +1,12 @@
closure_lib_path = File.expand_path('lib', File.dirname(__FILE__))
$LOAD_PATH.unshift(closure_lib_path) if !$LOAD_PATH.include?(closure_lib_path)

# These versions are important for war packaging.
# Gem users are free to mix and match any sensible versions.
WARBLER_VER = '>= 1.3.0.beta'
KRAMDOWN_VER = '>= 0.13.2'
HAML_VER = '= 3.0.25' # check for dwell on sass when upgrading
JRUBY_JARS_VER = '= 1.5.6'
# jruby-rack embeds a specific version of rack, keep in sync
JRUBY_RACK_VER = '= 1.0.6'
RACK_VER = '= 1.2.1'

gem 'haml', HAML_VER
gem 'rack', RACK_VER
gem 'kramdown', KRAMDOWN_VER
gem 'warbler', WARBLER_VER
begin
require 'bundler/setup'
rescue LoadError => e
puts "ERROR: Rakefile must be used with `bundle exec`"
exit 1
end

require 'closure'
require 'rake/gempackagetask'
Expand Down Expand Up @@ -91,7 +83,7 @@ gem_task = Rake::GemPackageTask.new(gem_spec) {}

war_config = Warbler::Config.new do |config|
config.autodeploy_dir = gem_task.package_dir
config.war_name = "closure-#{gem_task.version}"
config.jar_name = "closure-#{gem_task.version}"

config.dirs = %w(
closure-compiler
Expand All @@ -101,16 +93,16 @@ war_config = Warbler::Config.new do |config|
docs
externs
)

config.gems << Gem::Dependency.new("jruby-jars", JRUBY_JARS_VER)
config.gems << Gem::Dependency.new("jruby-rack", JRUBY_RACK_VER)
config.gems << Gem::Dependency.new("haml", HAML_VER)
config.gems << Gem::Dependency.new("kramdown", KRAMDOWN_VER)

config.bundler = false
config.gems << Gem.loaded_specs['jruby-jars']
config.gems << Gem.loaded_specs['jruby-rack']
config.gems << Gem.loaded_specs['haml']
config.gems << Gem.loaded_specs['kramdown']

config.features = %w(executable)
config.bundler = false

config.webxml.booter = :rack

# Make no locals or attributes in this rackup.
# A clean binding is more important than being dry.
config.webxml.rackup = <<-EOS
Expand Down Expand Up @@ -175,6 +167,7 @@ task 'war:server' do
rm_r Dir.glob 'tmp/*'
tmp = File.expand_path 'tmp'
chdir tmp
ENV.delete 'RUBYOPT' # detach from bundler
exec "java -jar #{war_file}"
end

Expand Down
4 changes: 2 additions & 2 deletions docs/SCRIPT.md
Expand Up @@ -70,7 +70,7 @@ write to @response or change it to another object then the rendering is discarde

Regardless of your language background, cut-and-paste programming from the
scaffold examples should be practical. That's the idea anyways.
If you can conditionally build arrays of strings if Ruby, you're good to go.
If you can conditionally build arrays of strings in Ruby, you're good to go.
But, of course, the more Ruby you know the more you'll be able to do.

## config.ru
Expand Down Expand Up @@ -120,7 +120,7 @@ jars are fetched with URLClassLoader and don't need to be in any Java paths.
The .jar only needs Java. It contains JRuby and the Closure tools. Guaranteed success.

The gem should work on any kind of Ruby that is like version 1.8 or greater.
The Script source code is really boring so any issues will be easy to fix.
The Script source code is non-magical so any issues will be easy to fix.
Mac, Linux, and Windows all work. If you can get Rack 1.0.0 running, Closure
Script should be no problem.

Expand Down
4 changes: 2 additions & 2 deletions scripts/hello/compiler.js.erb
Expand Up @@ -18,12 +18,12 @@ args = %w{
# http://localhost:8080/hello/compiler.js?build
# http://localhost:8080/hello/compiler.js?debug
args += case query_string
when 'build': %w{
when 'build' then %w{
--compilation_level ADVANCED_OPTIMIZATIONS
--js_output_file compiler_build.js
--create_source_map compiler_build.map
}
when 'debug': %w{
when 'debug' then %w{
--debug true
--formatting PRETTY_PRINT
--compilation_level ADVANCED_OPTIMIZATIONS
Expand Down
4 changes: 2 additions & 2 deletions scripts/modules/compiler.js.erb
Expand Up @@ -16,13 +16,13 @@ args = %w{
# must distribute with your compiled modules. It is also used
# for the mtime check against the sources.
args += case query_string
when 'build': %w{
when 'build' then %w{
--js_output_file compiler_build.js
--module_output_path_prefix compiler_build_
--create_source_map compiler_build.map
--compilation_level ADVANCED_OPTIMIZATIONS
}
when 'debug': %w{
when 'debug' then %w{
--js_output_file compiler_debug.js
--module_output_path_prefix compiler_debug_
--debug true
Expand Down
Binary file added vendor/cache/haml-3.1.2.gem
Binary file not shown.
Binary file added vendor/cache/jruby-jars-1.6.2.gem
Binary file not shown.
Binary file added vendor/cache/jruby-rack-1.0.9.gem
Binary file not shown.
Binary file added vendor/cache/kramdown-0.13.3.gem
Binary file not shown.
Binary file added vendor/cache/maruku-0.6.0.gem
Binary file not shown.
Binary file added vendor/cache/minitest-2.3.1.gem
Binary file not shown.
Binary file added vendor/cache/rack-1.2.2.gem
Binary file not shown.
Binary file added vendor/cache/rake-0.8.7.gem
Binary file not shown.
Binary file added vendor/cache/rubyzip-0.9.4.gem
Binary file not shown.
Binary file added vendor/cache/syntax-1.0.0.gem
Binary file not shown.
Binary file added vendor/cache/warbler-1.3.1.gem
Binary file not shown.
Binary file added vendor/cache/yard-0.7.2.gem
Binary file not shown.

0 comments on commit 6763e61

Please sign in to comment.