herman_li 0.1.0

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: 5312d988ecfff406c03ff616e49d6f325b9557cf
4
+ data.tar.gz: 3f9cf66fd09a5f84f24860c574e53f9322a74174
5
+ SHA512:
6
+ metadata.gz: af36216d96bba32aa0f27f1a22c21fc39feff036562c3a77102d1f90091b1c335d838fd433d1ab1cc78ec69f85e738ed86ee7a8c2b88c261588ab68fd660f0c1
7
+ data.tar.gz: c944006583f6c786b42eea498f6ef74b79a1cb85a9cfed1f2525df8d74d7eb3d4a1bf7605e3925848cecc95d09f28565ea0d9794044dfcd110ae2fe0465c7de1
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
4
+ before_install: gem install bundler -v 1.10.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in herman_li.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # HermanLi
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/herman_li`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'herman_li'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install herman_li
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ 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. Run `bundle exec herman_li` to use the gem in this directory, ignoring other installed copies of this gem.
30
+
31
+ 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).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/herman_li.
36
+
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,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "herman_li"
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
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/exe/herman_li ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "herman_li"
5
+ require "herman_li/cli"
6
+
7
+ HermanLi::CLI.start(ARGV)
data/herman_li.gemspec ADDED
@@ -0,0 +1,36 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'herman_li/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "herman_li"
8
+ spec.version = HermanLi::VERSION
9
+ spec.authors = ["r-fujiwara"]
10
+ spec.email = ["fjwr0516@gmail.com"]
11
+
12
+ spec.summary = %q{nothing to do with hexxan li}
13
+ spec.description = %q{nothing to do with herxxn li}
14
+ spec.homepage = "https://en.wikipedia.org/wiki/Herman_Li"
15
+
16
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
17
+ # delete this section to allow pushing this gem to any host.
18
+ #if spec.respond_to?(:metadata)
19
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
20
+ #else
21
+ # raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
22
+ #end
23
+
24
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+
29
+ spec.add_development_dependency "bundler", "~> 1.10"
30
+ spec.add_development_dependency "rake", "~> 10.0"
31
+ spec.add_development_dependency "rspec"
32
+ spec.add_dependency "pry"
33
+ spec.add_dependency "clockwork"
34
+ spec.add_dependency "thor"
35
+ spec.add_dependency "twitter"
36
+ end
data/lib/herman_li.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "herman_li/version"
2
+
3
+ module HermanLi
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,20 @@
1
+ require "thor"
2
+ require "clockwork"
3
+ require "yaml"
4
+
5
+ module HermanLi
6
+ class CLI < Thor
7
+
8
+ desc "execute task", "execute task"
9
+ options :file => :required, :aliases => :f
10
+ def express
11
+ f = options[:file]
12
+ fail unless File.exist?(f)
13
+ $config = YAML::load_file(f)
14
+ require_relative "./clock"
15
+ Clockwork::run
16
+ end
17
+ default_task :express
18
+
19
+ end
20
+ end
@@ -0,0 +1,103 @@
1
+ require "clockwork"
2
+
3
+ module Clockwork
4
+ extend self
5
+
6
+ $SONGS = %w(
7
+ https://www.youtube.com/watch?v=-ocvm63GCGE
8
+ https://www.youtube.com/watch?v=FuO3hHwQ-Sc
9
+ https://www.youtube.com/watch?v=FjV8SHjHvHk
10
+ https://www.youtube.com/watch?v=_9h3jRaZyB4
11
+ https://www.youtube.com/watch?v=3FFTQRmsK0k
12
+ https://www.youtube.com/watch?v=fkMBO1IZkBo
13
+ https://www.youtube.com/watch?v=9GFI6Rf-IkI
14
+ https://www.youtube.com/watch?v=_Qy59hKIc4A
15
+ https://www.youtube.com/watch?v=LvB2MnIIdMw
16
+ https://www.youtube.com/watch?v=LGBUJL5uS_c
17
+ https://www.youtube.com/watch?v=xt0V0_1MS0Q
18
+ https://www.youtube.com/watch?v=LatorN4P9aA
19
+ https://www.youtube.com/watch?v=qv96yJYhk3M
20
+ https://www.youtube.com/watch?v=mcXYz0gtJeM
21
+ https://www.youtube.com/watch?v=X9jDQdocqCI
22
+ https://www.youtube.com/watch?v=H063tac_lQo
23
+ https://www.youtube.com/watch?v=LuhLVl5qf2A
24
+ https://www.youtube.com/watch?v=XbDG7ToV_nk
25
+ https://www.youtube.com/watch?v=hiBjCKKEe_E
26
+ https://www.youtube.com/watch?v=pXCpPpPCW4c
27
+ https://www.youtube.com/watch?v=frtJQFe9apw
28
+ https://www.youtube.com/watch?v=zEaxow3PoO0
29
+ https://www.youtube.com/watch?v=s86K-p089R8
30
+ https://www.youtube.com/watch?v=lDK9QqIzhwk
31
+ https://www.youtube.com/watch?v=Gcj34XixuYg
32
+ https://www.youtube.com/watch?v=L397TWLwrUU
33
+ https://www.youtube.com/watch?v=qfKPKluQuXA
34
+ https://www.youtube.com/watch?v=NOGMQ-ySqOY
35
+ https://www.youtube.com/watch?v=85SXoONRKAw
36
+ https://www.youtube.com/watch?v=SwYN7mTi6HM
37
+ https://www.youtube.com/watch?v=2Dq-k_jzEtI
38
+ https://www.youtube.com/watch?v=XBxlAATrd-E
39
+ https://www.youtube.com/watch?v=btPJPFnesV4
40
+ https://www.youtube.com/watch?v=bnNWUUZ7cEA
41
+ https://www.youtube.com/watch?v=nwmCOSYUSlI
42
+ https://www.youtube.com/watch?v=aatjerFCRP8
43
+ https://www.youtube.com/watch?v=2he3PAXV2Jg
44
+ https://www.youtube.com/watch?v=poYf-P9WAXM
45
+ https://www.youtube.com/watch?v=HuEzobimWy8
46
+ https://www.youtube.com/watch?v=ru-AlSO9REw
47
+ https://www.youtube.com/watch?v=W54gF6QxeqM
48
+ https://www.youtube.com/watch?v=J8eLoCtHB4E
49
+ https://www.youtube.com/watch?v=OOASEZW2tYk
50
+ https://www.youtube.com/watch?v=t5sQTAzzt6s
51
+ https://www.youtube.com/watch?v=xrHFknW-i64
52
+ https://www.youtube.com/watch?v=-If2r9ENQfA
53
+ https://www.youtube.com/watch?v=ybGOT4d2Hs8
54
+ https://www.youtube.com/watch?v=34Udmn2EtzY
55
+ https://www.youtube.com/watch?v=dwZuFexTy0k
56
+ https://www.youtube.com/watch?v=FTQbiNvZqaY
57
+ https://www.youtube.com/watch?v=9uh__MTM0pQ
58
+ https://www.youtube.com/watch?v=D_xkQAxyf-o
59
+ https://www.youtube.com/watch?v=C4SJ-76spgE
60
+ https://www.youtube.com/watch?v=gUkB43t4iho
61
+ https://www.youtube.com/watch?v=rG1vuyz6Fb0
62
+ https://www.youtube.com/watch?v=VI_F5oWkIro
63
+ https://www.youtube.com/watch?v=yrmkI-L_KIQ
64
+ https://www.youtube.com/watch?v=y_jdksFN5Vc
65
+ https://www.youtube.com/watch?v=SRwrg0db_zY
66
+ https://www.youtube.com/watch?v=nDEcMyEM-BQ
67
+ )
68
+
69
+ handler do |job|
70
+ send :tweet
71
+ end
72
+
73
+ every(1.minutes, 'less.frequent.job')
74
+
75
+ def tweet
76
+ client = Twitter::REST::Client.new do |config|
77
+ config.consumer_key = $config["consumer_key"]
78
+ config.consumer_secret = $config["client_secret"]
79
+ config.access_token = $config["access_token"]
80
+ config.access_token_secret = $config["access_token"]
81
+ end
82
+
83
+ client.update(creative_sentence())
84
+ end
85
+
86
+ def creative_sentence
87
+ sentence = <<- EOS
88
+ HR/HM この曲を聴け!
89
+ #{get_song}
90
+ EOS
91
+ sentence
92
+ end
93
+
94
+ def get_song
95
+ song = Random.rand($SONGS.length)
96
+ rescue => e
97
+ # ごきげんだぜ
98
+ # https://www.youtube.com/watch?v=YLKIENnW30w
99
+ song = "https://www.youtube.com/watch?v=YLKIENnW30w"
100
+ end
101
+
102
+
103
+ end
@@ -0,0 +1,3 @@
1
+ module HermanLi
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,157 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: herman_li
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - r-fujiwara
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-11-14 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.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
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: rspec
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: :runtime
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: clockwork
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
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: thor
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: twitter
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: nothing to do with herxxn li
112
+ email:
113
+ - fjwr0516@gmail.com
114
+ executables:
115
+ - herman_li
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - ".gitignore"
120
+ - ".rspec"
121
+ - ".travis.yml"
122
+ - Gemfile
123
+ - README.md
124
+ - Rakefile
125
+ - bin/console
126
+ - bin/setup
127
+ - exe/herman_li
128
+ - herman_li.gemspec
129
+ - lib/herman_li.rb
130
+ - lib/herman_li/cli.rb
131
+ - lib/herman_li/clock.rb
132
+ - lib/herman_li/version.rb
133
+ homepage: https://en.wikipedia.org/wiki/Herman_Li
134
+ licenses: []
135
+ metadata: {}
136
+ post_install_message:
137
+ rdoc_options: []
138
+ require_paths:
139
+ - lib
140
+ required_ruby_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ required_rubygems_version: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ requirements: []
151
+ rubyforge_project:
152
+ rubygems_version: 2.4.5
153
+ signing_key:
154
+ specification_version: 4
155
+ summary: nothing to do with hexxan li
156
+ test_files: []
157
+ has_rdoc: