easter_eggs 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4e8e433529def1c519edf64fc744191062b4ff71
4
+ data.tar.gz: e48c5ac9bb55d4abe75b433a2b2923c0e08c7771
5
+ SHA512:
6
+ metadata.gz: 3977ff405cdbd96e9c0c5dbbc45b977cc57883da334ee893a5fa0c3493962e1fd7e1ea3930afcae21b77edf3ca4bc6f0c91ad4c7496941307d48d7c49595fd54
7
+ data.tar.gz: 03bc5c304213c74e0aacf1e4f082203a85baf1424bb557a43f8d58d5bd43864e26374b6adfc69fd3f46ebdfb209c94fceb4cf6d171bac57fad456a564f17f137
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.3
5
+ before_install: gem install bundler -v 1.13.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in easter_eggs.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,58 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ easter_eggs (0.1.0)
5
+ enumerate_it
6
+ i18n
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (5.0.1)
12
+ concurrent-ruby (~> 1.0, >= 1.0.2)
13
+ i18n (~> 0.7)
14
+ minitest (~> 5.1)
15
+ tzinfo (~> 1.1)
16
+ coderay (1.1.1)
17
+ concurrent-ruby (1.0.3)
18
+ diff-lcs (1.2.5)
19
+ enumerate_it (1.4.1)
20
+ activesupport (>= 3.0.0)
21
+ i18n (0.7.0)
22
+ method_source (0.8.2)
23
+ minitest (5.10.1)
24
+ pry (0.10.4)
25
+ coderay (~> 1.1.0)
26
+ method_source (~> 0.8.1)
27
+ slop (~> 3.4)
28
+ rake (12.0.0)
29
+ rspec (3.5.0)
30
+ rspec-core (~> 3.5.0)
31
+ rspec-expectations (~> 3.5.0)
32
+ rspec-mocks (~> 3.5.0)
33
+ rspec-core (3.5.4)
34
+ rspec-support (~> 3.5.0)
35
+ rspec-expectations (3.5.0)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.5.0)
38
+ rspec-mocks (3.5.0)
39
+ diff-lcs (>= 1.2.0, < 2.0)
40
+ rspec-support (~> 3.5.0)
41
+ rspec-support (3.5.0)
42
+ slop (3.6.0)
43
+ thread_safe (0.3.5)
44
+ tzinfo (1.2.2)
45
+ thread_safe (~> 0.1)
46
+
47
+ PLATFORMS
48
+ ruby
49
+
50
+ DEPENDENCIES
51
+ bundler
52
+ easter_eggs!
53
+ pry
54
+ rake
55
+ rspec
56
+
57
+ BUNDLED WITH
58
+ 1.13.6
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Easy Bills
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # EasterEggs
2
+
3
+ Search for references in several movies, TV series, games, etc.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'easter_eggs'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install easter_eggs
20
+
21
+ ## Usage
22
+
23
+ ```ruby
24
+ EasterEggs::Search.perform 'rogue one'
25
+ {
26
+ :reference => 'star_wars',
27
+ :message => 'May the force be with you!'
28
+ }
29
+ ```
30
+
31
+ ```ruby
32
+ EasterEggs::Search.perform 'super mario'
33
+ {
34
+ :reference => 'mario',
35
+ :message => 'Mama mia!'
36
+ }
37
+ ```
38
+
39
+ ## Development
40
+
41
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
42
+
43
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
44
+
45
+ ## Contributing
46
+
47
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/easter_eggs. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
48
+
49
+
50
+ ## License
51
+
52
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'easter_eggs'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ require 'pry'
10
+ Pry.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,6 @@
1
+ en:
2
+ enumerations:
3
+ easter_eggs/universe:
4
+ star_wars: 'May the force be with you!'
5
+ mario: 'Mama mia!'
6
+ breaking_bad: 'I am not in danger. I am the danger!'
@@ -0,0 +1,6 @@
1
+ pt-BR:
2
+ enumerations:
3
+ easter_eggs/universe:
4
+ star_wars: 'Que a força esteja com você!'
5
+ mario: 'Mama mia!'
6
+ breaking_bad: 'Eu não estou em perigo. Eu sou o perigo!'
@@ -0,0 +1,31 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'easter_eggs/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'easter_eggs'
7
+ spec.version = EasterEggs::VERSION
8
+ spec.authors = 'Easy Bills'
9
+ spec.summary = 'Search for references in several movies, TV series, games, etc.'
10
+ spec.description = 'Search for references in several movies, TV series, games, etc.'
11
+ spec.homepage = 'https://github.com/easybills/easter_eggs'
12
+ spec.license = 'MIT'
13
+ spec.required_ruby_version = '>= 2.3.0'
14
+
15
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
16
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
17
+ unless spec.respond_to?(:metadata)
18
+ raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
19
+ end
20
+
21
+ spec.files = `git ls-files -z`.split("\x0").reject { |file| file.match(%r{^(spec)/}) }
22
+ spec.require_paths = ['lib']
23
+
24
+ spec.add_dependency 'enumerate_it'
25
+ spec.add_dependency 'i18n'
26
+
27
+ spec.add_development_dependency 'bundler'
28
+ spec.add_development_dependency 'pry'
29
+ spec.add_development_dependency 'rake'
30
+ spec.add_development_dependency 'rspec'
31
+ end
@@ -0,0 +1,34 @@
1
+ module EasterEggs
2
+ class Search
3
+ class << self
4
+ def perform(query)
5
+ reference = references.find do |_universe, list|
6
+ list.any? { |regex| regex =~ query.downcase }
7
+ end&.first
8
+
9
+ return if reference.nil?
10
+
11
+ {
12
+ reference: reference,
13
+ message: EasterEggs::Universe.t(reference)
14
+ }
15
+ end
16
+
17
+ private
18
+
19
+ def references
20
+ {
21
+ EasterEggs::Universe::STAR_WARS => [
22
+ /star wars/,
23
+ /force awakens/,
24
+ /rogue one/
25
+ ],
26
+
27
+ EasterEggs::Universe::MARIO => [
28
+ /super mario/
29
+ ]
30
+ }
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,12 @@
1
+ class EasterEggs::Universe < EnumerateIt::Base
2
+ associate_values(
3
+ # Movies
4
+ :star_wars,
5
+
6
+ # Games
7
+ :mario,
8
+
9
+ # TV Series
10
+ :breaking_bad
11
+ )
12
+ end
@@ -0,0 +1,3 @@
1
+ module EasterEggs
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,10 @@
1
+ require 'i18n'
2
+ I18n.load_path = Dir[File.expand_path('../../config/locales/*.yml', __FILE__)]
3
+
4
+ require 'enumerate_it'
5
+
6
+ module EasterEggs
7
+ end
8
+
9
+ require 'easter_eggs/universe'
10
+ require 'easter_eggs/search'
metadata ADDED
@@ -0,0 +1,144 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: easter_eggs
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Easy Bills
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-12-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: enumerate_it
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: i18n
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
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: pry
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: rake
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
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Search for references in several movies, TV series, games, etc.
98
+ email:
99
+ executables: []
100
+ extensions: []
101
+ extra_rdoc_files: []
102
+ files:
103
+ - ".gitignore"
104
+ - ".rspec"
105
+ - ".travis.yml"
106
+ - Gemfile
107
+ - Gemfile.lock
108
+ - LICENSE.txt
109
+ - README.md
110
+ - Rakefile
111
+ - bin/console
112
+ - bin/setup
113
+ - config/locales/enumerations.en.yml
114
+ - config/locales/enumerations.pt-BR.yml
115
+ - easter_eggs.gemspec
116
+ - lib/easter_eggs.rb
117
+ - lib/easter_eggs/search.rb
118
+ - lib/easter_eggs/universe.rb
119
+ - lib/easter_eggs/version.rb
120
+ homepage: https://github.com/easybills/easter_eggs
121
+ licenses:
122
+ - MIT
123
+ metadata: {}
124
+ post_install_message:
125
+ rdoc_options: []
126
+ require_paths:
127
+ - lib
128
+ required_ruby_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: 2.3.0
133
+ required_rubygems_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ requirements: []
139
+ rubyforge_project:
140
+ rubygems_version: 2.5.2
141
+ signing_key:
142
+ specification_version: 4
143
+ summary: Search for references in several movies, TV series, games, etc.
144
+ test_files: []