select2-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ select2-rails-0.0.1.gem
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in select2-rails.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2012 by Rogerio Medeiros
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,32 @@
1
+ #Select2 for rails asset pipeline
2
+
3
+ [Select2](https://github.com/ivaynberg/select2) is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.
4
+
5
+
6
+ The `select2-rails` gem integrates the `Select2` with the Rails asset pipeline.
7
+
8
+ ## Usage
9
+
10
+ ### Install select2-rails gem
11
+
12
+ Add `select2-rails` in Gemfile
13
+
14
+ gem "select2-rails"
15
+
16
+ Run `bundle install`
17
+
18
+ ### Include select2-rails javascript assets
19
+
20
+ Add to your `app/assets/javascripts/application.js`
21
+
22
+ //= require select2
23
+
24
+ ### Include select2-rails stylesheet assets
25
+
26
+ Add to your `app/assets/stylesheets/application.css`
27
+
28
+ *= require select2
29
+
30
+ ## License
31
+
32
+ use MIT license.
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require File.expand_path('../lib/select2-rails/source_file', __FILE__)
4
+
5
+ desc "Update with Ivaynberg's select2 Library"
6
+ task "update-select2" do
7
+ files = SourceFile.new
8
+ files.fetch
9
+ files.convert
10
+ files.cleanup
11
+ end
@@ -0,0 +1,6 @@
1
+ module Select2
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,33 @@
1
+ require "thor"
2
+
3
+ class SourceFile < Thor
4
+ include Thor::Actions
5
+
6
+ desc "fetch source files", "fetch source files from GitHub"
7
+ def fetch
8
+ self.destination_root = "vendor/assets"
9
+ remote = "https://github.com/ivaynberg/select2"
10
+ get "#{remote}/raw/master/select2.png", "images/select2.png"
11
+ get "#{remote}/raw/master/spinner.gif", "images/spinner.gif"
12
+ get "#{remote}/raw/master/select2.css", "stylesheets/select2.css"
13
+ get "#{remote}/raw/master/select2.js", "javascripts/select2.js"
14
+ end
15
+
16
+ desc "convert css to sass file", "convert css to sass file by sass-convert"
17
+ def convert
18
+ self.destination_root = "vendor/assets"
19
+ inside destination_root do
20
+ run("sass-convert -F css -T sass stylesheets/select2.css stylesheets/select2.css.sass")
21
+ gsub_file 'stylesheets/select2.css.sass', '(spinner.gif)', "('spinner.gif')"
22
+ gsub_file 'stylesheets/select2.css.sass', '(select2.png)', "('select2.png')"
23
+ gsub_file 'stylesheets/select2.css.sass', ' url', ' image-url'
24
+ end
25
+ end
26
+
27
+ desc "clean up useless files", "clean up useless files"
28
+ def cleanup
29
+ self.destination_root = "vendor/assets"
30
+ remove_file "stylesheets/select2.css"
31
+ end
32
+
33
+ end
@@ -0,0 +1,5 @@
1
+ module Select2
2
+ module Rails
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ require "select2-rails/version"
2
+
3
+ module Select2
4
+ module Rails
5
+ require "select2-rails/engine"
6
+ end
7
+ end
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path("../lib/select2-rails/version", __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "select2-rails"
6
+ s.version = Select2::Rails::VERSION
7
+ s.authors = ["Rogerio Medeiros"]
8
+ s.email = ["argerim@gmail.com"]
9
+ s.homepage = ""
10
+ s.summary = %q{Integrate Select2 javascript library with Rails asset pipeline}
11
+ s.description = %q{Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results. This gem integrates Select2 with Rails asset pipeline for easy of use.}
12
+
13
+ s.files = `git ls-files`.split("\n")
14
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
+ s.require_paths = ["lib"]
17
+
18
+ s.add_dependency "thor", "~> 0.14"
19
+ s.add_development_dependency "bundler", "~> 1.0"
20
+ s.add_development_dependency "rails", "~> 3.0"
21
+ s.add_development_dependency "sass", "~> 3.1"
22
+ end
Binary file
Binary file