envryo 0.0.1

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: cd7fd737740fa7c49475e357c0a46450c7af14d1
4
+ data.tar.gz: 6a254096cdaf23e8d2b7623df690d9fcc6a8df3a
5
+ SHA512:
6
+ metadata.gz: ffb3f2dd782aa70f890fb68e5f2a0a324a31f4a171a87da599bd09e118fad7a9cfd14ea6f9b62bebb0f4cfc7efeee56225b854f082c452722d050508cdd0cd2a
7
+ data.tar.gz: ddc77fc02f29de5f7affcd4ce1df98ff46e8ba2a0f897b3864c4975ecb4a53d196510d359bfa738aafbfb293062fb01b168c9151b8d8828ff47c8a84fb18c40d
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in envryo.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 meganemura
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,44 @@
1
+ # Envryo
2
+
3
+ Evernote various notifier via Yo.
4
+
5
+ ## Usage
6
+
7
+ 1. Invoke it with config
8
+
9
+ `envryo --config=config.yml`
10
+
11
+ 2. Update evernote note
12
+
13
+ 3. Envryo yo to you or all
14
+
15
+ ## Configuration (config.yml)
16
+
17
+ ```yaml
18
+ evernote_token: "Your evernote token"
19
+ yo_api_key: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
20
+ yo_user: "Yo username" # Set null to yo all
21
+ interval: 300 # polling interval
22
+ ```
23
+
24
+ ## Installation
25
+
26
+ Add this line to your application's Gemfile:
27
+
28
+ gem 'envryo'
29
+
30
+ And then execute:
31
+
32
+ $ bundle
33
+
34
+ Or install it yourself as:
35
+
36
+ $ gem install envryo
37
+
38
+ ## Contributing
39
+
40
+ 1. Fork it ( https://github.com/meganemura/envryo/fork )
41
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
42
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
43
+ 4. Push to the branch (`git push origin my-new-feature`)
44
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
data/bin/envryo ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'envryo'
4
+ require 'envryo/cli'
5
+
6
+ Envryo::CLI.call(ARGV)
@@ -0,0 +1,4 @@
1
+ evernote_token: "Your evernote token"
2
+ yo_api_key: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
3
+ yo_user: "Yo username" # Set null to yo all
4
+ interval: 300 # polling interval
data/envryo.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'envryo/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "envryo"
8
+ spec.version = Envryo::VERSION
9
+ spec.authors = ["meganemura"]
10
+ spec.email = ["mura2megane@gmail.com"]
11
+ spec.summary = %q{Evernote various notifier via Yo.}
12
+ spec.description = spec.description
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
+
21
+ spec.add_runtime_dependency "evernote_oauth", "~> 0.2"
22
+ spec.add_runtime_dependency "yoyo", "~> 0.1"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.6"
25
+ spec.add_development_dependency "rake"
26
+ spec.add_development_dependency "rspec"
27
+ spec.add_development_dependency "pry"
28
+ end
data/lib/envryo/cli.rb ADDED
@@ -0,0 +1,27 @@
1
+ # encoding: utf-8
2
+
3
+ require "yaml"
4
+ require "optparse"
5
+
6
+ module Envryo
7
+ class CLI
8
+ def self.call(argv = ARGV)
9
+ options = ARGV.getopts('c:', 'config:')
10
+ config_file = options['c'] || options['config']
11
+
12
+ unless config_file
13
+ puts "Usage: #{$0} --config=CONFIG"
14
+ exit 1
15
+ end
16
+
17
+ config = YAML.load_file(config_file)
18
+
19
+ # symblize keys
20
+ config = config.inject({}) do |h, (k, v)|
21
+ h.merge(k.to_sym => v)
22
+ end
23
+
24
+ Envryo::Notifier.new(config).run
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,49 @@
1
+ # encoding: utf-8
2
+
3
+ require "evernote_oauth"
4
+ require "yoyo"
5
+
6
+ module Envryo
7
+ class Notifier
8
+ def initialize(config = {})
9
+ evernote = EvernoteOAuth::Client.new(:token => config[:evernote_token])
10
+ @note_store = evernote.note_store
11
+
12
+ @yo = Yoyo::Yo.new(config[:yo_api_key])
13
+ @yo_user = config[:yo_user]
14
+
15
+ @interval = config[:interval] || 300
16
+ end
17
+
18
+ def run
19
+ setup
20
+
21
+ loop do
22
+ notify if updated?
23
+ sleep @interval
24
+ end
25
+ end
26
+
27
+ def setup
28
+ raise 'NoteStore not found' unless @note_store
29
+ @update_count = current_state.updateCount
30
+ nil
31
+ end
32
+
33
+ def updated?
34
+ old_count, @update_count = @update_count, current_state.updateCount
35
+
36
+ old_count != @update_count
37
+ end
38
+
39
+ def notify
40
+ @yo_user ? @yo.yo(@yo_user) : @yo.yo_all
41
+ end
42
+
43
+ private
44
+
45
+ def current_state
46
+ @note_store.getSyncState
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,3 @@
1
+ module Envryo
2
+ VERSION = "0.0.1"
3
+ end
data/lib/envryo.rb ADDED
@@ -0,0 +1,2 @@
1
+ require "envryo/version"
2
+ require "envryo/notifier"
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe Envryo do
4
+ it 'has a version number' do
5
+ expect(Envryo::VERSION).not_to be nil
6
+ end
7
+
8
+ it 'does something useful' do
9
+ expect(false).to eq(true)
10
+ end
11
+ end
@@ -0,0 +1,2 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'envryo'
metadata ADDED
@@ -0,0 +1,147 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: envryo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - meganemura
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: evernote_oauth
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '0.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '0.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: yoyo
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '0.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '0.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.6'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
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: rspec
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: pry
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: ''
98
+ email:
99
+ - mura2megane@gmail.com
100
+ executables:
101
+ - envryo
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - .gitignore
106
+ - .rspec
107
+ - .travis.yml
108
+ - Gemfile
109
+ - LICENSE.txt
110
+ - README.md
111
+ - Rakefile
112
+ - bin/envryo
113
+ - config.example.yml
114
+ - envryo.gemspec
115
+ - lib/envryo.rb
116
+ - lib/envryo/cli.rb
117
+ - lib/envryo/notifier.rb
118
+ - lib/envryo/version.rb
119
+ - spec/envryo_spec.rb
120
+ - spec/spec_helper.rb
121
+ homepage: ''
122
+ licenses:
123
+ - MIT
124
+ metadata: {}
125
+ post_install_message:
126
+ rdoc_options: []
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ requirements: []
140
+ rubyforge_project:
141
+ rubygems_version: 2.0.3
142
+ signing_key:
143
+ specification_version: 4
144
+ summary: Evernote various notifier via Yo.
145
+ test_files:
146
+ - spec/envryo_spec.rb
147
+ - spec/spec_helper.rb