merb_jquery 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
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,77 @@
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.9") + 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.9')
39
+ s.require_path = 'lib'
40
+ s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib}/**/*")
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 do
49
+ Merb::RakeHelper.install(GEM_NAME, :version => GEM_VERSION)
50
+ end
51
+
52
+ desc "Uninstall the gem"
53
+ task :uninstall do
54
+ Merb::RakeHelper.uninstall(GEM_NAME, :version => GEM_VERSION)
55
+ end
56
+
57
+ desc "Create a gemspec file"
58
+ task :gemspec do
59
+ File.open("#{GEM_NAME}.gemspec", "w") do |file|
60
+ file.puts spec.to_ruby
61
+ end
62
+ end
63
+
64
+ desc "Run all examples (or a specific spec with TASK=xxxx)"
65
+ Spec::Rake::SpecTask.new('spec') do |t|
66
+ t.spec_opts = ["-cfs"]
67
+ t.spec_files = begin
68
+ if ENV["TASK"]
69
+ ENV["TASK"].split(',').map { |task| "spec/**/#{task}_spec.rb" }
70
+ else
71
+ FileList['spec/**/*_spec.rb']
72
+ end
73
+ end
74
+ end
75
+
76
+ desc 'Default: run spec examples'
77
+ task :default => 'spec'
data/TODO ADDED
@@ -0,0 +1,5 @@
1
+ TODO:
2
+ Fix LICENSE with your name
3
+ Fix Rakefile with your name and contact info
4
+ Add your code to lib/merb-haml.rb
5
+ Add your Merb rake tasks to lib/merb-haml/merbtasks.rb
@@ -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
@@ -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
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.9
5
+ platform: ruby
6
+ authors:
7
+ - Michael D. Ivey
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-10-14 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.9
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
+