genki-merb_timezone_select 0.0.2

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 ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 YOUR NAME
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,12 @@
1
+ merb_timezone_select
2
+ ====================
3
+
4
+ A plugin for the Merb framework that provides timezone selector
5
+
6
+ Example of use:
7
+
8
+ In a form_for block,
9
+ <%= timezone_select :timezone %>
10
+
11
+ Or you can specify ISO country code for guessing default value
12
+ <%= timezone_select :timezone, :country_code => "JP" %>
@@ -0,0 +1,52 @@
1
+ require 'rubygems'
2
+ require 'rake/gempackagetask'
3
+
4
+ require 'merb-core'
5
+ require 'merb-core/tasks/merb'
6
+
7
+ GEM_NAME = "merb_timezone_select"
8
+ GEM_VERSION = "0.0.2"
9
+ AUTHOR = "Genki Takiuchi"
10
+ EMAIL = "genki@s21g.com"
11
+ HOMEPAGE = "http://blog.s21g.com/genki"
12
+ SUMMARY = "Merb plugin that provides timezone selector"
13
+
14
+ spec = Gem::Specification.new do |s|
15
+ s.rubyforge_project = 'merb'
16
+ s.name = GEM_NAME
17
+ s.version = GEM_VERSION
18
+ s.platform = Gem::Platform::RUBY
19
+ s.has_rdoc = true
20
+ s.extra_rdoc_files = ["README", "LICENSE", 'TODO']
21
+ s.summary = SUMMARY
22
+ s.description = s.summary
23
+ s.author = AUTHOR
24
+ s.email = EMAIL
25
+ s.homepage = HOMEPAGE
26
+ s.add_dependency('merb', '>= 1.0.7.1')
27
+ s.add_dependency('tzinfo', '>= 0.3.12')
28
+ s.require_path = 'lib'
29
+ s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
30
+
31
+ end
32
+
33
+ Rake::GemPackageTask.new(spec) do |pkg|
34
+ pkg.gem_spec = spec
35
+ end
36
+
37
+ desc "install the plugin as a gem"
38
+ task :install do
39
+ Merb::RakeHelper.install(GEM_NAME, :version => GEM_VERSION)
40
+ end
41
+
42
+ desc "Uninstall the gem"
43
+ task :uninstall do
44
+ Merb::RakeHelper.uninstall(GEM_NAME, :version => GEM_VERSION)
45
+ end
46
+
47
+ desc "Create a gemspec file"
48
+ task :gemspec do
49
+ File.open("#{GEM_NAME}.gemspec", "w") do |file|
50
+ file.puts spec.to_ruby
51
+ end
52
+ end
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_timezone_select.rb
5
+ Add your Merb rake tasks to lib/merb_timezone_select/merbtasks.rb
@@ -0,0 +1,19 @@
1
+ # make sure we're running inside Merb
2
+ if defined?(Merb::Plugins)
3
+
4
+ # Merb gives you a Merb::Plugins.config hash...feel free to put your stuff in your piece of it
5
+ Merb::Plugins.config[:merb_timezone_select] = {
6
+ :chickens => false
7
+ }
8
+
9
+ Merb::BootLoader.before_app_loads do
10
+ # require code that must be loaded before the application
11
+ require "merb_timezone_select/helper.rb"
12
+ end
13
+
14
+ Merb::BootLoader.after_app_loads do
15
+ # code that can be required after the application loads
16
+ end
17
+
18
+ Merb::Plugins.add_rakefiles "merb_timezone_select/merbtasks"
19
+ end
@@ -0,0 +1,18 @@
1
+ module Merb
2
+ module GlobalHelpers
3
+ def timezone_select(name, attrs = {})
4
+ now = Time.now
5
+ options = TZInfo::Timezone.all.map do |tz|
6
+ period = tz.period_for_utc(now)
7
+ abbrev = period.abbreviation
8
+ hour = period.utc_offset.to_i / 3600
9
+ min = (period.utc_offset - hour*3600) / 60
10
+ [tz.name, "%+03d:%02d #{tz.name} (#{abbrev})" % [hour, min]]
11
+ end.sort_by{|(key, value)| value}
12
+
13
+ options.unshift([nil, "Default Time Zone"])
14
+ form_contexts.last.send :update_bound_select, name, attrs
15
+ select name, attrs.merge(:collection => options)
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,6 @@
1
+ namespace :merb_timezone_select do
2
+ desc "Do something for merb_timezone_select"
3
+ task :default do
4
+ puts "merb_timezone_select doesn't do anything"
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe "merb_timezone_select" do
4
+ it "should do nothing" do
5
+ true.should == true
6
+ end
7
+ end
@@ -0,0 +1 @@
1
+ $:.push File.join(File.dirname(__FILE__), '..', 'lib')
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: genki-merb_timezone_select
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Genki Takiuchi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-01-06 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: merb
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.0.7.1
23
+ version:
24
+ - !ruby/object:Gem::Dependency
25
+ name: tzinfo
26
+ version_requirement:
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: 0.3.12
32
+ version:
33
+ description: Merb plugin that provides timezone selector
34
+ email: genki@s21g.com
35
+ executables: []
36
+
37
+ extensions: []
38
+
39
+ extra_rdoc_files:
40
+ - README
41
+ - LICENSE
42
+ - TODO
43
+ files:
44
+ - LICENSE
45
+ - README
46
+ - Rakefile
47
+ - TODO
48
+ - lib/merb_timezone_select
49
+ - lib/merb_timezone_select/helper.rb
50
+ - lib/merb_timezone_select/merbtasks.rb
51
+ - lib/merb_timezone_select.rb
52
+ - spec/merb_timezone_select_spec.rb
53
+ - spec/spec_helper.rb
54
+ has_rdoc: true
55
+ homepage: http://blog.s21g.com/genki
56
+ post_install_message:
57
+ rdoc_options: []
58
+
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: "0"
66
+ version:
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: "0"
72
+ version:
73
+ requirements: []
74
+
75
+ rubyforge_project: merb
76
+ rubygems_version: 1.2.0
77
+ signing_key:
78
+ specification_version: 2
79
+ summary: Merb plugin that provides timezone selector
80
+ test_files: []
81
+