render_cow 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +52 -0
- data/Rakefile +18 -0
- data/config/routes.rb +3 -0
- data/lib/render_cow/engine.rb +16 -0
- data/lib/render_cow/render_cow_patch.rb +24 -0
- data/lib/render_cow/version.rb +3 -0
- data/lib/render_cow.rb +8 -0
- data/lib/tasks/render_cow_tasks.rake +4 -0
- metadata +125 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e4a2989724e7c234a8e9d62f58ee931b50c9ec6ef22c8642a2dcf9f3eddaeb69
|
4
|
+
data.tar.gz: d93dd4c5e4c62ceebb76b7f0b303c3ce7575941dd8bad9f1d5b58c73d62262f7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 53779aaef4f66110e4a55aaed41dcd74439c069e93599de26bfcac5d4175ce2a53a1f66d3d1cd2c1ab5f2b539d71576484efe1035cf3ba1e5df0498b0bcbf4b3
|
7
|
+
data.tar.gz: e93bb3b83952556b1bd1ffe56ca7c0029912c34aaf82f30cc6806a7e7dcaf6b135fde9927349eff488137411c2c0bf1b056dff3c5fcf10f552ceb19ebdf87f49
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2021 Sampo Kuokkanen
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
_____
|
2
|
+
| RenderCow |
|
3
|
+
-----
|
4
|
+
\ ^__^
|
5
|
+
\ (oo)\_______
|
6
|
+
(__)\ )\/\
|
7
|
+
||----w |
|
8
|
+
|| ||
|
9
|
+
|
10
|
+
RenderCow cowpatches the Rails render method to allow you to directly use cowsay.
|
11
|
+
Have you ever wanted to just render a cow?
|
12
|
+
Well now you can!
|
13
|
+
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
In your controller, replace calls with `render plain:` to `render cowsay:` or `render cow:`.
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
class ApplicationController < ActionController::Base
|
21
|
+
def index
|
22
|
+
render cowsay: "Moo"
|
23
|
+
end
|
24
|
+
|
25
|
+
def show
|
26
|
+
render cow: "Mooo"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
```
|
30
|
+
|
31
|
+
## Installation
|
32
|
+
Add this line to your application's Gemfile:
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
gem 'render_cow'
|
36
|
+
```
|
37
|
+
|
38
|
+
And then execute:
|
39
|
+
```bash
|
40
|
+
$ bundle
|
41
|
+
```
|
42
|
+
|
43
|
+
Or install it yourself as:
|
44
|
+
```bash
|
45
|
+
$ gem install render_cow
|
46
|
+
```
|
47
|
+
|
48
|
+
## Contributing
|
49
|
+
Feel free to contribute.
|
50
|
+
|
51
|
+
## License
|
52
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
|
3
|
+
APP_RAKEFILE = File.expand_path('test/dummy/Rakefile', __dir__)
|
4
|
+
load 'rails/tasks/engine.rake'
|
5
|
+
|
6
|
+
load 'rails/tasks/statistics.rake'
|
7
|
+
|
8
|
+
require 'bundler/gem_tasks'
|
9
|
+
|
10
|
+
require 'rake/testtask'
|
11
|
+
|
12
|
+
Rake::TestTask.new(:test) do |t|
|
13
|
+
t.libs << 'test'
|
14
|
+
t.pattern = 'test/**/*_test.rb'
|
15
|
+
t.verbose = false
|
16
|
+
end
|
17
|
+
|
18
|
+
task default: :test
|
data/config/routes.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'render_cow/render_cow_patch'
|
2
|
+
require 'cowsay'
|
3
|
+
|
4
|
+
module RenderCow
|
5
|
+
class Engine < ::Rails::Engine
|
6
|
+
isolate_namespace RenderCow
|
7
|
+
|
8
|
+
ActiveSupport.on_load(:action_view) do
|
9
|
+
ActionView::Base.prepend(RenderCow::RenderCowPatch)
|
10
|
+
end
|
11
|
+
|
12
|
+
ActiveSupport.on_load(:action_controller) do
|
13
|
+
ActionController::Base.prepend(RenderCow::RenderCowPatch)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module RenderCow
|
2
|
+
module RenderCowPatch
|
3
|
+
def render(options = {}, args = {})
|
4
|
+
options[:plain] = if cow?(options)
|
5
|
+
cowspeach(options).then { RenderCow.moo(_1) }
|
6
|
+
end
|
7
|
+
super
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def cow?(options)
|
13
|
+
options[:cow] || options[:cowsay]
|
14
|
+
end
|
15
|
+
|
16
|
+
def cowspeach(options = {})
|
17
|
+
if options.key?(:cow)
|
18
|
+
options[:cow]
|
19
|
+
elsif options.key?(:cowsay)
|
20
|
+
options[:cowsay]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/render_cow.rb
ADDED
metadata
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: render_cow
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sampo Kuokkanen
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-10-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: cowsay
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 6.1.4
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 6.1.4
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: byebug
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop-shopify
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- sampo.kuokkanen@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- MIT-LICENSE
|
91
|
+
- README.md
|
92
|
+
- Rakefile
|
93
|
+
- config/routes.rb
|
94
|
+
- lib/render_cow.rb
|
95
|
+
- lib/render_cow/engine.rb
|
96
|
+
- lib/render_cow/render_cow_patch.rb
|
97
|
+
- lib/render_cow/version.rb
|
98
|
+
- lib/tasks/render_cow_tasks.rake
|
99
|
+
homepage: https://github.com/sampokuokkanen/render_cow
|
100
|
+
licenses:
|
101
|
+
- MIT
|
102
|
+
metadata:
|
103
|
+
homepage_uri: https://github.com/sampokuokkanen/render_cow
|
104
|
+
source_code_uri: https://github.com/sampokuokkanen/render_cow
|
105
|
+
changelog_uri: https://github.com/sampokuokkanen/render_cow/blob/main/CHANGELOG.md
|
106
|
+
post_install_message:
|
107
|
+
rdoc_options: []
|
108
|
+
require_paths:
|
109
|
+
- lib
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: 2.7.0
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
requirements: []
|
121
|
+
rubygems_version: 3.2.22
|
122
|
+
signing_key:
|
123
|
+
specification_version: 4
|
124
|
+
summary: RenderCow allows you to render cows.
|
125
|
+
test_files: []
|