formkeep 0.0.6 → 0.0.7
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 +4 -4
- data/.hound.yml +2 -0
- data/CHANGELOG.md +1 -1
- data/Guardfile +23 -0
- data/README.md +6 -1
- data/Rakefile +10 -0
- data/bin/formkeep +11 -9
- data/formkeep.gemspec +5 -0
- data/lib/formkeep.rb +13 -10
- data/lib/formkeep/version.rb +2 -1
- data/spec/formkeep_spec.rb +12 -9
- data/spec/spec_helper.rb +1 -0
- metadata +75 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 191b02d3b0ae2b067e0906faecdfdfdad73ba205
|
|
4
|
+
data.tar.gz: 97795f03acdb1a2bab7b84a2f028859cca4c4dbf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7cde1deac8d2e15cecf688b62ea134145db9a3280e9d4896ab781f70ac58f2f13f954717723118a8ee20659871c5820a8bedbd04249e9f0e280479052ed00332
|
|
7
|
+
data.tar.gz: 7cb10f36e1271a565a8f26760ac2008ff540c72d57617c3d118c0dc11e6941680e38174d3897c6c03afbde387e8c9d93ec626c415db76d3e4272563b7f63ed14
|
data/.hound.yml
ADDED
data/CHANGELOG.md
CHANGED
data/Guardfile
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# A sample Guardfile
|
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
|
3
|
+
|
|
4
|
+
guard 'ctags-bundler', :src_path => ["app", "lib", "spec/support"] do
|
|
5
|
+
watch(/^(app|lib|spec\/support)\/.*\.rb$/)
|
|
6
|
+
watch('Gemfile.lock')
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
guard :rubocop, all_on_start: false do
|
|
10
|
+
watch(%r{^lib/.+\.rb$})
|
|
11
|
+
watch(%r{bin/.+})
|
|
12
|
+
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
|
16
|
+
watch(%r{^spec/.+_spec\.rb$})
|
|
17
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
|
18
|
+
watch('spec/spec_helper.rb') { "spec" }
|
|
19
|
+
|
|
20
|
+
# Turnip features and steps
|
|
21
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
|
22
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
|
23
|
+
end
|
data/README.md
CHANGED
|
@@ -25,6 +25,7 @@ Or install it yourself as:
|
|
|
25
25
|
It should look something like this:
|
|
26
26
|
|
|
27
27
|
~~~
|
|
28
|
+
---
|
|
28
29
|
form_name: api_endpoint_url_in_full
|
|
29
30
|
~~~
|
|
30
31
|
|
|
@@ -32,8 +33,12 @@ You can have as many form entries as you like. They don't necessarily need to be
|
|
|
32
33
|
|
|
33
34
|
## Usage
|
|
34
35
|
|
|
36
|
+
Simply pass the key of the form from `~/.formkeep.yaml` to the `unread` command to check for unread messages. If you have [Sticky Notifications][sn] installed (OS X only) you can have a sticky notification created by passing the `-s` or `--sticky` flag.
|
|
37
|
+
|
|
38
|
+
[sn]: http://instinctivecode.com/sticky-notifications/
|
|
39
|
+
|
|
35
40
|
~~~
|
|
36
|
-
formkeep unread FORM
|
|
41
|
+
formkeep unread FORM [-s]
|
|
37
42
|
~~~
|
|
38
43
|
|
|
39
44
|
## Contributing
|
data/Rakefile
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
require "bundler/gem_tasks"
|
|
2
2
|
require "rspec/core/rake_task"
|
|
3
3
|
require 'yard'
|
|
4
|
+
require 'rubocop/rake_task'
|
|
5
|
+
|
|
6
|
+
desc 'Run RuboCop on the lib directory'
|
|
7
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
|
8
|
+
task.patterns = ['lib/**/*.rb']
|
|
9
|
+
# only show the files with failures
|
|
10
|
+
task.formatters = ['files']
|
|
11
|
+
# don't abort rake on failure
|
|
12
|
+
task.fail_on_error = false
|
|
13
|
+
end
|
|
4
14
|
|
|
5
15
|
RSpec::Core::RakeTask.new(:spec)
|
|
6
16
|
|
data/bin/formkeep
CHANGED
|
@@ -4,9 +4,9 @@ require 'formkeep'
|
|
|
4
4
|
require 'slop'
|
|
5
5
|
|
|
6
6
|
opts = Slop.parse do
|
|
7
|
-
banner
|
|
8
|
-
on :h, :help,
|
|
9
|
-
on :v, :version,
|
|
7
|
+
banner 'Usage: formkeep unread FORM'
|
|
8
|
+
on :h, :help, 'Display help'
|
|
9
|
+
on :v, :version, 'Display version' do
|
|
10
10
|
puts Formkeep::VERSION
|
|
11
11
|
exit
|
|
12
12
|
end
|
|
@@ -15,17 +15,19 @@ opts = Slop.parse do
|
|
|
15
15
|
banner <<-EOF
|
|
16
16
|
Usage: formkeep unread FORM
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
Make sure you have a valid Formkeep API endpoint saved in ~/.formkeep.yaml
|
|
19
19
|
EOF
|
|
20
|
-
on :s, :sticky,
|
|
21
|
-
run do |
|
|
22
|
-
|
|
20
|
+
on :s, :sticky, 'Create sticky notification'
|
|
21
|
+
run do |options, args|
|
|
22
|
+
if !args.empty?
|
|
23
23
|
form = Formkeep::Form.new(args[0])
|
|
24
24
|
count = form.unread_submissions.length
|
|
25
25
|
puts count
|
|
26
|
-
|
|
26
|
+
if options[:s] && count > 0
|
|
27
|
+
form.sticky("#{form.form} has unread submissions.")
|
|
28
|
+
end
|
|
27
29
|
else
|
|
28
|
-
puts
|
|
30
|
+
puts options
|
|
29
31
|
end
|
|
30
32
|
end
|
|
31
33
|
end
|
data/formkeep.gemspec
CHANGED
|
@@ -21,6 +21,11 @@ Gem::Specification.new do |spec|
|
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.7"
|
|
22
22
|
spec.add_development_dependency "rake", "~> 10.0"
|
|
23
23
|
spec.add_development_dependency "rspec"
|
|
24
|
+
spec.add_development_dependency "guard"
|
|
25
|
+
spec.add_development_dependency "guard-rspec"
|
|
26
|
+
spec.add_development_dependency "guard-rubocop"
|
|
27
|
+
spec.add_development_dependency "guard-ctags-bundler"
|
|
28
|
+
spec.add_development_dependency "rubocop"
|
|
24
29
|
|
|
25
30
|
spec.add_dependency "slop"
|
|
26
31
|
spec.add_dependency "stickynotifications", "~> 0.0.5 "
|
data/lib/formkeep.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require
|
|
1
|
+
require 'formkeep/version'
|
|
2
2
|
require 'pp'
|
|
3
3
|
require 'json'
|
|
4
4
|
require 'net/http'
|
|
@@ -8,10 +8,9 @@ require 'stickynotifications'
|
|
|
8
8
|
# @author Brandon Pittman
|
|
9
9
|
# Helper methods for accessing Formkeep API
|
|
10
10
|
module Formkeep
|
|
11
|
-
# @author Brandon Pittman
|
|
11
|
+
# @author Brandon Pittman
|
|
12
12
|
# Helper methods for accessing Formkeep API
|
|
13
13
|
class Form
|
|
14
|
-
|
|
15
14
|
# @!attribute form
|
|
16
15
|
# @return [String] name of Form to be used
|
|
17
16
|
# @since 0.0.4
|
|
@@ -69,8 +68,8 @@ module Formkeep
|
|
|
69
68
|
# @return [Array] all submissions
|
|
70
69
|
# @since 0.0.4
|
|
71
70
|
def submissions
|
|
72
|
-
all = JSON.parse(response)[
|
|
73
|
-
all.reject { |sub| sub[
|
|
71
|
+
all = JSON.parse(response)['submissions']
|
|
72
|
+
all.reject { |sub| sub['spam'] }
|
|
74
73
|
end
|
|
75
74
|
|
|
76
75
|
# Latest submission info
|
|
@@ -83,13 +82,13 @@ module Formkeep
|
|
|
83
82
|
# @return [String] name of latest submission
|
|
84
83
|
# @since 0.0.4
|
|
85
84
|
def latest_name
|
|
86
|
-
latest_submission.fetch(
|
|
85
|
+
latest_submission.fetch('name')
|
|
87
86
|
end
|
|
88
87
|
|
|
89
88
|
# @return [String] email of latest submission
|
|
90
89
|
# @since 0.0.4
|
|
91
90
|
def latest_email
|
|
92
|
-
latest_submission.fetch(
|
|
91
|
+
latest_submission.fetch('email')
|
|
93
92
|
end
|
|
94
93
|
# @!endgroup
|
|
95
94
|
|
|
@@ -98,7 +97,7 @@ module Formkeep
|
|
|
98
97
|
# @since 0.0.4
|
|
99
98
|
def unread_submissions
|
|
100
99
|
submissions.reject do |submission|
|
|
101
|
-
submission.fetch(
|
|
100
|
+
submission.fetch('read_at')
|
|
102
101
|
end
|
|
103
102
|
end
|
|
104
103
|
|
|
@@ -106,14 +105,18 @@ module Formkeep
|
|
|
106
105
|
# @since 0.0.4
|
|
107
106
|
def read_submissions
|
|
108
107
|
submissions.select do |submission|
|
|
109
|
-
submission.fetch(
|
|
108
|
+
submission.fetch('read_at')
|
|
110
109
|
end
|
|
111
110
|
end
|
|
112
111
|
# @!endgroup
|
|
113
112
|
|
|
114
113
|
# @!group Process
|
|
114
|
+
# @param text [String] text to pass to Sticky Notifications
|
|
115
|
+
# @return [Nil]
|
|
116
|
+
# @note This requires the OS X app, Sticky Notifications.
|
|
117
|
+
# @since 0.0.6
|
|
115
118
|
def sticky(text)
|
|
116
|
-
StickyNotifications::Note.new.create(text)
|
|
119
|
+
StickyNotifications::Note.new.create(text, 'Formkeep')
|
|
117
120
|
end
|
|
118
121
|
# @!endgroup
|
|
119
122
|
end
|
data/lib/formkeep/version.rb
CHANGED
data/spec/formkeep_spec.rb
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe Formkeep do
|
|
4
|
+
let(:test) { Formkeep::Form.new('test') }
|
|
5
|
+
let(:pixelsnatch) { Formkeep::Form.new('pixelsnatch') }
|
|
6
|
+
let(:subs) { pixelsnatch.submissions }
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
let(:pixelsnatch) {Formkeep::Form.new("pixelsnatch")}
|
|
7
|
-
let(:subs) {pixelsnatch.submissions}
|
|
8
|
-
|
|
9
|
-
it 'has a version number' do
|
|
8
|
+
it 'has a version number', cli: true do
|
|
10
9
|
expect(Formkeep::VERSION).not_to be nil
|
|
11
10
|
end
|
|
12
11
|
|
|
13
|
-
it 'pulls the correct API endpoint from the config YAML file' do
|
|
14
|
-
expect(test.api).to eq(
|
|
12
|
+
it 'pulls the correct API endpoint from the config YAML file', api: true do
|
|
13
|
+
expect(test.api).to eq('test')
|
|
15
14
|
end
|
|
16
15
|
|
|
17
|
-
it
|
|
16
|
+
it 'it pulls a submissions array', api: true do
|
|
18
17
|
expect(subs.class).to eq(Array)
|
|
19
18
|
end
|
|
20
19
|
|
|
21
|
-
it
|
|
20
|
+
it 'pulls the latest submission', api: true do
|
|
22
21
|
expect(pixelsnatch.latest_submission.class).to eq(Hash) if subs.length > 0
|
|
23
22
|
end
|
|
23
|
+
|
|
24
|
+
it 'creates a Sticky Notification', cli: true do
|
|
25
|
+
expect { test.sticky('Just testing Formkeep!') }.not_to raise_error
|
|
26
|
+
end
|
|
24
27
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: formkeep
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- brandonpittman
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
11
|
+
date: 2014-12-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -52,6 +52,76 @@ dependencies:
|
|
|
52
52
|
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: guard
|
|
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: guard-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: guard-rubocop
|
|
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
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: guard-ctags-bundler
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: rubocop
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - ">="
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '0'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - ">="
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '0'
|
|
55
125
|
- !ruby/object:Gem::Dependency
|
|
56
126
|
name: slop
|
|
57
127
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -89,9 +159,11 @@ extensions: []
|
|
|
89
159
|
extra_rdoc_files: []
|
|
90
160
|
files:
|
|
91
161
|
- ".gitignore"
|
|
162
|
+
- ".hound.yml"
|
|
92
163
|
- ".travis.yml"
|
|
93
164
|
- CHANGELOG.md
|
|
94
165
|
- Gemfile
|
|
166
|
+
- Guardfile
|
|
95
167
|
- LICENSE.txt
|
|
96
168
|
- README.md
|
|
97
169
|
- Rakefile
|
|
@@ -121,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
121
193
|
version: '0'
|
|
122
194
|
requirements: []
|
|
123
195
|
rubyforge_project:
|
|
124
|
-
rubygems_version: 2.4.
|
|
196
|
+
rubygems_version: 2.4.5
|
|
125
197
|
signing_key:
|
|
126
198
|
specification_version: 4
|
|
127
199
|
summary: A library for interacting with the formkeep API.
|