custom_words 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 257f3ead9bb471f80015a325664ad38883768e01
4
+ data.tar.gz: 5ef80cb05ec54771814b01e22a507a2a1904a8a0
5
+ SHA512:
6
+ metadata.gz: 8bec4ee58c59d73cc8540abafb16da8bb0ca81f45e8b639959e5979d08270665cbde3b3e541efc62786c89a7dcc2721ff01c4f0b1ade8e11c05cfe85d47d2cb7
7
+ data.tar.gz: 960776613605ed7d4382ba6c2982368dae546df6d6209dff4b7c4c14e9fbbf225dd3124c2aaaae3884c6170c59cd68dab84fec067d2c2242ba825f2c9ccd453b
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in custom_words.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 João Daniel
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # CustomWords
2
+
3
+ It allows the user to add custom words to its app.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'custom_words'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ After that, initialize your custom_words.yml file with:
18
+
19
+ $ rails generate custom_words:install
20
+
21
+ ## Usage
22
+
23
+ Add a custom word in `config/custom_words.yml` as:
24
+
25
+ ```yaml
26
+ test_word: "Test word"
27
+ ```
28
+
29
+ Use this word in your view with:
30
+
31
+ ```ruby
32
+ <%= custom :test_word %>
33
+ ```
34
+
35
+ ## Contributing
36
+
37
+ 1. Fork it ( https://github.com/[my-github-username]/custom_words/fork )
38
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
39
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
40
+ 4. Push to the branch (`git push origin my-new-feature`)
41
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'custom_words/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "custom_words"
8
+ spec.version = CustomWords::VERSION
9
+ spec.authors = ["João Daniel"]
10
+ spec.email = ["jdanielnd@gmail.com"]
11
+ spec.summary = %q{Helps user to set custom_words in yaml files and use them on the view.}
12
+ spec.homepage = "https://github.com/appprova/custom_words"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.7"
21
+ spec.add_development_dependency "rake", "~> 10.0"
22
+ spec.add_development_dependency "active_support", "~> 3.0"
23
+ end
@@ -0,0 +1,11 @@
1
+ module CustomWords
2
+ class CustomWords
3
+
4
+ CUSTOM_WORDS = YAML.load_file('config/custom_words.yml')
5
+
6
+ def self.fetch_word key
7
+ CUSTOM_WORDS.fetch(key.to_s)
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module CustomWords
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,7 @@
1
+ module CustomWords
2
+ module ViewHelpers
3
+ def custom key
4
+ CustomWords.fetch_word(key)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ require 'custom_words/custom_words'
2
+
3
+ module CustomWords
4
+ autoload :Version, "custom_words/version"
5
+ autoload :CustomWords, "custom_words/custom_words"
6
+ autoload :ViewHelpers, "custom_words/view_helpers"
7
+
8
+ ActiveSupport.on_load(:action_view) do
9
+ include ViewHelpers
10
+ end
11
+ end
@@ -0,0 +1,19 @@
1
+ require 'rails/generators/base'
2
+
3
+ module CustomWords
4
+ module Generators
5
+ class InstallGenerator < Rails::Generators::Base
6
+ source_root File.expand_path("../../templates", __FILE__)
7
+
8
+ desc "Creates a CustomWords initializer and create custom_words.yml file to your application."
9
+
10
+ # def copy_initializer
11
+ # template "custom_words.rb", "config/initializers/custom_words.rb"
12
+ # end
13
+
14
+ def copy_yaml
15
+ template "custom_words.yml", "config/custom_words.yml"
16
+ end
17
+ end
18
+ end
19
+ end
File without changes
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: custom_words
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - João Daniel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: active_support
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description:
56
+ email:
57
+ - jdanielnd@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - custom_words.gemspec
68
+ - lib/custom_words.rb
69
+ - lib/custom_words/custom_words.rb
70
+ - lib/custom_words/version.rb
71
+ - lib/custom_words/view_helpers.rb
72
+ - lib/generators/custom_words/install_generator.rb
73
+ - lib/generators/templates/custom_words.yml
74
+ homepage: https://github.com/appprova/custom_words
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.2.2
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: Helps user to set custom_words in yaml files and use them on the view.
98
+ test_files: []