gon 0.1.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of gon might be problematic. Click here for more details.

@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in evil_vk_ads.gemspec
4
+ gemspec
@@ -0,0 +1,41 @@
1
+ # Gon gem — get your Rails variables in your js
2
+
3
+ TODO: write description
4
+
5
+ ## Usage
6
+
7
+ TODO: write usage
8
+
9
+ ## Installation
10
+
11
+ Puts this line into `Gemfile` then run `$ bundle`:
12
+
13
+ ``` ruby
14
+ gem 'gon', '0.1.0'
15
+ ```
16
+
17
+ Or if you are old-school Rails 2 developer put this into `config/environment.rb` and run `$ rake gems:install`:
18
+
19
+ ``` ruby
20
+ config.gem 'gon', :version => '0.1.0'
21
+ ```
22
+
23
+ Or manually install variants gem: `$ gem install gon`
24
+
25
+ ## Contributors
26
+
27
+ * @gazay
28
+
29
+ Special thanks to @brainopia and @kossnocorp.
30
+
31
+ ## License
32
+
33
+ The MIT License
34
+
35
+ Copyright (c) 2011 gazay
36
+
37
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
38
+
39
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
40
+
41
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,4 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "gon/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "gon"
7
+ s.version = Gon::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ['gazay']
10
+ s.email = ['alex.gaziev@gmail.com']
11
+ s.homepage = ""
12
+ s.summary = %q{Get your Rails variables in your JS}
13
+ s.description = %q{If you need to send some data to your js files and you don't want to do this with long way trough views and parsing - use this force!}
14
+
15
+ s.rubyforge_project = "gon"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+ end
@@ -0,0 +1,18 @@
1
+ require 'action_view'
2
+ require 'gon/helpers'
3
+
4
+ module Gon
5
+ def self.method_missing(m, *args, &block)
6
+ gon_variables(m.to_s, args[0])
7
+ end
8
+
9
+ def self.gon_variables(name=nil, value=nil)
10
+ data = Rails.cache.read('gon_variables') || {}
11
+
12
+ new_data = {}
13
+ new_data[name] = value if name && value
14
+
15
+ Rails.cache.delete('gon_variables')
16
+ Rails.cache.write('gon_variables', (new_data.merge data))
17
+ end
18
+ end
@@ -0,0 +1,24 @@
1
+ module Gon
2
+ module Helpers
3
+ def self.included base
4
+ base.send(:include, InstanceMethods)
5
+ end
6
+
7
+ module InstanceMethods
8
+ def include_gon
9
+ javascript_include_tag 'http://gaziev.com/files/gon.js'
10
+ end
11
+
12
+ def gon_variables
13
+ data = Rails.cache.read('gon_variables') || {}
14
+
15
+ data.to_s.gsub('=>', ' : ')
16
+ end
17
+ end
18
+
19
+ end
20
+ end
21
+
22
+ module ActionView::Helpers
23
+ include Gon::Helpers
24
+ end
@@ -0,0 +1,3 @@
1
+ module Gon
2
+ VERSION = '0.1.0'
3
+ end
metadata ADDED
@@ -0,0 +1,56 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gon
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - gazay
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-05-09 00:00:00.000000000 +04:00
13
+ default_executable:
14
+ dependencies: []
15
+ description: If you need to send some data to your js files and you don't want to
16
+ do this with long way trough views and parsing - use this force!
17
+ email:
18
+ - alex.gaziev@gmail.com
19
+ executables: []
20
+ extensions: []
21
+ extra_rdoc_files: []
22
+ files:
23
+ - .gitignore
24
+ - Gemfile
25
+ - README.md
26
+ - Rakefile
27
+ - gon.gemspec
28
+ - lib/gon.rb
29
+ - lib/gon/helpers.rb
30
+ - lib/gon/version.rb
31
+ has_rdoc: true
32
+ homepage: ''
33
+ licenses: []
34
+ post_install_message:
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ! '>='
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ requirements: []
51
+ rubyforge_project: gon
52
+ rubygems_version: 1.6.2
53
+ signing_key:
54
+ specification_version: 3
55
+ summary: Get your Rails variables in your JS
56
+ test_files: []