sticky 0.3.0 → 0.4.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.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/sticky/config.rb +33 -0
- data/lib/sticky/note.rb +1 -1
- data/lib/sticky/store.rb +4 -2
- data/lib/sticky/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 89ac0b828a1379f1a6706805471bae993ad5860a
|
|
4
|
+
data.tar.gz: 2fc23dbea0c0db6aac5a6ed09046700982363823
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b1151b1d54cd20343c95dd04126699d22cb5b5094fa3b84a836f95ef901168dff14dbca7d12373f81e6f4aac40d44a1d757440805527f901a3991e625d9442d0
|
|
7
|
+
data.tar.gz: 8e72822acc1b2206cafc93acf26532d59939953b14d2596f0c1e8e3cf18aa2eb3633035005229151062b8512cc88e77efd741afac487c420c8693f5926093411
|
data/README.md
CHANGED
|
@@ -26,11 +26,12 @@ Delete tagged entries with:
|
|
|
26
26
|
|
|
27
27
|
$ sticky delete -t my-tag
|
|
28
28
|
|
|
29
|
+
You can also specify a config file, `$HOME/.sticky.config`. It is a simple YAML file (currently only supports the path to the sticky notes `sticky_path: path/to/file`).
|
|
30
|
+
|
|
29
31
|
## TODO
|
|
30
32
|
|
|
31
33
|
* Display last N sticky notes
|
|
32
34
|
* Multiple tags
|
|
33
|
-
* Move some dependencies out of Sticky::Note
|
|
34
35
|
* Implement specs
|
|
35
36
|
|
|
36
37
|
## Development
|
|
@@ -43,7 +44,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
|
43
44
|
|
|
44
45
|
Bug reports and pull requests are welcome on GitHub at https://github.com/arturts/sticky.
|
|
45
46
|
|
|
46
|
-
|
|
47
47
|
## License
|
|
48
48
|
|
|
49
49
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module Sticky
|
|
2
|
+
class Config
|
|
3
|
+
|
|
4
|
+
def initialize
|
|
5
|
+
@config = {
|
|
6
|
+
store: "YAML::Store",
|
|
7
|
+
sticky_path: File.join(Dir.home, ".sticky.yml")
|
|
8
|
+
}.merge(config_overrides)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def fetch(key)
|
|
12
|
+
@config[key]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def config_overrides
|
|
18
|
+
YAML.load(config_file).tap do |yaml|
|
|
19
|
+
yaml.keys.each do |key|
|
|
20
|
+
yaml[key.to_sym] = yaml.delete(key)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def config_file
|
|
26
|
+
File.exists?(config_path) ? File.open(config_path) : "{}"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def config_path
|
|
30
|
+
File.join(Dir.home, ".sticky.config")
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
data/lib/sticky/note.rb
CHANGED
data/lib/sticky/store.rb
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
require "yaml/store"
|
|
2
|
+
require "sticky/config"
|
|
2
3
|
|
|
3
4
|
module Sticky
|
|
4
5
|
class Store
|
|
5
6
|
attr_reader :store
|
|
6
7
|
|
|
7
|
-
def initialize(
|
|
8
|
-
|
|
8
|
+
def initialize(config = Sticky::Config.new)
|
|
9
|
+
klass = Object.const_get(config.fetch(:store))
|
|
10
|
+
@store = klass.new(config.fetch(:sticky_path))
|
|
9
11
|
end
|
|
10
12
|
|
|
11
13
|
def fetch(tag = nil, date = nil)
|
data/lib/sticky/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sticky
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Artur de Oliveira Tsuda
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-08-
|
|
11
|
+
date: 2016-08-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: thor
|
|
@@ -102,6 +102,7 @@ files:
|
|
|
102
102
|
- bin/setup
|
|
103
103
|
- bin/sticky
|
|
104
104
|
- lib/sticky.rb
|
|
105
|
+
- lib/sticky/config.rb
|
|
105
106
|
- lib/sticky/note.rb
|
|
106
107
|
- lib/sticky/store.rb
|
|
107
108
|
- lib/sticky/version.rb
|