Permalink
Browse files

standalone gemspec enabling bundler git installs

  • Loading branch information...
1 parent 4919acd commit dcf263f507510bc4ebe2a1aafe459b3ea9e5fe55 @AE9RB committed Jun 26, 2011
View
@@ -1,5 +1,4 @@
.DS_Store
-closure.gemspec
.yardoc*
pkg/*
tmp/*
View
@@ -3,17 +3,20 @@ $LOAD_PATH.unshift(closure_lib_path) if !$LOAD_PATH.include?(closure_lib_path)
begin
require 'bundler/setup'
-rescue LoadError => e
- puts "ERROR: Rakefile must be used with `bundle exec`"
+rescue Exception, LoadError => e
+ puts "ERROR: Try using `bundle exec rake`"
exit 1
end
+# Although psych is faster, it fails.
+YAML::ENGINE.yamler='syck' if defined?(YAML::ENGINE)
+
require 'closure'
require 'rake/gempackagetask'
require 'rake/testtask'
-require 'yard'
require 'warbler'
+
# All docs are distributed with the war
# Only closure is packaged with the gem
DOCS = %w{closure erb rack haml kramdown}
@@ -47,28 +50,6 @@ end
# GEM
-gem_spec = Gem::Specification.new do |s|
- s.name = "closure"
- s.version = Closure::VERSION
- s.platform = Gem::Platform::RUBY
- s.homepage = "http://www.closure-script.com/"
- s.summary = "Google Closure Compiler, Library, Script, and Templates."
-
- s.required_rubygems_version = ">= 1.3"
- s.add_dependency 'rack', '>= 1.0.0'
-
- s.files = `git ls-files`.split("\n")
- s.files += FileList['docs/closure/**/*']
- s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
- s.test_files = `git ls-files`.split("\n").map{|f| f =~ /^(test\/.*_test.rb)$/ ? $1 : nil}.compact
- s.require_path = 'lib'
-end
-
-file "closure.gemspec" => ["Rakefile"] do |t|
- require 'yaml'
- open(t.name, "w") { |f| f.puts gem_spec.to_yaml }
-end
-
task 'gem:ensure_closure_docs' do
unless File.exists? "docs/closure/index.html"
print "ERROR: Docs for closure not found.\n"
@@ -77,10 +58,21 @@ task 'gem:ensure_closure_docs' do
end
task 'gem' => 'gem:ensure_closure_docs'
-gem_task = Rake::GemPackageTask.new(gem_spec) {}
+gem_task = Rake::GemPackageTask.new(Gem::Specification.load 'closure.gemspec') {}
# WAR
+# You win, Warbler. I will cheat now.
+module Warbler
+ module Traits
+ class Gemspec
+ def self.detect?
+ false
+ end
+ end
+ end
+end
+
war_config = Warbler::Config.new do |config|
config.autodeploy_dir = gem_task.package_dir
config.jar_name = "closure-#{gem_task.version}"
@@ -103,7 +95,6 @@ war_config = Warbler::Config.new do |config|
config.features = %w(executable)
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
require 'rubygems'
@@ -134,6 +125,7 @@ war_config = Warbler::Config.new do |config|
# every request when we know nothing will ever be found.
config.webxml.jruby.rack.filter.adds.html = true
config.webxml.jruby.rack.filter.verifies.resource = true
+
end
task 'war' do
@@ -177,7 +169,7 @@ DOCS.each do |gem_name|
if %w{closure}.include? gem_name
base_path = '.'
elsif %w{erb}.include? gem_name
- # Where yard won't magically find the wrong README
+ # Anywhere yard won't magically find the wrong README
base_path = 'docs'
else
spec = Gem.loaded_specs[gem_name]
@@ -190,12 +182,12 @@ DOCS.each do |gem_name|
if gem_name == 'rack'
extra = '- SPEC'
elsif gem_name == 'erb'
- extra = '--default-return "" --hide-void-return --title ERB --no-yardopts erb.rb'
+ extra = '--default-return "" --hide-void-return --title ERB --no-yardopts ../vendor/erb.rb'
elsif gem_name == 'haml'
# Haml ships gem with incomplete docs
# https://github.com/nex3/haml/issues/351
- haml_ref_file = File.expand_path("docs/HAML_REFERENCE.md")
- extra = "- MIT-LICENSE #{haml_ref_file}"
+ haml_ref_file = File.expand_path("vendor/HAML_REFERENCE.md")
+ extra = "--main #{haml_ref_file.dump} - README.md MIT-LICENSE #{haml_ref_file.dump}"
else
extra = ''
end
View
@@ -0,0 +1,24 @@
+# -*- encoding: utf-8 -*-
+lib = File.expand_path('../lib/', __FILE__)
+$:.unshift lib unless $:.include?(lib)
+
+require 'closure'
+
+Gem::Specification.new do |s|
+ s.name = "closure"
+ s.version = Closure::VERSION
+ s.platform = Gem::Platform::RUBY
+ s.authors = ['David Turnbull']
+ s.email = ['dturnbull@gmail.com']
+ s.homepage = 'https://github.com/dturnbull/closure-script'
+ s.summary = "Google Closure Compiler, Library, Script, and Templates."
+
+ s.required_rubygems_version = ">= 1.3.6"
+ s.add_dependency 'rack', '>= 1.0.0'
+
+ dirs = %w{beanshell closure-compiler closure-templates docs externs lib scripts test}
+ s.require_path = 'lib'
+ s.files = Dir.glob("{#{dirs.join ','}}/**/*")
+ s.files += %w(LICENSE README.md)
+ s.test_files = Dir.glob("test/**/*").map{|f| f =~ /^(test\/.*_test.rb)$/ ? $1 : nil}.compact
+end
View
@@ -7,7 +7,7 @@ With Script, you build HTML or Javascript with embedded Ruby.
The core Script technology is very simple and all Scripts execute in the same context
regardless if they are test, demo, or compiler scripts.
-Exploring or extending the examples is the best way to learn <a href="http://www.closure-script.com/">Closure Script</a>. If you
+Exploring or extending the examples is the best way to learn <a href="https://github.com/dturnbull/closure-script">Closure Script</a>. If you
are looking for information about Closure in general,
<a href="http://oreilly.com/catalog/0636920001416">Closure: The Definitive Guide</a>
is a solid reference.
@@ -121,7 +121,7 @@ The .jar only needs Java. It contains JRuby and the Closure tools. Guaranteed
The gem should work on any kind of Ruby that is like version 1.8 or greater.
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
+Mac, Linux, and Windows all work. If you can get Rack running, Closure
Script should be no problem.
## Script Engines
View
@@ -11,14 +11,16 @@
</head>
<body>
- <div id="gems">
- <h2>Docs</h2>
- <% Dir.glob(expand_path '*').sort.each do |gem_name|
- next unless File.exist? "#{gem_name}/frames.html"
- gem_name = File.basename gem_name %>
- <a href="/docs/<%= gem_name %>/frames"><%= gem_name %></a><br />
- <% end %>
- </div>
+ <% if File.exist? expand_path "closure/frames.html" -%>
+ <div id="gems">
+ <h2>Docs</h2>
+ <% Dir.glob(expand_path '*').sort.each do |gem_name|
+ next unless File.exist? "#{gem_name}/frames.html"
+ gem_name = File.basename gem_name %>
+ <a href="/docs/<%= gem_name %>/frames"><%= gem_name %></a><br />
+ <% end -%>
+ </div>
+ <% end -%>
<%= render 'SCRIPT' %>
</body>
</html>
View
@@ -37,6 +37,7 @@
select,input,button,textarea,button{font:99% arial,helvetica,clean,sans-serif;}
table{font-size:inherit;font:100%;}
pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;}
+ pre{padding:5px 12px;margin-top:4px;border:1px solid #eef;background:#f5f5ff;}
</style></head><body>
#{html}
</body></html>
File renamed without changes.
File renamed without changes.

0 comments on commit dcf263f

Please sign in to comment.