merb-jquery 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +20 -0
 - data/README +24 -0
 - data/Rakefile +59 -0
 - data/TODO +5 -0
 - data/lib/merb-jquery.rb +33 -0
 - data/lib/merb-jquery/merbtasks.rb +25 -0
 - metadata +70 -0
 
    
        data/LICENSE
    ADDED
    
    | 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Copyright (c) 2008 Michael D. Ivey
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining
         
     | 
| 
      
 4 
     | 
    
         
            +
            a copy of this software and associated documentation files (the
         
     | 
| 
      
 5 
     | 
    
         
            +
            "Software"), to deal in the Software without restriction, including
         
     | 
| 
      
 6 
     | 
    
         
            +
            without limitation the rights to use, copy, modify, merge, publish,
         
     | 
| 
      
 7 
     | 
    
         
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         
     | 
| 
      
 8 
     | 
    
         
            +
            permit persons to whom the Software is furnished to do so, subject to
         
     | 
| 
      
 9 
     | 
    
         
            +
            the following conditions:
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be
         
     | 
| 
      
 12 
     | 
    
         
            +
            included in all copies or substantial portions of the Software.
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         
     | 
| 
      
 15 
     | 
    
         
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         
     | 
| 
      
 16 
     | 
    
         
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         
     | 
| 
      
 17 
     | 
    
         
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         
     | 
| 
      
 18 
     | 
    
         
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         
     | 
| 
      
 19 
     | 
    
         
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         
     | 
| 
      
 20 
     | 
    
         
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         
     | 
    
        data/README
    ADDED
    
    | 
         @@ -0,0 +1,24 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            merb-jquery
         
     | 
| 
      
 2 
     | 
    
         
            +
            ===========
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            Makes it easy to use jQuery in your application.
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            $ gem install merb-jquery
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            Add
         
     | 
| 
      
 9 
     | 
    
         
            +
              require 'merb-jquery'
         
     | 
| 
      
 10 
     | 
    
         
            +
            to your init.rb
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            $ rake merb:jquery:install
         
     | 
| 
      
 13 
     | 
    
         
            +
            Installs the latest jQuery to public/javascripts
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            In your layout, inside <head>:
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            <%= jquery %>
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            In your views:
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            <% jquery do %>
         
     | 
| 
      
 23 
     | 
    
         
            +
              $('#foo').something();
         
     | 
| 
      
 24 
     | 
    
         
            +
            <% end %>
         
     | 
    
        data/Rakefile
    ADDED
    
    | 
         @@ -0,0 +1,59 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'rake/gempackagetask'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require "extlib"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'merb-core/tasks/merb_rake_helper'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require "spec/rake/spectask"
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            ##############################################################################
         
     | 
| 
      
 8 
     | 
    
         
            +
            # Package && release
         
     | 
| 
      
 9 
     | 
    
         
            +
            ##############################################################################
         
     | 
| 
      
 10 
     | 
    
         
            +
            RUBY_FORGE_PROJECT  = "merb"
         
     | 
| 
      
 11 
     | 
    
         
            +
            PROJECT_URL         = "http://merbivore.com"
         
     | 
| 
      
 12 
     | 
    
         
            +
            PROJECT_SUMMARY     = "Merb plugin that provides jQuery support"
         
     | 
| 
      
 13 
     | 
    
         
            +
            PROJECT_DESCRIPTION = PROJECT_SUMMARY
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            GEM_AUTHOR = "Michael D. Ivey"
         
     | 
| 
      
 16 
     | 
    
         
            +
            GEM_EMAIL  = "ivey@gweezlebur.com"
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            GEM_NAME    = "merb-jquery"
         
     | 
| 
      
 19 
     | 
    
         
            +
            PKG_BUILD   = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
         
     | 
| 
      
 20 
     | 
    
         
            +
            GEM_VERSION = (Merb::MORE_VERSION rescue "0.9.4") + PKG_BUILD
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            RELEASE_NAME    = "REL #{GEM_VERSION}"
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            require "extlib/tasks/release"
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            spec = Gem::Specification.new do |s|
         
     | 
| 
      
 27 
     | 
    
         
            +
              s.rubyforge_project = RUBY_FORGE_PROJECT
         
     | 
| 
      
 28 
     | 
    
         
            +
              s.name = GEM_NAME
         
     | 
| 
      
 29 
     | 
    
         
            +
              s.version = GEM_VERSION
         
     | 
| 
      
 30 
     | 
    
         
            +
              s.platform = Gem::Platform::RUBY
         
     | 
| 
      
 31 
     | 
    
         
            +
              s.has_rdoc = true
         
     | 
| 
      
 32 
     | 
    
         
            +
              s.extra_rdoc_files = ["README", "LICENSE", 'TODO']
         
     | 
| 
      
 33 
     | 
    
         
            +
              s.summary = PROJECT_SUMMARY
         
     | 
| 
      
 34 
     | 
    
         
            +
              s.description = PROJECT_DESCRIPTION
         
     | 
| 
      
 35 
     | 
    
         
            +
              s.author = GEM_AUTHOR
         
     | 
| 
      
 36 
     | 
    
         
            +
              s.email = GEM_EMAIL
         
     | 
| 
      
 37 
     | 
    
         
            +
              s.homepage = PROJECT_URL
         
     | 
| 
      
 38 
     | 
    
         
            +
              s.add_dependency('merb-core', '>= 0.9.4')
         
     | 
| 
      
 39 
     | 
    
         
            +
              s.require_path = 'lib'
         
     | 
| 
      
 40 
     | 
    
         
            +
              s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
         
     | 
| 
      
 41 
     | 
    
         
            +
            end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            Rake::GemPackageTask.new(spec) do |pkg|
         
     | 
| 
      
 44 
     | 
    
         
            +
              pkg.gem_spec = spec
         
     | 
| 
      
 45 
     | 
    
         
            +
            end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            desc "Install the gem"
         
     | 
| 
      
 48 
     | 
    
         
            +
            task :install => [:package] do
         
     | 
| 
      
 49 
     | 
    
         
            +
              sh %{#{sudo} gem install #{install_home} pkg/#{GEM_NAME}-#{GEM_VERSION} --no-update-sources}
         
     | 
| 
      
 50 
     | 
    
         
            +
            end
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            namespace :jruby do
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
              desc "Run :package and install the resulting .gem with jruby"
         
     | 
| 
      
 55 
     | 
    
         
            +
              task :install => :package do
         
     | 
| 
      
 56 
     | 
    
         
            +
                sh %{#{sudo} jruby -S gem install #{install_home} pkg/#{GEM_NAME}-#{GEM_VERSION}.gem --no-rdoc --no-ri}
         
     | 
| 
      
 57 
     | 
    
         
            +
              end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
            end
         
     | 
    
        data/TODO
    ADDED
    
    
    
        data/lib/merb-jquery.rb
    ADDED
    
    | 
         @@ -0,0 +1,33 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Merb
         
     | 
| 
      
 2 
     | 
    
         
            +
              module JqueryMixin
         
     | 
| 
      
 3 
     | 
    
         
            +
                def jquery(string=nil, &blk)
         
     | 
| 
      
 4 
     | 
    
         
            +
                  if string 
         
     | 
| 
      
 5 
     | 
    
         
            +
                    throw_content(:for_jquery, string)
         
     | 
| 
      
 6 
     | 
    
         
            +
                  elsif block_given?
         
     | 
| 
      
 7 
     | 
    
         
            +
                    throw_content(:for_jquery, &blk)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  else
         
     | 
| 
      
 9 
     | 
    
         
            +
                    catch_content :for_jquery
         
     | 
| 
      
 10 
     | 
    
         
            +
                  end
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
            end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            # make sure we're running inside Merb
         
     | 
| 
      
 16 
     | 
    
         
            +
            if defined?(Merb::Plugins)
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              # Merb gives you a Merb::Plugins.config hash...feel free to put your stuff in your piece of it
         
     | 
| 
      
 19 
     | 
    
         
            +
              #Merb::Plugins.config[:merb_jquery] = {
         
     | 
| 
      
 20 
     | 
    
         
            +
              #  :merb_best_framework_ever => true
         
     | 
| 
      
 21 
     | 
    
         
            +
              #}
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              Merb::BootLoader.before_app_loads do
         
     | 
| 
      
 24 
     | 
    
         
            +
                # require code that must be loaded before the application
         
     | 
| 
      
 25 
     | 
    
         
            +
                Merb::Controller.send(:include, Merb::JqueryMixin)
         
     | 
| 
      
 26 
     | 
    
         
            +
              end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
              Merb::BootLoader.after_app_loads do
         
     | 
| 
      
 29 
     | 
    
         
            +
                # code that can be required after the application loads
         
     | 
| 
      
 30 
     | 
    
         
            +
              end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
              Merb::Plugins.add_rakefiles "merb-jquery/merbtasks"
         
     | 
| 
      
 33 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            namespace :merb do
         
     | 
| 
      
 2 
     | 
    
         
            +
              namespace :jquery do
         
     | 
| 
      
 3 
     | 
    
         
            +
                download_location = "http://jqueryjs.googlecode.com/files"
         
     | 
| 
      
 4 
     | 
    
         
            +
                latest_version = "1.2.6"
         
     | 
| 
      
 5 
     | 
    
         
            +
                task :required_stuff do
         
     | 
| 
      
 6 
     | 
    
         
            +
                  require 'uri'
         
     | 
| 
      
 7 
     | 
    
         
            +
                  require 'net/http'
         
     | 
| 
      
 8 
     | 
    
         
            +
                  mkdir_p "public" / "javascripts"    
         
     | 
| 
      
 9 
     | 
    
         
            +
                end
         
     | 
| 
      
 10 
     | 
    
         
            +
                
         
     | 
| 
      
 11 
     | 
    
         
            +
                desc "Install uncompressed jQuery to public/javascripts/"
         
     | 
| 
      
 12 
     | 
    
         
            +
                task :install => :required_stuff do
         
     | 
| 
      
 13 
     | 
    
         
            +
                  File.open("public" / "javascripts" / "jquery.js", "w+") do |f|
         
     | 
| 
      
 14 
     | 
    
         
            +
                    f.write(Net::HTTP.get(URI.parse("#{download_location}/jquery-#{latest_version}.js")))
         
     | 
| 
      
 15 
     | 
    
         
            +
                  end
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                desc "Install minified jQuery to public/javascripts/"
         
     | 
| 
      
 19 
     | 
    
         
            +
                task :install_minified => :required_stuff do
         
     | 
| 
      
 20 
     | 
    
         
            +
                  File.open("public" / "javascripts" / "jquery.js", "w+") do |f|
         
     | 
| 
      
 21 
     | 
    
         
            +
                    f.write(Net::HTTP.get(URI.parse("#{download_location}/jquery-#{latest_version}.min.js")))
         
     | 
| 
      
 22 
     | 
    
         
            +
                  end
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,70 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification 
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: merb-jquery
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version 
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.9.4
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors: 
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Michael D. Ivey
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2008-08-13 00:00:00 +03:00
         
     | 
| 
      
 13 
     | 
    
         
            +
            default_executable: 
         
     | 
| 
      
 14 
     | 
    
         
            +
            dependencies: 
         
     | 
| 
      
 15 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 16 
     | 
    
         
            +
              name: merb-core
         
     | 
| 
      
 17 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 18 
     | 
    
         
            +
              version_requirement: 
         
     | 
| 
      
 19 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 20 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 21 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 22 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 23 
     | 
    
         
            +
                    version: 0.9.4
         
     | 
| 
      
 24 
     | 
    
         
            +
                version: 
         
     | 
| 
      
 25 
     | 
    
         
            +
            description: Merb plugin that provides jQuery support
         
     | 
| 
      
 26 
     | 
    
         
            +
            email: ivey@gweezlebur.com
         
     | 
| 
      
 27 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            extra_rdoc_files: 
         
     | 
| 
      
 32 
     | 
    
         
            +
            - README
         
     | 
| 
      
 33 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
      
 34 
     | 
    
         
            +
            - TODO
         
     | 
| 
      
 35 
     | 
    
         
            +
            files: 
         
     | 
| 
      
 36 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
      
 37 
     | 
    
         
            +
            - README
         
     | 
| 
      
 38 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 39 
     | 
    
         
            +
            - TODO
         
     | 
| 
      
 40 
     | 
    
         
            +
            - lib/merb-jquery
         
     | 
| 
      
 41 
     | 
    
         
            +
            - lib/merb-jquery/merbtasks.rb
         
     | 
| 
      
 42 
     | 
    
         
            +
            - lib/merb-jquery.rb
         
     | 
| 
      
 43 
     | 
    
         
            +
            has_rdoc: true
         
     | 
| 
      
 44 
     | 
    
         
            +
            homepage: http://merbivore.com
         
     | 
| 
      
 45 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 46 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            require_paths: 
         
     | 
| 
      
 49 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 50 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 51 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 52 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 53 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 54 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
      
 55 
     | 
    
         
            +
              version: 
         
     | 
| 
      
 56 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 58 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 59 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 60 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
      
 61 
     | 
    
         
            +
              version: 
         
     | 
| 
      
 62 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
            rubyforge_project: merb
         
     | 
| 
      
 65 
     | 
    
         
            +
            rubygems_version: 1.2.0
         
     | 
| 
      
 66 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 67 
     | 
    
         
            +
            specification_version: 2
         
     | 
| 
      
 68 
     | 
    
         
            +
            summary: Merb plugin that provides jQuery support
         
     | 
| 
      
 69 
     | 
    
         
            +
            test_files: []
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     |