anytime 0.0.8 → 0.0.9
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/lib/anytime.rb +2 -0
 - data/lib/config/initializer.rb +9 -0
 - data/lib/config/routes.rb +11 -0
 - data/lib/generators/install_generator.rb +21 -0
 - metadata +5 -3
 - data/config/routes.rb +0 -5
 
    
        data/lib/anytime.rb
    CHANGED
    
    
| 
         @@ -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. 
     | 
| 
      
 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- 
     | 
| 
      
 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/ 
     | 
| 
      
 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: 
         
     |