acts_as_hasselhoff 0.0.1
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.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +85 -0
- data/MIT-LICENSE +20 -0
- data/README.md +50 -0
- data/Rakefile +21 -0
- data/acts_as_hasselhoff.gemspec +22 -0
- data/bin/play +0 -0
- data/data/sounds/theme.m4a +0 -0
- data/lib/acts_as_hasselhoff/puts_slowly.rb +20 -0
- data/lib/acts_as_hasselhoff/version.rb +3 -0
- data/lib/acts_as_hasselhoff.rb +23 -0
- data/lib/tasks/acts_as_hasselhoff_tasks.rake +4 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2e1748a26d4ad7eddc42ed69e040b8f117e55db7
|
4
|
+
data.tar.gz: 506b94d60d1ba08273c83d63031067402c7b5b11
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4d1caa6ed6b68b138dc1c4425eb026325c0360d6fdc32b42ac5628b33b2eb052755e0ebab7a7a0e4e2a7b6e23e8ac5e61ac30f35284dc2ae9c5c5c277fd54e57
|
7
|
+
data.tar.gz: d6e65431c08d6d6de66a85767f099a160de0a0d19de07cea691af61b8fb320acc3a43d7aa29cfeaa7871de9216720950c0aabf1924e98d8c2cb7ce08b8985d46
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
.DS_Store
|
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
# Declare your gem's dependencies in acts_as_hasselhoff.gemspec.
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
5
|
+
# development dependencies will be added by default to the :development group.
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
# Declare any dependencies that are still in development here instead of in
|
9
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
10
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
11
|
+
# your gem to rubygems.org.
|
12
|
+
|
13
|
+
# To use debugger
|
14
|
+
# gem 'debugger'
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
acts_as_hasselhoff (0.0.1)
|
5
|
+
rails (~> 4.1.8)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionmailer (4.1.8)
|
11
|
+
actionpack (= 4.1.8)
|
12
|
+
actionview (= 4.1.8)
|
13
|
+
mail (~> 2.5, >= 2.5.4)
|
14
|
+
actionpack (4.1.8)
|
15
|
+
actionview (= 4.1.8)
|
16
|
+
activesupport (= 4.1.8)
|
17
|
+
rack (~> 1.5.2)
|
18
|
+
rack-test (~> 0.6.2)
|
19
|
+
actionview (4.1.8)
|
20
|
+
activesupport (= 4.1.8)
|
21
|
+
builder (~> 3.1)
|
22
|
+
erubis (~> 2.7.0)
|
23
|
+
activemodel (4.1.8)
|
24
|
+
activesupport (= 4.1.8)
|
25
|
+
builder (~> 3.1)
|
26
|
+
activerecord (4.1.8)
|
27
|
+
activemodel (= 4.1.8)
|
28
|
+
activesupport (= 4.1.8)
|
29
|
+
arel (~> 5.0.0)
|
30
|
+
activesupport (4.1.8)
|
31
|
+
i18n (~> 0.6, >= 0.6.9)
|
32
|
+
json (~> 1.7, >= 1.7.7)
|
33
|
+
minitest (~> 5.1)
|
34
|
+
thread_safe (~> 0.1)
|
35
|
+
tzinfo (~> 1.1)
|
36
|
+
arel (5.0.1.20140414130214)
|
37
|
+
builder (3.2.2)
|
38
|
+
erubis (2.7.0)
|
39
|
+
hike (1.2.3)
|
40
|
+
i18n (0.6.11)
|
41
|
+
json (1.8.1)
|
42
|
+
mail (2.6.3)
|
43
|
+
mime-types (>= 1.16, < 3)
|
44
|
+
mime-types (2.4.3)
|
45
|
+
minitest (5.4.3)
|
46
|
+
multi_json (1.10.1)
|
47
|
+
rack (1.5.2)
|
48
|
+
rack-test (0.6.2)
|
49
|
+
rack (>= 1.0)
|
50
|
+
rails (4.1.8)
|
51
|
+
actionmailer (= 4.1.8)
|
52
|
+
actionpack (= 4.1.8)
|
53
|
+
actionview (= 4.1.8)
|
54
|
+
activemodel (= 4.1.8)
|
55
|
+
activerecord (= 4.1.8)
|
56
|
+
activesupport (= 4.1.8)
|
57
|
+
bundler (>= 1.3.0, < 2.0)
|
58
|
+
railties (= 4.1.8)
|
59
|
+
sprockets-rails (~> 2.0)
|
60
|
+
railties (4.1.8)
|
61
|
+
actionpack (= 4.1.8)
|
62
|
+
activesupport (= 4.1.8)
|
63
|
+
rake (>= 0.8.7)
|
64
|
+
thor (>= 0.18.1, < 2.0)
|
65
|
+
rake (10.4.0)
|
66
|
+
sprockets (2.12.3)
|
67
|
+
hike (~> 1.2)
|
68
|
+
multi_json (~> 1.0)
|
69
|
+
rack (~> 1.0)
|
70
|
+
tilt (~> 1.1, != 1.3.0)
|
71
|
+
sprockets-rails (2.2.1)
|
72
|
+
actionpack (>= 3.0)
|
73
|
+
activesupport (>= 3.0)
|
74
|
+
sprockets (>= 2.8, < 4.0)
|
75
|
+
thor (0.19.1)
|
76
|
+
thread_safe (0.3.4)
|
77
|
+
tilt (1.4.1)
|
78
|
+
tzinfo (1.2.2)
|
79
|
+
thread_safe (~> 0.1)
|
80
|
+
|
81
|
+
PLATFORMS
|
82
|
+
ruby
|
83
|
+
|
84
|
+
DEPENDENCIES
|
85
|
+
acts_as_hasselhoff!
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2014 YOURNAME
|
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,50 @@
|
|
1
|
+
# Acts As Hasselhoff
|
2
|
+
|
3
|
+

|
4
|
+
|
5
|
+
Your application is now powered by HOFF!!!
|
6
|
+
|
7
|
+
CAUTION: with great chest hair comes great responsibility.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your Rails application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'acts_as_hasselhoff'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Once the gem is part of your Rails app it's pretty simple to use.
|
24
|
+
|
25
|
+
Just find a model you would like to have act as Hasselhoff and add:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
# app/models/post.rb
|
29
|
+
|
30
|
+
class Post < ActiveRecord::Base
|
31
|
+
acts_as_hasselhoff
|
32
|
+
end
|
33
|
+
```
|
34
|
+
|
35
|
+
Now go save a `Post`.
|
36
|
+
|
37
|
+
## Demo
|
38
|
+
Coming soon...
|
39
|
+
|
40
|
+
## The Truth
|
41
|
+
The hoff idea was stolen from [James Adam](http://lazyatom.com/)'s original [acts_as_hasselhoff plugin](https://github.com/lazyatom/acts_as_hasselhoff). I felt the burning need to make it work with Rails 4 and above so here it is.
|
42
|
+
|
43
|
+
|
44
|
+
## Contributing
|
45
|
+
|
46
|
+
1. Fork it ( https://github.com/mariozig/acts_as_hasselhoff/fork )
|
47
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
48
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
49
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
50
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'ActsAsHasselhoff'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
Bundler::GemHelper.install_tasks
|
21
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'acts_as_hasselhoff/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'acts_as_hasselhoff'
|
8
|
+
spec.version = ActsAsHasselhoff::VERSION
|
9
|
+
spec.authors = ['James Adam', 'Mario Zigliotto']
|
10
|
+
spec.email = ['mariozig@gmail.com']
|
11
|
+
spec.homepage = 'https://github.com/mariozig/acts_as_hasselhoff/'
|
12
|
+
spec.summary = 'You know it. You love it. Still on Github. As dumb as ever.'
|
13
|
+
spec.description = 'Injects Hoff-based magic into your Rails application.'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_dependency 'rails', '~> 4.1', '>= 4.1.8'
|
22
|
+
end
|
data/bin/play
ADDED
Binary file
|
Binary file
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module ActsAsHasselhoff
|
2
|
+
class PutsSlowly
|
3
|
+
attr_reader :strang
|
4
|
+
|
5
|
+
def initialize(strang)
|
6
|
+
@strang = strang
|
7
|
+
end
|
8
|
+
|
9
|
+
def run(speed = 5.0)
|
10
|
+
thr = Thread.new do
|
11
|
+
@strang.length.times do |i|
|
12
|
+
print "\r#{@strang[0..i]}"
|
13
|
+
sleep(rand / speed)
|
14
|
+
STDOUT.flush
|
15
|
+
end
|
16
|
+
end
|
17
|
+
thr.run
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'acts_as_hasselhoff/puts_slowly'
|
2
|
+
|
3
|
+
module ActsAsHasselhoff
|
4
|
+
def acts_as_hasselhoff
|
5
|
+
include InstanceMethods
|
6
|
+
before_save :play_watch
|
7
|
+
end
|
8
|
+
|
9
|
+
module InstanceMethods
|
10
|
+
def play_watch
|
11
|
+
gem_root = Gem::Specification.find_by_name('acts_as_hasselhoff').gem_dir
|
12
|
+
play_bin = File.join(gem_root, 'bin', 'play')
|
13
|
+
theme_song = File.join(gem_root, 'data', 'sounds', 'theme.m4a')
|
14
|
+
|
15
|
+
Process.spawn("#{play_bin} #{theme_song}")
|
16
|
+
|
17
|
+
message = PutsSlowly.new('Saving ... in ... slow ... motion ...')
|
18
|
+
message.run(1.0)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
ActiveRecord::Base.extend ActsAsHasselhoff
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: acts_as_hasselhoff
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Adam
|
8
|
+
- Mario Zigliotto
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-11-28 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '4.1'
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 4.1.8
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
requirements:
|
28
|
+
- - "~>"
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '4.1'
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 4.1.8
|
34
|
+
description: Injects Hoff-based magic into your Rails application.
|
35
|
+
email:
|
36
|
+
- mariozig@gmail.com
|
37
|
+
executables:
|
38
|
+
- play
|
39
|
+
extensions: []
|
40
|
+
extra_rdoc_files: []
|
41
|
+
files:
|
42
|
+
- ".gitignore"
|
43
|
+
- Gemfile
|
44
|
+
- Gemfile.lock
|
45
|
+
- MIT-LICENSE
|
46
|
+
- README.md
|
47
|
+
- Rakefile
|
48
|
+
- acts_as_hasselhoff.gemspec
|
49
|
+
- bin/play
|
50
|
+
- data/sounds/theme.m4a
|
51
|
+
- lib/acts_as_hasselhoff.rb
|
52
|
+
- lib/acts_as_hasselhoff/puts_slowly.rb
|
53
|
+
- lib/acts_as_hasselhoff/version.rb
|
54
|
+
- lib/tasks/acts_as_hasselhoff_tasks.rake
|
55
|
+
homepage: https://github.com/mariozig/acts_as_hasselhoff/
|
56
|
+
licenses:
|
57
|
+
- MIT
|
58
|
+
metadata: {}
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
requirements: []
|
74
|
+
rubyforge_project:
|
75
|
+
rubygems_version: 2.4.3
|
76
|
+
signing_key:
|
77
|
+
specification_version: 4
|
78
|
+
summary: You know it. You love it. Still on Github. As dumb as ever.
|
79
|
+
test_files: []
|
80
|
+
has_rdoc:
|