pushnote 1.0.1 → 1.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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -3
  3. data/.pushnote.yml +1 -0
  4. data/README.md +30 -11
  5. data/Rakefile +0 -20
  6. data/bin/pushnote +2 -19
  7. data/bin/pushnoted +58 -0
  8. data/lib/pushnote.rb +3 -0
  9. data/lib/pushnote/cli.rb +40 -0
  10. data/lib/pushnote/configuration.rb +12 -0
  11. data/lib/pushnote/note.rb +36 -0
  12. data/lib/pushnote/version.rb +1 -1
  13. data/pushnote.gemspec +5 -15
  14. metadata +10 -192
  15. data/.rspec +0 -3
  16. data/config.codekit +0 -1005
  17. data/config.ru +0 -2
  18. data/config/database.yml +0 -17
  19. data/db/migrate/20150131202537_create_notes_table.rb +0 -9
  20. data/db/schema.rb +0 -23
  21. data/lib/pushnote/adapters.rb +0 -1
  22. data/lib/pushnote/adapters/base.rb +0 -7
  23. data/lib/pushnote/adapters/local.rb +0 -17
  24. data/lib/pushnote/app.rb +0 -50
  25. data/lib/pushnote/models/note.rb +0 -4
  26. data/lib/pushnote/public/css/foundation.css +0 -6139
  27. data/lib/pushnote/public/css/foundation.min.css +0 -1
  28. data/lib/pushnote/public/css/normalize.css +0 -427
  29. data/lib/pushnote/public/humans.txt +0 -8
  30. data/lib/pushnote/public/img/.gitkeep +0 -1
  31. data/lib/pushnote/public/index.html +0 -166
  32. data/lib/pushnote/public/js/foundation.min.js +0 -5960
  33. data/lib/pushnote/public/js/foundation/foundation.abide.js +0 -318
  34. data/lib/pushnote/public/js/foundation/foundation.accordion.js +0 -67
  35. data/lib/pushnote/public/js/foundation/foundation.alert.js +0 -43
  36. data/lib/pushnote/public/js/foundation/foundation.clearing.js +0 -558
  37. data/lib/pushnote/public/js/foundation/foundation.dropdown.js +0 -439
  38. data/lib/pushnote/public/js/foundation/foundation.equalizer.js +0 -73
  39. data/lib/pushnote/public/js/foundation/foundation.interchange.js +0 -348
  40. data/lib/pushnote/public/js/foundation/foundation.joyride.js +0 -924
  41. data/lib/pushnote/public/js/foundation/foundation.js +0 -690
  42. data/lib/pushnote/public/js/foundation/foundation.magellan.js +0 -198
  43. data/lib/pushnote/public/js/foundation/foundation.offcanvas.js +0 -152
  44. data/lib/pushnote/public/js/foundation/foundation.orbit.js +0 -472
  45. data/lib/pushnote/public/js/foundation/foundation.reveal.js +0 -449
  46. data/lib/pushnote/public/js/foundation/foundation.slider.js +0 -267
  47. data/lib/pushnote/public/js/foundation/foundation.tab.js +0 -217
  48. data/lib/pushnote/public/js/foundation/foundation.tooltip.js +0 -300
  49. data/lib/pushnote/public/js/foundation/foundation.topbar.js +0 -445
  50. data/lib/pushnote/public/js/vendor/fastclick.js +0 -9
  51. data/lib/pushnote/public/js/vendor/jquery.cookie.js +0 -8
  52. data/lib/pushnote/public/js/vendor/jquery.js +0 -26
  53. data/lib/pushnote/public/js/vendor/modernizr.js +0 -8
  54. data/lib/pushnote/public/js/vendor/placeholder.js +0 -2
  55. data/lib/pushnote/public/robots.txt +0 -4
  56. data/lib/pushnote/views/index.erb +0 -15
  57. data/lib/pushnote/views/layout.erb +0 -48
  58. data/lib/pushnote/views/show.erb +0 -8
  59. data/spec/lib/controllers/notes_spec.rb +0 -21
  60. data/spec/spec_helper.rb +0 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b51e4d3835c9735ea6390f2022ffdef18f25e786
4
- data.tar.gz: 0af4e47c8ee1f5534a1a195c624725e646696006
3
+ metadata.gz: 354b06d7462c724194fc111e414b8ebbdfffaa50
4
+ data.tar.gz: c0949dcea3a4a4c73f330581a5f548917ae9c3fb
5
5
  SHA512:
6
- metadata.gz: bd605ccfc30ca69dbe88f5e449d5cbbfb01a1762e371fa346e78ef45ed7086ef378f79d20712882b279d0849d2e71460415330dc0743d45070a1acac0208a8c6
7
- data.tar.gz: 94c98286a7ede173d60f9dc779cfc6c9ec9777a9b0b13a6acc0f324b6dc39e8da546c576fc26b33e4e73135c8004788432aa6fd8dd88052a009a0fe5630a9fa1
6
+ metadata.gz: d72ed9457cdf272a6fe0e3e82f7dda2bfabfeeb52b9d60dbb7579d8a3419278e1f7174cbcea2da4f24af66b6dc99feb029391dee42019fb64fad8f9a6f75c61f
7
+ data.tar.gz: d8e341328fe765e0fc0f2b89c470b883474c58e3fec7357b6c0809d56316f52a17452a596932322ef1086a497a211d7b4c4da1651c9a8eb8d19d9f36747bd2ff
data/.gitignore CHANGED
@@ -12,6 +12,3 @@
12
12
  *.o
13
13
  *.a
14
14
  mkmf.log
15
- db/pushnote_development
16
- db/pushnote_test
17
- db/pushnote_local
data/.pushnote.yml ADDED
@@ -0,0 +1 @@
1
+ server: http://localhost:9283
data/README.md CHANGED
@@ -1,26 +1,45 @@
1
1
  # Pushnote
2
2
 
3
- TODO: Write a gem description
3
+ Push notes to a central location.
4
4
 
5
5
  ## Installation
6
6
 
7
- Add this line to your application's Gemfile:
8
-
9
- ```ruby
10
- gem 'pushnote'
7
+ Install the CLI tool:
8
+ ```
9
+ gem install pushnote
11
10
  ```
12
11
 
13
- And then execute:
12
+ ## Usage
14
13
 
15
- $ bundle
14
+ The `pushnote` command persists `stdin` to the specified pushnote server.
16
15
 
17
- Or install it yourself as:
16
+ For example, say you have created a note in `/tmp/note.md`:
17
+ ```
18
+ ### Ruby Sauce
19
+ Wow, didn't know you could do this:
20
+ x = 1 + 2
21
+ ```
18
22
 
19
- $ gem install pushnote
23
+ To send this note to the pushnote server:
24
+ ```
25
+ cat /tmp/node.md | pushnote --title "Ruby can add numbers, wow"
26
+ ```
20
27
 
21
- ## Usage
28
+ ## Development
29
+
30
+ Test locally by running the pushnote server:
31
+ ```
32
+ git clone git@github.com:corytheboyd/pushnote-server.git
33
+ cd pushnote-server
34
+ bundle install
35
+ bundle exec rake db:create db:migrate
36
+ rackup -p 3000
37
+ ```
22
38
 
23
- TODO: Write usage instructions here
39
+ Then, specify the pushnote server host when using the CLI:
40
+ ```
41
+ pushnote --host http://localhost:3000
42
+ ```
24
43
 
25
44
  ## Contributing
26
45
 
data/Rakefile CHANGED
@@ -1,22 +1,2 @@
1
1
  require "bundler/gem_tasks"
2
- require "sinatra/activerecord/rake"
3
2
 
4
- task :server do
5
- system('shotgun -p 9283')
6
- end
7
-
8
- task :spec do
9
- system('bundle exec rspec')
10
- end
11
-
12
- task :daemon do
13
- system('RAICK_ENV=local nohup rackup -p 9283 > /dev/null 2>&1 &')
14
- end
15
-
16
- namespace :db do
17
- task :load_config do
18
- require 'pushnote/app'
19
- end
20
- end
21
-
22
- task :start => ['db:create', 'db:migrate', 'daemon']
data/bin/pushnote CHANGED
@@ -1,20 +1,3 @@
1
1
  #! /usr/bin/env ruby
2
-
3
- require 'gli'
4
- require 'pushnote/adapters'
5
-
6
- include GLI::App
7
-
8
- program_desc 'Save notes from the command line'
9
-
10
- desc 'Create a note'
11
- command :create do |c|
12
- c.flag [:t, :title]
13
-
14
- c.action do |global_options, options, args|
15
- body = STDIN.gets.chomp
16
- Adapter::Local.create_note(options[:title], body)
17
- end
18
- end
19
-
20
- exit run(ARGV)
2
+ require 'pushnote'
3
+ Pushnote::Cli.new(ARGV).run
data/bin/pushnoted ADDED
@@ -0,0 +1,58 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ require 'fileutils'
4
+
5
+ SERVER_DIRECTORY = File.expand_path('~/.pushnote/server')
6
+
7
+ def clone_server
8
+ in_server_directory do
9
+ system('git clone git@github.com:corytheboyd/pushnote-server.git . > /dev/null')
10
+ end
11
+ end
12
+
13
+ def force_update_server
14
+ in_server_directory do
15
+ system('git fetch && git reset --hard origin/master > /dev/null')
16
+ end
17
+ end
18
+
19
+ def server_installed?
20
+ File.directory?(SERVER_DIRECTORY)
21
+ end
22
+
23
+ def start_server
24
+ in_server_directory do
25
+ system("rackup -p 9283 -D")
26
+ end
27
+ end
28
+
29
+ def in_server_directory(&block)
30
+ unless server_installed?
31
+ FileUtils.mkdir_p(SERVER_DIRECTORY, verbose: false)
32
+ end
33
+ FileUtils.chdir(SERVER_DIRECTORY) { yield }
34
+ end
35
+
36
+ def start_daemon
37
+ puts "Starting daemon..."
38
+ clone_server unless server_installed?
39
+ force_update_server
40
+ start_server
41
+ end
42
+
43
+ def stop_daemon
44
+ puts "lol"
45
+ end
46
+
47
+ def ping_daemon
48
+ system("curl -I localhost:9283")
49
+ end
50
+
51
+ case ARGV[0]
52
+ when 'start' then start_daemon
53
+ when 'stop' then stop_daemon
54
+ when 'restart' then stop_daemon and start_daemon
55
+ when 'ping' then ping_daemon
56
+ end
57
+
58
+ exit(0)
data/lib/pushnote.rb CHANGED
@@ -1 +1,4 @@
1
1
  require "pushnote/version"
2
+ require "pushnote/cli"
3
+ require "pushnote/note"
4
+ require "pushnote/configuration"
@@ -0,0 +1,40 @@
1
+ require 'optparse'
2
+
3
+ module Pushnote
4
+ class Cli
5
+ attr_reader :note, :configuration
6
+
7
+ def initialize(argv)
8
+ @note = Note.new
9
+ parse_options
10
+ end
11
+
12
+ def run
13
+ read_note_body
14
+ save_note
15
+ end
16
+
17
+ private
18
+
19
+ def parse_options
20
+ OptionParser.new { |opts|
21
+ opts.banner = "Usage: pushnote [options]"
22
+ opts.on('-t TITLE', '--title TITLE', 'Note title') do |title|
23
+ note.title = title
24
+ end
25
+
26
+ opts.on('-h HOST', '--host HOST', 'Pushnote server host') do |host|
27
+ note.set_server_host(host)
28
+ end
29
+ }.parse!
30
+ end
31
+
32
+ def read_note_body
33
+ note.body = STDIN.read.chomp
34
+ end
35
+
36
+ def save_note
37
+ note.save
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,12 @@
1
+ require 'yaml'
2
+
3
+ class Configuration < OpenStruct
4
+ FILE_PATH = File.expand_path('~/.pushnote.yml')
5
+
6
+ def initialize
7
+ unless File.exist?(FILE_PATH)
8
+ File.copy('.pushnote.yml', FILE_PATH)
9
+ end
10
+ super(YAML.load_file(FILE_PATH))
11
+ end
12
+ end
@@ -0,0 +1,36 @@
1
+ require 'httparty'
2
+
3
+ module Pushnote
4
+ class Note
5
+ include HTTParty
6
+
7
+ headers 'Content-Type' => 'application/json', 'Accept' => 'application/json'
8
+
9
+ attr_accessor :title, :body
10
+
11
+ def initialize
12
+ set_server_host(configuration.server)
13
+ end
14
+
15
+ def save
16
+ self.class.post('/', { body: serialize.to_json })
17
+ end
18
+
19
+ def set_server_host(host)
20
+ self.class.base_uri(host)
21
+ end
22
+
23
+ private
24
+
25
+ def serialize
26
+ {
27
+ title: title,
28
+ body: body
29
+ }
30
+ end
31
+
32
+ def configuration
33
+ @configuration ||= Configuration.new
34
+ end
35
+ end
36
+ end
@@ -1,3 +1,3 @@
1
1
  module Pushnote
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
data/pushnote.gemspec CHANGED
@@ -8,28 +8,18 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Pushnote::VERSION
9
9
  spec.authors = ["Cory Boyd"]
10
10
  spec.email = ["corytheboyd@gmail.com"]
11
- spec.summary = %q{Push notes}
12
- spec.description = %q{Push notes to a server}
11
+ spec.summary = %q{Save small notes}
12
+ spec.description = %q{Save ideas and reminders in notes accessible from all of your machines.}
13
13
  spec.homepage = ""
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = ['pushnote']
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "rack", "= 1.5.2"
22
21
  spec.add_development_dependency "bundler", "~> 1.7"
23
22
  spec.add_development_dependency "rake", "~> 10.0"
24
- spec.add_development_dependency "rspec"
25
- spec.add_development_dependency "rack-test"
26
- spec.add_development_dependency "byebug"
27
- spec.add_development_dependency "shotgun"
28
-
29
- spec.add_runtime_dependency "sinatra"
30
- spec.add_runtime_dependency "sinatra-activerecord"
31
- spec.add_runtime_dependency "sqlite3"
32
- spec.add_runtime_dependency "gli"
33
- spec.add_runtime_dependency "httparty"
34
- spec.add_runtime_dependency "github-markdown"
23
+
24
+ spec.add_dependency "httparty"
35
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pushnote
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cory Boyd
@@ -10,20 +10,6 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2015-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rack
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '='
18
- - !ruby/object:Gem::Version
19
- version: 1.5.2
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '='
25
- - !ruby/object:Gem::Version
26
- version: 1.5.2
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: bundler
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -52,118 +38,6 @@ dependencies:
52
38
  - - "~>"
53
39
  - !ruby/object:Gem::Version
54
40
  version: '10.0'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec
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: rack-test
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: byebug
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: shotgun
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: sinatra
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :runtime
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: sinatra-activerecord
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :runtime
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: sqlite3
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :runtime
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: gli
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :runtime
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
41
  - !ruby/object:Gem::Dependency
168
42
  name: httparty
169
43
  requirement: !ruby/object:Gem::Requirement
@@ -178,83 +52,29 @@ dependencies:
178
52
  - - ">="
179
53
  - !ruby/object:Gem::Version
180
54
  version: '0'
181
- - !ruby/object:Gem::Dependency
182
- name: github-markdown
183
- requirement: !ruby/object:Gem::Requirement
184
- requirements:
185
- - - ">="
186
- - !ruby/object:Gem::Version
187
- version: '0'
188
- type: :runtime
189
- prerelease: false
190
- version_requirements: !ruby/object:Gem::Requirement
191
- requirements:
192
- - - ">="
193
- - !ruby/object:Gem::Version
194
- version: '0'
195
- description: Push notes to a server
55
+ description: Save ideas and reminders in notes accessible from all of your machines.
196
56
  email:
197
57
  - corytheboyd@gmail.com
198
58
  executables:
199
59
  - pushnote
60
+ - pushnoted
200
61
  extensions: []
201
62
  extra_rdoc_files: []
202
63
  files:
203
64
  - ".gitignore"
204
- - ".rspec"
65
+ - ".pushnote.yml"
205
66
  - Gemfile
206
67
  - LICENSE.txt
207
68
  - README.md
208
69
  - Rakefile
209
70
  - bin/pushnote
210
- - config.codekit
211
- - config.ru
212
- - config/database.yml
213
- - db/migrate/20150131202537_create_notes_table.rb
214
- - db/schema.rb
71
+ - bin/pushnoted
215
72
  - lib/pushnote.rb
216
- - lib/pushnote/adapters.rb
217
- - lib/pushnote/adapters/base.rb
218
- - lib/pushnote/adapters/local.rb
219
- - lib/pushnote/app.rb
220
- - lib/pushnote/models/note.rb
221
- - lib/pushnote/public/css/foundation.css
222
- - lib/pushnote/public/css/foundation.min.css
223
- - lib/pushnote/public/css/normalize.css
224
- - lib/pushnote/public/humans.txt
225
- - lib/pushnote/public/img/.gitkeep
226
- - lib/pushnote/public/index.html
227
- - lib/pushnote/public/js/foundation.min.js
228
- - lib/pushnote/public/js/foundation/foundation.abide.js
229
- - lib/pushnote/public/js/foundation/foundation.accordion.js
230
- - lib/pushnote/public/js/foundation/foundation.alert.js
231
- - lib/pushnote/public/js/foundation/foundation.clearing.js
232
- - lib/pushnote/public/js/foundation/foundation.dropdown.js
233
- - lib/pushnote/public/js/foundation/foundation.equalizer.js
234
- - lib/pushnote/public/js/foundation/foundation.interchange.js
235
- - lib/pushnote/public/js/foundation/foundation.joyride.js
236
- - lib/pushnote/public/js/foundation/foundation.js
237
- - lib/pushnote/public/js/foundation/foundation.magellan.js
238
- - lib/pushnote/public/js/foundation/foundation.offcanvas.js
239
- - lib/pushnote/public/js/foundation/foundation.orbit.js
240
- - lib/pushnote/public/js/foundation/foundation.reveal.js
241
- - lib/pushnote/public/js/foundation/foundation.slider.js
242
- - lib/pushnote/public/js/foundation/foundation.tab.js
243
- - lib/pushnote/public/js/foundation/foundation.tooltip.js
244
- - lib/pushnote/public/js/foundation/foundation.topbar.js
245
- - lib/pushnote/public/js/vendor/fastclick.js
246
- - lib/pushnote/public/js/vendor/jquery.cookie.js
247
- - lib/pushnote/public/js/vendor/jquery.js
248
- - lib/pushnote/public/js/vendor/modernizr.js
249
- - lib/pushnote/public/js/vendor/placeholder.js
250
- - lib/pushnote/public/robots.txt
73
+ - lib/pushnote/cli.rb
74
+ - lib/pushnote/configuration.rb
75
+ - lib/pushnote/note.rb
251
76
  - lib/pushnote/version.rb
252
- - lib/pushnote/views/index.erb
253
- - lib/pushnote/views/layout.erb
254
- - lib/pushnote/views/show.erb
255
77
  - pushnote.gemspec
256
- - spec/lib/controllers/notes_spec.rb
257
- - spec/spec_helper.rb
258
78
  homepage: ''
259
79
  licenses:
260
80
  - MIT
@@ -278,7 +98,5 @@ rubyforge_project:
278
98
  rubygems_version: 2.4.5
279
99
  signing_key:
280
100
  specification_version: 4
281
- summary: Push notes
282
- test_files:
283
- - spec/lib/controllers/notes_spec.rb
284
- - spec/spec_helper.rb
101
+ summary: Save small notes
102
+ test_files: []