pushnote 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 02f0fcafe734853ef988ad44440286f3555def74
4
- data.tar.gz: 0e5589aba69827aa38c02bdb402d5b6bab4f0ae5
3
+ metadata.gz: a230250206d6096770d9d755e797ad81dedfd182
4
+ data.tar.gz: c11f7d51daaafcf6468f6ff9fab10647c0c329a8
5
5
  SHA512:
6
- metadata.gz: cde1100ac42ad9c6a128d5164f271bc3a02db8948527b236cdeb820279551fba3527c3b4a57916d910b272f4fad9eab859997e0c57e9f784f382ff5f7d68b359
7
- data.tar.gz: 210369e532dad13c540d479b15113eb04ac3c5b1a790a4b985a91e0a823915bc9dd3d97100e0e9495924fe46078a054e093c433749dcf16f42e0535a0979fe4a
6
+ metadata.gz: cf6e34ec427bcf1b0b66d1d0d9d2df4e855efa27e9ff7709f6539931ac9bf1be0cc4322dacf34652c2cc5be24c5d91d950e8fa8a70d861a0eb89ac863fe4570e
7
+ data.tar.gz: 538cb5ac6b0d9bd6a3d446ff3aa5c9f347136b89041714c053f8f696917feac189b87f2a47a9d3ede12646bd31026369ca7db23093a032eeb10fe25fb70a382b
@@ -0,0 +1 @@
1
+ server: http://localhost:3000
@@ -1,3 +1,4 @@
1
1
  require "pushnote/version"
2
2
  require "pushnote/cli"
3
3
  require "pushnote/note"
4
+ require "pushnote/configuration"
@@ -2,10 +2,9 @@ require 'optparse'
2
2
 
3
3
  module Pushnote
4
4
  class Cli
5
- attr_reader :argv, :note
5
+ attr_reader :note, :configuration
6
6
 
7
7
  def initialize(argv)
8
- @argv = argv
9
8
  @note = Note.new
10
9
  parse_options
11
10
  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
@@ -4,11 +4,14 @@ module Pushnote
4
4
  class Note
5
5
  include HTTParty
6
6
 
7
- base_uri 'http://localhost:3000'
8
7
  headers 'Content-Type' => 'application/json', 'Accept' => 'application/json'
9
8
 
10
9
  attr_accessor :title, :body
11
10
 
11
+ def initialize
12
+ set_server_host(configuration.server)
13
+ end
14
+
12
15
  def save
13
16
  self.class.post('/notes', { body: serialize.to_json })
14
17
  end
@@ -25,5 +28,9 @@ module Pushnote
25
28
  body: body
26
29
  }
27
30
  end
31
+
32
+ def configuration
33
+ @configuration ||= Configuration.new
34
+ end
28
35
  end
29
36
  end
@@ -1,3 +1,3 @@
1
1
  module Pushnote
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  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: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cory Boyd
@@ -61,6 +61,7 @@ extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
63
  - ".gitignore"
64
+ - ".pushnote.yml"
64
65
  - Gemfile
65
66
  - LICENSE.txt
66
67
  - README.md
@@ -68,6 +69,7 @@ files:
68
69
  - bin/pushnote
69
70
  - lib/pushnote.rb
70
71
  - lib/pushnote/cli.rb
72
+ - lib/pushnote/configuration.rb
71
73
  - lib/pushnote/note.rb
72
74
  - lib/pushnote/version.rb
73
75
  - pushnote.gemspec