Permalink
Browse files

Created a gem for cooler installation

  • Loading branch information...
elado committed Oct 29, 2010
1 parent 16f0a1f commit 653eacc7db783d6557b2f6dc3f0bc439cf915f55
Showing with 173 additions and 32 deletions.
  1. +1 −1 .gitignore
  2. +63 −0 Manifest
  3. +12 −4 README.md
  4. +13 −0 Rakefile
  5. +56 −0 examples/rails3-example/public/javascripts/isotope.js
  6. +27 −26 isotope.gemspec
  7. +1 −1 lib/version.rb
View
@@ -1,3 +1,3 @@
examples/rails3-example/log
examples/rails3-example/tmp
-examples/rails3-example/vendor/plugins/ruby-hybrid-templates
+pkg
View
@@ -0,0 +1,63 @@
+CHANGELOG.rdoc
+Gemfile
+Gemfile.lock
+LICENSE
+README.md
+Rakefile
+examples/rails3-example/Gemfile
+examples/rails3-example/Gemfile.lock
+examples/rails3-example/README
+examples/rails3-example/Rakefile
+examples/rails3-example/app/controllers/application_controller.rb
+examples/rails3-example/app/controllers/articles_controller.rb
+examples/rails3-example/app/helpers/application_helper.rb
+examples/rails3-example/app/helpers/articles_helper.rb
+examples/rails3-example/app/views/articles/article.html.ejs
+examples/rails3-example/app/views/articles/show_client.html.erb
+examples/rails3-example/app/views/articles/show_server_template_in_view.html.erb
+examples/rails3-example/app/views/layouts/application.html.erb
+examples/rails3-example/config.ru
+examples/rails3-example/config/application.rb
+examples/rails3-example/config/boot.rb
+examples/rails3-example/config/database.yml
+examples/rails3-example/config/environment.rb
+examples/rails3-example/config/environments/development.rb
+examples/rails3-example/config/environments/production.rb
+examples/rails3-example/config/environments/test.rb
+examples/rails3-example/config/initializers/backtrace_silencers.rb
+examples/rails3-example/config/initializers/inflections.rb
+examples/rails3-example/config/initializers/mime_types.rb
+examples/rails3-example/config/initializers/secret_token.rb
+examples/rails3-example/config/initializers/session_store.rb
+examples/rails3-example/config/locales/en.yml
+examples/rails3-example/config/routes.rb
+examples/rails3-example/db/development.sqlite3
+examples/rails3-example/db/seeds.rb
+examples/rails3-example/doc/README_FOR_APP
+examples/rails3-example/public/404.html
+examples/rails3-example/public/422.html
+examples/rails3-example/public/500.html
+examples/rails3-example/public/favicon.ico
+examples/rails3-example/public/images/rails.png
+examples/rails3-example/public/index.html
+examples/rails3-example/public/javascripts/application.js
+examples/rails3-example/public/javascripts/controls.js
+examples/rails3-example/public/javascripts/dragdrop.js
+examples/rails3-example/public/javascripts/effects.js
+examples/rails3-example/public/javascripts/isotope.js
+examples/rails3-example/public/javascripts/prototype.js
+examples/rails3-example/public/javascripts/rails.js
+examples/rails3-example/public/robots.txt
+examples/rails3-example/script/rails
+examples/rails3-example/test/functional/articles_controller_test.rb
+examples/rails3-example/test/performance/browsing_test.rb
+examples/rails3-example/test/test_helper.rb
+examples/rails3-example/test/unit/helpers/article_helper_test.rb
+examples/rails3-example/test/unit/helpers/articles_helper_test.rb
+examples/sinatra-example/server.rb
+lib/isotope.js
+lib/isotope.rb
+lib/version.rb
+test/article.ejs
+test/isotope_spec.rb
+Manifest
View
@@ -137,27 +137,35 @@ This code reads the source of the EJS file, uses Johnson and John Resig's techni
### Installation:
+ gem install isotope
+
+Or
+ # Rails 3.x
+ ruby script/rails plugin install git@github.com:elado/isotope.git
+
+ # Rails 2.3.x
+ ruby script/plugin install git@github.com:elado/isotope.git
+
+
#### Rails
##### Rails 3.x
- ruby script/rails plugin install git@github.com:elado/isotope.git
-
Add to your Gemfile
gem 'json'
gem 'johnson'
+ gem 'isotope'
and run `bundle install`
##### Rails 2.3.x
- ruby script/plugin install git@github.com:elado/isotope.git
-
Add to config/environment.rb
config.gem 'json'
config.gem 'johnson'
+ config.gem 'isotope'
and run `rake gems:install`
View
@@ -0,0 +1,13 @@
+require 'rubygems'
+require 'rake'
+require 'echoe'
+
+Echoe.new('isotope', '1.0.0') do |p|
+ p.summary = "Ruby Hybrid (Server and Client sides) templates"
+ p.description = "Isotope provides an easy way to use a signle EJS template on both server and client side"
+ p.url = "http://github.com/elado/isotope"
+ p.author = "Elad Ossadon"
+ p.email = "elad@ossadon.com"
+ p.ignore_pattern = ["tmp/*", "script/*"]
+ p.development_dependencies = []
+end
@@ -0,0 +1,56 @@
+// Simple JavaScript Templating
+// John Resig - http://ejohn.org/ - MIT Licensed
+
+// Changed a bit to support Isotope functionality
+// by Elad Ossadon - http://github.com/elado/isotope
+
+(function(){
+ var cache = {};
+
+ this.Isotope = function tmpl(str, data, options){
+ // Figure out if we're getting a template, or if we need to
+ // load the template - and be sure to cache the result.
+ var fn = cache[str] = cache[str] ||
+
+ // Generate a reusable function that will serve as a template
+ // generator (and which will be cached).
+ new Function("obj",
+ "var p=[],print=function(){p.push.apply(p,arguments);};" +
+
+ // Introduce the data as local variables using with(){}
+ "with(obj){p.push('" +
+
+ // Convert the template into pure JavaScript
+ str
+ .replace(/[\r\t\n]/g, " ")
+ .split("<%").join("\t")
+ .replace(/((^|%>)[^\t]*)'/g, "$1\r")
+ .replace(/\t=(.*?)%>/g, "',$1,'")
+ .split("\t").join("');")
+ .split("%>").join("p.push('")
+ .split("\r").join("\\'")
+ + "');}return p.join('');");
+
+ // Provide some basic currying to the user
+
+ if (data) {
+ options=options || {};
+
+ if (data instanceof Array) {
+ var s=[];
+ for (var i=0;i<data.length;i++) {
+ var itemObject={};
+ itemObject[options.localName || "item"]=data[i];
+
+ s.push(fn(itemObject));
+ }
+ return s.join(options.delimeter || "");
+ }
+ else {
+ return fn( data );
+ }
+ }
+
+ return fn;
+ };
+})();
View
@@ -1,29 +1,30 @@
-# encoding: utf-8
-require File.expand_path('../lib/version', __FILE__)
+# -*- encoding: utf-8 -*-
-Gem::Specification.new do |gem|
- gem.name = 'isotope'
- gem.version = Isotope::VERSION::STRING
- gem.date = Time.now.strftime('%Y-%m-%d')
- gem.platform = Gem::Platform::RUBY
-
- gem.summary = "Ruby Hybrid (Server and Client sides) templates"
- gem.description = "Isotope provides an easy way to use a signle EJS template on both server and client side"
-
- gem.authors = ['Elad Ossadon']
- gem.email = 'elad@ossadon.com'
- gem.homepage = 'http://github.com/elado/ruby-hybrid-templates/wikis'
+Gem::Specification.new do |s|
+ s.name = %q{isotope}
+ s.version = "1.0.0"
-
- gem.rubyforge_project = nil
- gem.has_rdoc = true
- gem.rdoc_options = ['--main', 'README.rdoc', '--charset=UTF-8']
- gem.extra_rdoc_files = ['README.rdoc', 'LICENSE', 'CHANGELOG.rdoc']
-
- gem.files = Dir['{lib,test}/**/*', 'README*', 'LICENSE*'] & `git ls-files -z`.split("\0")
-
- gem.add_development_dependency 'json'
- gem.add_development_dependency 'johnson'
- gem.add_development_dependency 'rspec'
-end
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Elad Ossadon"]
+ s.date = %q{2010-10-29}
+ s.description = %q{Isotope provides an easy way to use a signle EJS template on both server and client side}
+ s.email = %q{elad@ossadon.com}
+ s.extra_rdoc_files = ["CHANGELOG.rdoc", "LICENSE", "README.md", "lib/isotope.js", "lib/isotope.rb", "lib/version.rb"]
+ s.files = ["CHANGELOG.rdoc", "Gemfile", "Gemfile.lock", "LICENSE", "README.md", "Rakefile", "examples/rails3-example/Gemfile", "examples/rails3-example/Gemfile.lock", "examples/rails3-example/README", "examples/rails3-example/Rakefile", "examples/rails3-example/app/controllers/application_controller.rb", "examples/rails3-example/app/controllers/articles_controller.rb", "examples/rails3-example/app/helpers/application_helper.rb", "examples/rails3-example/app/helpers/articles_helper.rb", "examples/rails3-example/app/views/articles/article.html.ejs", "examples/rails3-example/app/views/articles/show_client.html.erb", "examples/rails3-example/app/views/articles/show_server_template_in_view.html.erb", "examples/rails3-example/app/views/layouts/application.html.erb", "examples/rails3-example/config.ru", "examples/rails3-example/config/application.rb", "examples/rails3-example/config/boot.rb", "examples/rails3-example/config/database.yml", "examples/rails3-example/config/environment.rb", "examples/rails3-example/config/environments/development.rb", "examples/rails3-example/config/environments/production.rb", "examples/rails3-example/config/environments/test.rb", "examples/rails3-example/config/initializers/backtrace_silencers.rb", "examples/rails3-example/config/initializers/inflections.rb", "examples/rails3-example/config/initializers/mime_types.rb", "examples/rails3-example/config/initializers/secret_token.rb", "examples/rails3-example/config/initializers/session_store.rb", "examples/rails3-example/config/locales/en.yml", "examples/rails3-example/config/routes.rb", "examples/rails3-example/db/development.sqlite3", "examples/rails3-example/db/seeds.rb", "examples/rails3-example/doc/README_FOR_APP", "examples/rails3-example/public/404.html", "examples/rails3-example/public/422.html", "examples/rails3-example/public/500.html", "examples/rails3-example/public/favicon.ico", "examples/rails3-example/public/images/rails.png", "examples/rails3-example/public/index.html", "examples/rails3-example/public/javascripts/application.js", "examples/rails3-example/public/javascripts/controls.js", "examples/rails3-example/public/javascripts/dragdrop.js", "examples/rails3-example/public/javascripts/effects.js", "examples/rails3-example/public/javascripts/isotope.js", "examples/rails3-example/public/javascripts/prototype.js", "examples/rails3-example/public/javascripts/rails.js", "examples/rails3-example/public/robots.txt", "examples/rails3-example/script/rails", "examples/rails3-example/test/functional/articles_controller_test.rb", "examples/rails3-example/test/performance/browsing_test.rb", "examples/rails3-example/test/test_helper.rb", "examples/rails3-example/test/unit/helpers/article_helper_test.rb", "examples/rails3-example/test/unit/helpers/articles_helper_test.rb", "examples/sinatra-example/server.rb", "lib/isotope.js", "lib/isotope.rb", "lib/version.rb", "test/article.ejs", "test/isotope_spec.rb", "Manifest", "isotope.gemspec"]
+ s.homepage = %q{http://github.com/elado/isotope}
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Isotope", "--main", "README.md"]
+ s.require_paths = ["lib"]
+ s.rubyforge_project = %q{isotope}
+ s.rubygems_version = %q{1.3.7}
+ s.summary = %q{Ruby Hybrid (Server and Client sides) templates}
+
+ if s.respond_to? :specification_version then
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
+ s.specification_version = 3
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
+ else
+ end
+ else
+ end
+end
View
@@ -1,4 +1,4 @@
-module RubyHybridTemplates
+module Isotope
module VERSION
MAJOR = 1
MINOR = 0

0 comments on commit 653eacc

Please sign in to comment.