get_happy 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 +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +79 -0
- data/Rakefile +5 -0
- data/bin/get_happy +4 -0
- data/get_happy.gemspec +25 -0
- data/lib/get_happy/cli.rb +57 -0
- data/lib/get_happy/engine.rb +38 -0
- data/lib/get_happy/version.rb +3 -0
- data/lib/get_happy.rb +13 -0
- data/spec/screen_shot.png +0 -0
- metadata +100 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 27b12400a66d33ca6bcfe1e9ea17c2eb29d618be
|
4
|
+
data.tar.gz: a572a984ac4f493982fbba578d2f5a8cf46c2352
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d3ac59572d4c2e20b5cbe6f9259aae463fb7b0549c273428e890b393efffd7a928c5f1ed91312e08a2d18d6875741d41e4eef3ae148f232bbf3829d3726753b1
|
7
|
+
data.tar.gz: b37bbd0223959d4218f5d1da3a6a0acc431d7436f681c622ca12c693b06515731b33e268944928654369d2a8d4799be854c596e68a7fc34ed59e0058fc6f69b0
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Ioannis Kolovos
|
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,79 @@
|
|
1
|
+
# GetHappy
|
2
|
+
|
3
|
+
A Gem to make you happy!
|
4
|
+
Creates a collection in `~/.get_happy/collection.yml` with your favorite links and after by `$ get_happy` open one of them
|
5
|
+
|
6
|
+
<img src="https://raw.githubusercontent.com/msroot/get_happy/master/spec/screen_shot.png" align="center" height="129" width="300" style="text-align:center">
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'get_happy'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install get_happy
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
$ get_happy help
|
27
|
+
Commands:
|
28
|
+
get_happy add [LINKS] # add a link to collection
|
29
|
+
get_happy clean # clean collection
|
30
|
+
get_happy delete # delete a url
|
31
|
+
get_happy help [COMMAND] # Describe available commands or one specific command
|
32
|
+
get_happy list # list collection
|
33
|
+
get_happy play # play a random song
|
34
|
+
get_happy seed # seed with some sample urls
|
35
|
+
|
36
|
+
Play a random song
|
37
|
+
|
38
|
+
$ get_happy
|
39
|
+
|
40
|
+
List collection
|
41
|
+
|
42
|
+
$ get_happy list
|
43
|
+
=> ["https://www.youtube.com/watch?v=s3Q80mk7bxE", "https://www.youtube.com/watch?v=s3Q80mk7bxE,"]
|
44
|
+
|
45
|
+
Seed with some sample urls
|
46
|
+
|
47
|
+
$ get_happy seed
|
48
|
+
=> ["https://www.youtube.com/watch?v=s3Q80mk7bxE"]
|
49
|
+
|
50
|
+
Clean collection
|
51
|
+
|
52
|
+
$ get_happy clean
|
53
|
+
=> []
|
54
|
+
|
55
|
+
Add a link to collection
|
56
|
+
|
57
|
+
$ get_happy add https://www.youtube.com/watch?v=s3Q80mk7bxE
|
58
|
+
=> ["https://www.youtube.com/watch?v=s3Q80mk7bxE", "https://www.youtube.com/watch?v=s3Q80mk7bxE"]
|
59
|
+
|
60
|
+
Or add multiply
|
61
|
+
|
62
|
+
|
63
|
+
$ get_happy add https://www.youtube.com/watch?v=s3Q80mk7bxE, https://www.youtube.com/watch?v=PWgvGjAhvIw
|
64
|
+
=> ["https://www.youtube.com/watch?v=s3Q80mk7bxE", "https://www.youtube.com/watch?v=s3Q80mk7bxE"]
|
65
|
+
|
66
|
+
Delete a url
|
67
|
+
|
68
|
+
|
69
|
+
$ get_happy delete https://www.youtube.com/watch?v=s3Q80mk7bxE
|
70
|
+
=> ["https://www.youtube.com/watch?v=s3Q80mk7bxE", "https://www.youtube.com/watch?v=s3Q80mk7bxE"]
|
71
|
+
|
72
|
+
|
73
|
+
## Contributing
|
74
|
+
|
75
|
+
1. Fork it ( https://github.com/msroot/get_happy/fork )
|
76
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
77
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
78
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
79
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/get_happy
ADDED
data/get_happy.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'get_happy/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "get_happy"
|
8
|
+
spec.version = GetHappy::VERSION
|
9
|
+
spec.authors = ["Ioannis Kolovos"]
|
10
|
+
spec.email = ["yannis.kolovos@gmail.com"]
|
11
|
+
spec.summary = "Get Happy"
|
12
|
+
spec.description = "Get Happy"
|
13
|
+
spec.homepage = ""
|
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
|
+
spec.executables = ['get_happy']
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_runtime_dependency "thor"
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module GetHappy
|
2
|
+
class CLI < Thor
|
3
|
+
|
4
|
+
desc "play", "play a random song"
|
5
|
+
def play
|
6
|
+
@collection ||= GetHappy.get_collection
|
7
|
+
system("open", @collection.sample) unless @collection.empty?
|
8
|
+
puts "Collection is empty! get_happy seed to seed" if @collection.empty?
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
desc "add [LINKS]", "add a link to collection"
|
13
|
+
def add(*links)
|
14
|
+
@collection ||= GetHappy.get_collection
|
15
|
+
links.each {|link| @collection << link.to_s}
|
16
|
+
GetHappy.write_collection(@collection)
|
17
|
+
list
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "list", "list collection"
|
21
|
+
def list
|
22
|
+
@collection ||= GetHappy.get_collection
|
23
|
+
user = `echo $USER`.gsub("\n", "")
|
24
|
+
|
25
|
+
puts " \n"
|
26
|
+
puts "\e[1m\e[4m#{user} Total #{@collection.size}\e[0m \n"
|
27
|
+
# puts @collection.join("\n")
|
28
|
+
@collection.each do |item|
|
29
|
+
puts "\e[92m🚀 #{item}"
|
30
|
+
end
|
31
|
+
puts "\e[0m\n"
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "clean", "clean collection"
|
35
|
+
def clean
|
36
|
+
@collection = []
|
37
|
+
GetHappy.write_collection([])
|
38
|
+
puts "Collection is empty"
|
39
|
+
end
|
40
|
+
|
41
|
+
desc "seed", "seed with some sample urls"
|
42
|
+
def seed
|
43
|
+
GetHappy.seed
|
44
|
+
@collection = GetHappy.get_collection
|
45
|
+
list
|
46
|
+
end
|
47
|
+
|
48
|
+
desc "delete", "delete a url"
|
49
|
+
def delete(url)
|
50
|
+
@collection ||= GetHappy.get_collection
|
51
|
+
@collection.delete(url.to_s)
|
52
|
+
GetHappy.write_collection(@collection)
|
53
|
+
list
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module GetHappy
|
2
|
+
extend self
|
3
|
+
|
4
|
+
@urls = %w(
|
5
|
+
https://www.youtube.com/watch?v=s3Q80mk7bxE
|
6
|
+
https://www.youtube.com/watch?v=LxDhlzJR4XQ
|
7
|
+
https://www.youtube.com/watch?v=HqYnevHibaI
|
8
|
+
https://www.youtube.com/watch?v=8kMZcA5oEAA
|
9
|
+
)
|
10
|
+
|
11
|
+
COLLECTION_DIR = Dir.home + '/.get_happy'
|
12
|
+
COLLECTION = COLLECTION_DIR + "/collection.yml"
|
13
|
+
|
14
|
+
def write_collection(collection)
|
15
|
+
collection = collection.compact.uniq
|
16
|
+
File.open(COLLECTION, "w") do |file|
|
17
|
+
file.write collection.to_yaml
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def seed
|
22
|
+
write_collection get_collection + @urls
|
23
|
+
end
|
24
|
+
|
25
|
+
def get_collection
|
26
|
+
unless File.directory?(COLLECTION_DIR)
|
27
|
+
FileUtils.mkdir_p(COLLECTION_DIR)
|
28
|
+
end
|
29
|
+
|
30
|
+
File.open(COLLECTION, "w+") do |file|
|
31
|
+
file.write [].to_yaml
|
32
|
+
end unless File.file?(COLLECTION)
|
33
|
+
|
34
|
+
YAML::load_file(COLLECTION) || []
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
data/lib/get_happy.rb
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: get_happy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ioannis Kolovos
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-28 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: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Get Happy
|
56
|
+
email:
|
57
|
+
- yannis.kolovos@gmail.com
|
58
|
+
executables:
|
59
|
+
- get_happy
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- bin/get_happy
|
69
|
+
- get_happy.gemspec
|
70
|
+
- lib/get_happy.rb
|
71
|
+
- lib/get_happy/cli.rb
|
72
|
+
- lib/get_happy/engine.rb
|
73
|
+
- lib/get_happy/version.rb
|
74
|
+
- spec/screen_shot.png
|
75
|
+
homepage: ''
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
metadata: {}
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
82
|
+
- lib
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 2.2.2
|
96
|
+
signing_key:
|
97
|
+
specification_version: 4
|
98
|
+
summary: Get Happy
|
99
|
+
test_files:
|
100
|
+
- spec/screen_shot.png
|