anytime 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/lib/anytime.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  require 'mocha'
2
2
  require 'app/controllers/anytime_controller'
3
3
  require 'app/helpers/anytime_helper'
4
+ require 'config/routes.rb'
5
+ require 'generators/install_generator'
4
6
 
5
7
  module Anytime
6
8
 
@@ -0,0 +1,9 @@
1
+ Anytime.setup do |config|
2
+ #Configure the returning of Time.now and Date.now
3
+ #Options: :utc and :local
4
+ config.time_mode = :utc
5
+
6
+ #Configure the supported environments
7
+ #[:development] and [:development, :staging] are recommended
8
+ config.environments = [:development]
9
+ end
@@ -0,0 +1,11 @@
1
+ require "active_support/core_ext/object/try"
2
+ require "active_support/core_ext/hash/slice"
3
+
4
+ module ActionDispatch::Routing
5
+ class Mapper
6
+ def routes_anytime_to(path_name)
7
+ match path_name.to_s => 'anytime#freeze'
8
+ match path_name.to_s => 'anytime#unfreeze'
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,21 @@
1
+ require 'securerandom'
2
+ require 'rails/generators'
3
+
4
+ module Anytime
5
+ module Generators
6
+ class InstallGenerator < Rails::Generators::Base
7
+ source_root File.expand_path("../../templates", __FILE__)
8
+
9
+ desc "Creates a Anytime initializer and copy locale files to your application."
10
+
11
+ def copy_initializer
12
+ template "../config/initializer.rb", "config/initializers/anytime.rb"
13
+ end
14
+
15
+ def insert_routes
16
+ anytime_route = "routes_anytime_to :freeze"
17
+ route anytime_route
18
+ end
19
+ end
20
+ end
21
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anytime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-02 00:00:00.000000000 Z
12
+ date: 2012-09-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mocha
@@ -37,7 +37,9 @@ files:
37
37
  - lib/anytime.rb
38
38
  - lib/app/controllers/anytime_controller.rb
39
39
  - lib/app/helpers/anytime_helper.rb
40
- - config/routes.rb
40
+ - lib/config/initializer.rb
41
+ - lib/config/routes.rb
42
+ - lib/generators/install_generator.rb
41
43
  homepage: http://rubygems.org/gems/anytime
42
44
  licenses: []
43
45
  post_install_message:
data/config/routes.rb DELETED
@@ -1,5 +0,0 @@
1
- TimeApp::Application.routes.draw do
2
-
3
- match 'freeze' => 'anytime#freeze'
4
- match 'unfreeze' => 'anytime#unfreeze'
5
- end