Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

converted to gem

  • Loading branch information...
commit 784641ceddd8de6aa4a2ff00823dca8a70c4be0b 1 parent 707b614
@kristianmandrup kristianmandrup authored
Showing with 80 additions and 18 deletions.
  1. +15 −0 Gemfile
  2. +22 −2 README.textile
  3. +42 −16 Rakefile
  4. +1 −0  VERSION.yml
View
15 Gemfile
@@ -0,0 +1,15 @@
+source "http://rubygems.org"
+# Add dependencies required to use your gem here.
+# Example:
+# gem "activesupport", ">= 2.3.5"
+
+gem "rails", ">= 2.3.5"
+
+# Add dependencies to develop your gem here.
+# Include everything needed to run rake, tests, features, etc.
+group :development do
+ gem "rspec", ">= 2.3.0"
+ gem "bundler", "~> 1.0.0"
+ gem "jeweler", "~> 1.5.2"
+ gem "rcov", ">= 0"
+end
View
24 README.textile
@@ -23,11 +23,21 @@ See "localized_country_select":http://github.com/karmi/localized_country_select
h2. Install & Usage
+Install as plugin:
+
<pre>$ rails plugin install https://github.com/kristianmandrup/localized_language_select.git</pre>
-It should be converted into a gem...
+Install as gem:
+
+Insert in Gemfile
+
+<pre>gem 'localized_language_select'</pre>
-h2. Example
+Then run:
+
+<pre>$ bundle install</pre>
+
+h2. Usage example
<pre>
<%= localized_language_select(:user, :language, [], :include_blank => 'Please choose...') %>
@@ -66,6 +76,16 @@ h2. Framework usage
This plugin should also integrate nicely with various formbuilders, including Formtastic
+Formtastic example:
+
+<pre>
+<%= semantic_form_for @user do |form| %>
+ ...
+ <%= form.input :lang, :as => :language, :priority_languages => ['English'], :include_blank => 'Please choose...', :only => ['German', 'French']) %>
+ ...
+<% end %>
+</pre>
+
h2. Copyright
Copyright (c) 2009 David Cato, released under the MIT license
View
58 Rakefile
@@ -1,24 +1,50 @@
+require 'rubygems'
+require 'bundler'
+begin
+ Bundler.setup(:default, :development)
+rescue Bundler::BundlerError => e
+ $stderr.puts e.message
+ $stderr.puts "Run `bundle install` to install missing gems"
+ exit e.status_code
+end
require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
-load File.join(File.dirname(__FILE__), 'tasks', 'localized_language_select_tasks.rake')
+require 'jeweler'
+Jeweler::Tasks.new do |gem|
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
+ gem.name = "localized_language_select"
+ gem.homepage = "http://github.com/kristianmandrup/localized_language_select"
+ gem.license = "MIT"
+ gem.summary = %Q{Localized language select for Rails 2.3+}
+ gem.description = %Q{Localized language select for Rails 2.3+ with options to control languages to display}
+ gem.email = "kmandrup@gmail.com"
+ gem.authors = ["Kristian Mandrup"]
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
-desc 'Default: run unit tests.'
-task :default => :test
+ gem.add_runtime_dependency 'rails', '>= 2.3.5'
+end
+Jeweler::RubygemsDotOrgTasks.new
+
+require 'rspec/core'
+require 'rspec/core/rake_task'
+RSpec::Core::RakeTask.new(:spec) do |spec|
+ spec.pattern = FileList['spec/**/*_spec.rb']
+end
-desc 'Test the localized_language_select plugin.'
-Rake::TestTask.new(:test) do |t|
- t.libs << 'lib'
- t.pattern = 'test/**/*_test.rb'
- t.verbose = true
+RSpec::Core::RakeTask.new(:rcov) do |spec|
+ spec.pattern = 'spec/**/*_spec.rb'
+ spec.rcov = true
end
-desc 'Generate documentation for the localized_language_select plugin.'
-Rake::RDocTask.new(:rdoc) do |rdoc|
+task :default => :spec
+
+require 'rake/rdoctask'
+Rake::RDocTask.new do |rdoc|
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
+
rdoc.rdoc_dir = 'rdoc'
- rdoc.title = 'LocalizedLanguageSelect'
- rdoc.options << '--line-numbers' << '--inline-source'
- rdoc.rdoc_files.include('README.rdoc')
+ rdoc.title = "localized_language_select #{version}"
+ rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
-end
+end
View
1  VERSION.yml
@@ -0,0 +1 @@
+0.1.0
Please sign in to comment.
Something went wrong with that request. Please try again.