Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Turn into Rails Engine.

  • Loading branch information...
commit ad7b63bac731f9bb8300a56ae303b8aee4c4485e 1 parent e3e5150
@marcandre marcandre authored
View
20 .gitignore
@@ -1,3 +1,17 @@
-/pkg
-/doc
-*.gem
+*.gem
+*.rbc
+.bundle
+.config
+.yardoc
+Gemfile.lock
+InstalledFiles
+_yardoc
+coverage
+doc/
+lib/bundler/man
+pkg
+rdoc
+spec/reports
+test/tmp
+test/version_tmp
+tmp
View
4 History.txt
@@ -1,3 +1,7 @@
+== Version 2.0.0
+
+Engine for Rails 3.1+
+
== Version 1.16.4
* do not add to public if they are in app/assets. (Michael Grosser)
* action view helpers needs to be loaded first in order to as gem. (Sandip Ransing)
View
42 Manifest.txt
@@ -1,42 +0,0 @@
-History.txt
-init.rb
-js_test/functional/cds_test.html
-js_test/prototype.js
-js_test/test.css
-js_test/unit/cds_helper_methods.html
-js_test/unittest.js
-lib/calendar_date_select/calendar_date_select.rb
-lib/calendar_date_select/includes_helper.rb
-lib/calendar_date_select/form_helpers.rb
-lib/calendar_date_select.rb
-Manifest.txt
-MIT-LICENSE
-public/blank_iframe.html
-public/images/calendar_date_select/calendar.gif
-public/javascripts/calendar_date_select/calendar_date_select.js
-public/javascripts/calendar_date_select/format_american.js
-public/javascripts/calendar_date_select/format_db.js
-public/javascripts/calendar_date_select/format_euro_24hr.js
-public/javascripts/calendar_date_select/format_euro_24hr_ymd.js
-public/javascripts/calendar_date_select/format_finnish.js
-public/javascripts/calendar_date_select/format_hyphen_ampm.js
-public/javascripts/calendar_date_select/format_iso_date.js
-public/javascripts/calendar_date_select/format_italian.js
-public/javascripts/calendar_date_select/locale/de.js
-public/javascripts/calendar_date_select/locale/fi.js
-public/javascripts/calendar_date_select/locale/fr.js
-public/javascripts/calendar_date_select/locale/pl.js
-public/javascripts/calendar_date_select/locale/pt.js
-public/javascripts/calendar_date_select/locale/ru.js
-public/stylesheets/calendar_date_select/blue.css
-public/stylesheets/calendar_date_select/default.css
-public/stylesheets/calendar_date_select/plain.css
-public/stylesheets/calendar_date_select/red.css
-public/stylesheets/calendar_date_select/silver.css
-Rakefile
-README.txt
-spec/
-spec/calendar_date_select
-spec/calendar_date_select/calendar_date_select_spec.rb
-spec/calendar_date_select/form_helpers_spec.rb
-spec/spec_helper.rb
View
4 README.txt → README.md
@@ -1,8 +1,8 @@
= CalendarDateSelect
-http://code.google.com/p/calendardateselect/
+Legacy support as a Rails 3.1+ Engine
-* This project is looking for a new maintainer. Please contact me if you have sufficient interest in this project to move it forward.
+http://code.google.com/p/calendardateselect/
== Examples
View
41 Rakefile
@@ -1,37 +1,8 @@
-# -*- ruby -*-
+require "bundler/gem_tasks"
-
-begin
- require 'rubygems'
- require 'jeweler'
- Jeweler::Tasks.new do |gemspec|
- gemspec.name = "calendar_date_select"
- gemspec.version = File.read("VERSION").strip
- gemspec.summary = "Calendar date picker for rails"
- gemspec.description = "Calendar date picker for rails"
- gemspec.email = ""
- gemspec.homepage = "http://github.com/timcharper/calendar_date_select"
- gemspec.authors = ["Shih-gian Lee", "Enrique Garcia Cota (kikito)", "Tim Charper", "Lars E. Hoeg"]
- end
-rescue LoadError
- puts "Jeweler not available. Install it with: sudo gem install jeweler"
-end
-
-desc "Set the current gem version in the code according to the VERSION file"
-task :set_version do
- VERSION=File.read("VERSION").strip
- ["lib/calendar_date_select/calendar_date_select.rb", "public/javascripts/calendar_date_select/calendar_date_select.js"].each do |file|
- abs_file = File.dirname(__FILE__) + "/" + file
- src = File.read(abs_file)
- src = src.map do |line|
- case line
- when /^ *VERSION/ then " VERSION = '#{VERSION}'\n"
- when /^\/\/ CalendarDateSelect version / then "// CalendarDateSelect version #{VERSION} - a prototype based date picker\n"
- else
- line
- end
- end.join
- File.open(abs_file, "wb") { |f| f << src }
- end
+require 'rake/testtask'
+Rake::TestTask.new(:test) do |test|
+ test.libs << 'lib' << 'test'
+ test.pattern = 'test/**/*_test.rb'
+ test.verbose = false
end
-# vim: syntax=Ruby
View
2  lib/calendar_date_select/form_helpers.rb → app/helpers/calendar_date_select/form_helpers.rb
@@ -143,7 +143,7 @@ def calendar_date_select(object, method, options={})
end
end
- tag = ActionView::Helpers::InstanceTag.new_with_backwards_compatibility(object, method, self, options.delete(:object))
+ tag = ActionView::Helpers::InstanceTag.new(object, method, self, options.delete(:object))
calendar_date_select_output(
tag.to_input_field_tag( (javascript_options[:hidden] || javascript_options[:embedded]) ? "hidden" : "text", options),
image,
View
0  lib/calendar_date_select/includes_helper.rb → app/helpers/calendar_date_select/includes_helper.rb
File renamed without changes
View
110 calendar_date_select.gemspec
@@ -1,94 +1,26 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE DIRECTLY
-# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
-# -*- encoding: utf-8 -*-
+# coding: utf-8
+lib = File.expand_path('../lib', __FILE__)
+$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
+require 'calendar_date_select/version'
-Gem::Specification.new do |s|
- s.name = %q{calendar_date_select}
- s.version = "1.16.4"
+Gem::Specification.new do |spec|
+ spec.name = "calendar_date_select"
+ spec.version = CalendarDateSelect::VERSION
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["Shih-gian Lee", "Enrique Garcia Cota (kikito)", "Tim Charper", "Lars E. Hoeg"]
- s.description = %q{Calendar date picker for rails}
- s.email = %q{}
- s.extra_rdoc_files = [
- "README.txt"
- ]
- s.files = [
- ".gitignore",
- "History.txt",
- "MIT-LICENSE",
- "Manifest.txt",
- "README.txt",
- "Rakefile",
- "VERSION",
- "calendar_date_select.gemspec",
- "init.rb",
- "js_test/functional/.tmp_cds_test.html",
- "js_test/functional/cds_test.html",
- "js_test/functional/format_iso_date_test.html",
- "js_test/prototype.js",
- "js_test/test.css",
- "js_test/unit/cds_helper_methods.html",
- "js_test/unittest.js",
- "lib/calendar_date_select.rb",
- "lib/calendar_date_select/calendar_date_select.rb",
- "lib/calendar_date_select/form_helpers.rb",
- "lib/calendar_date_select/includes_helper.rb",
- "public/blank_iframe.html",
- "public/images/calendar_date_select/calendar.gif",
- "public/javascripts/calendar_date_select/calendar_date_select.js",
- "public/javascripts/calendar_date_select/format_american.js",
- "public/javascripts/calendar_date_select/format_danish.js",
- "public/javascripts/calendar_date_select/format_db.js",
- "public/javascripts/calendar_date_select/format_euro_24hr.js",
- "public/javascripts/calendar_date_select/format_euro_24hr_ymd.js",
- "public/javascripts/calendar_date_select/format_finnish.js",
- "public/javascripts/calendar_date_select/format_hyphen_ampm.js",
- "public/javascripts/calendar_date_select/format_iso_date.js",
- "public/javascripts/calendar_date_select/format_italian.js",
- "public/javascripts/calendar_date_select/locale/ar.js",
- "public/javascripts/calendar_date_select/locale/da.js",
- "public/javascripts/calendar_date_select/locale/de.js",
- "public/javascripts/calendar_date_select/locale/es.js",
- "public/javascripts/calendar_date_select/locale/fi.js",
- "public/javascripts/calendar_date_select/locale/fr.js",
- "public/javascripts/calendar_date_select/locale/it.js",
- "public/javascripts/calendar_date_select/locale/nl.js",
- "public/javascripts/calendar_date_select/locale/pl.js",
- "public/javascripts/calendar_date_select/locale/pt.js",
- "public/javascripts/calendar_date_select/locale/ru.js",
- "public/javascripts/calendar_date_select/locale/sl.js",
- "public/stylesheets/calendar_date_select/blue.css",
- "public/stylesheets/calendar_date_select/default.css",
- "public/stylesheets/calendar_date_select/green.css",
- "public/stylesheets/calendar_date_select/plain.css",
- "public/stylesheets/calendar_date_select/red.css",
- "public/stylesheets/calendar_date_select/silver.css",
- "spec/calendar_date_select/calendar_date_select_spec.rb",
- "spec/calendar_date_select/form_helpers_spec.rb",
- "spec/calendar_date_select/includes_helper_spec.rb",
- "spec/spec_helper.rb"
- ]
- s.homepage = %q{http://github.com/timcharper/calendar_date_select}
- s.rdoc_options = ["--charset=UTF-8"]
- s.require_paths = ["lib"]
- s.rubygems_version = %q{1.3.6}
- s.summary = %q{Calendar date picker for rails}
- s.test_files = [
- "spec/calendar_date_select/calendar_date_select_spec.rb",
- "spec/calendar_date_select/form_helpers_spec.rb",
- "spec/calendar_date_select/includes_helper_spec.rb",
- "spec/spec_helper.rb"
- ]
+ spec.authors = ["Shih-gian Lee", "Enrique Garcia Cota (kikito)", "Tim Charper", "Lars E. Hoeg", "Marc-André Lafortune"]
+ spec.email = ["github@marc-andre.ca"]
+ spec.description = %q{Calendar date picker for rails}
+ spec.summary = %q{Calendar date picker for rails}
+ spec.homepage = "http://github.com/marcandre/calendar_date_select"
+ spec.license = "MIT"
- if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
- s.specification_version = 3
+ spec.files = `git ls-files`.split($/)
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
+ spec.require_paths = ["lib"]
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
- else
- end
- else
- end
+ spec.add_dependency "rails", ">= 3.1"
+
+ spec.add_development_dependency "bundler", "~> 1.3"
+ spec.add_development_dependency "rake"
end
View
1  init.rb
@@ -1 +0,0 @@
-require File.dirname(__FILE__) + "/lib/calendar_date_select.rb"
View
38 lib/calendar_date_select.rb
@@ -1,34 +1,14 @@
-require "calendar_date_select/calendar_date_select.rb"
-require "calendar_date_select/form_helpers.rb"
-require "calendar_date_select/includes_helper.rb"
+require "calendar_date_select/version"
+require "calendar_date_select/calendar_date_select"
require "action_view/helpers"
-if Object.const_defined?(:Rails) && File.directory?(Rails.root.to_s + "/public")
- ActionView::Helpers::FormHelper.send(:include, CalendarDateSelect::FormHelpers)
- ActionView::Base.send(:include, CalendarDateSelect::FormHelpers)
- ActionView::Base.send(:include, CalendarDateSelect::IncludesHelper)
-
- # Filthy backwards compatibility hooks... grumble
- if ([Rails::VERSION::MAJOR, Rails::VERSION::MINOR] <=> [2, 2]) == -1
- ActionView::Helpers::InstanceTag.class_eval do
- def self.new_with_backwards_compatibility(object_name, method_name, template_object, object = nil)
- new(object_name, method_name, template_object, nil, object)
- end
- end
-
- else
- ActionView::Helpers::InstanceTag.class_eval do
- class << self; alias new_with_backwards_compatibility new; end
- end
- end
-
- # install files
- if !File.exists?(RAILS_ROOT + '/public/javascripts/calendar_date_select/calendar_date_select.js') and !File.exists?(RAILS_ROOT + '/app/assets/javascripts/calendar_date_select/calendar_date_select.js')
- ['/public', '/public/javascripts/calendar_date_select', '/public/stylesheets/calendar_date_select', '/public/images/calendar_date_select', '/public/javascripts/calendar_date_select/locale'].each do |dir|
- source = File.dirname(__FILE__) + "/../#{dir}"
- dest = RAILS_ROOT + dir
- FileUtils.mkdir_p(dest)
- FileUtils.cp(Dir.glob(source+'/*.*'), dest)
+module CalendarDateSelect
+ class Engine < Rails::Engine
+ # Thanks to http://robots.thoughtbot.com/post/159805560/tips-for-writing-your-own-rails-engine for:
+ config.to_prepare do
+ ActionView::Helpers::FormHelper.send(:include, CalendarDateSelect::FormHelpers)
+ ActionView::Helpers.send :include, CalendarDateSelect::FormHelpers
+ ActionView::Helpers.send :include, CalendarDateSelect::IncludesHelper
end
end
end
View
2  lib/calendar_date_select/calendar_date_select.rb
@@ -1,6 +1,4 @@
module CalendarDateSelect
- VERSION = '1.16.2'
-
FORMATS = {
:natural => {
:date => "%B %d, %Y",
View
3  lib/calendar_date_select/version.rb
@@ -0,0 +1,3 @@
+module CalendarDateSelect
+ VERSION = "2.0.0"
+end
Please sign in to comment.
Something went wrong with that request. Please try again.