recollect 0.0.1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f81e3005b101852633f48d786a7e5ec784a22f24
4
+ data.tar.gz: b6e1d9c8c52b8409bdb55c652ee07e20e8d500aa
5
+ SHA512:
6
+ metadata.gz: 78ff54fa471dce776dc219db37608773b7685ee69078c425dc49f375fe1c00146c41fd6942688250312add7587cff29623a2d785c681485ddf4228face6f2441
7
+ data.tar.gz: 3974c2e56cce5b7ee556540b866bfe0af02fedbaecdc231a2aaf4f13adb2270df516a158b6b1dc934b62f809687542b782103b017b56635019b96d32106502f2
@@ -0,0 +1 @@
1
+ recollect
@@ -0,0 +1 @@
1
+ ruby-2.4.1
File without changes
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2017 Tyler Poland.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,19 @@
1
+ # Recollect
2
+ A simple tool for creating, managing, and viewing snippets, notes, or pretty much any other text-based content at the command line. The original purpose was to store infrequently used complex command strings in a location where they could easily be indexed and retrieved.
3
+
4
+ *Note* If you find yourself outlining complex procedures, you should consider if a shared team knowledge base might be a better fit.
5
+
6
+ ### Installation
7
+
8
+ gem install recollect
9
+
10
+ If you haven't already, you should set your EDITOR. On OSX you can set it to Textmate with a command like:
11
+
12
+ echo 'export EDITOR="mate -w" >> ~/.bash_profile
13
+
14
+ ### Walkthrough
15
+
16
+
17
+
18
+
19
+
data/TODO ADDED
@@ -0,0 +1,16 @@
1
+ Known Issues:
2
+
3
+ - Add an open license
4
+ - Convert to Ruby functionality only (no shell commands)
5
+ - Need to reserve words so topics can't be (new, edit, remove, list, search)
6
+
7
+ Feature Requests:
8
+
9
+ - Make snippets directory ${HOME}/.recollect/
10
+ - Build in paging functionality
11
+ - Needs to obey ${EDITOR} environment variable (how does this play on Windows?)
12
+ - Allow for the creation of nested snippets (sub-directories)
13
+ - when listing, count topics in subdirectories but don't list the individual snippets
14
+ - Add a search functionality that lists the snippet(s) containing the item searched for along with any matching content lines
15
+ - Create a mobile app synced via dropbox?
16
+ - add support for markdown instead of just txt files
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib', 'recollect'))
4
+
5
+ require 'recollect'
6
+
7
+ Recollect::Recollection.new(ARGV).run
@@ -0,0 +1,105 @@
1
+ require 'fileutils'
2
+
3
+ module Recollect
4
+ class Recollection
5
+ def initialize(args)
6
+ @reserved = %w[new edit remove help]
7
+ usage unless args.length >= 1 && args.length <= 2
8
+ @action, @name = args
9
+ usage if @reserved.include?(@action) && args.length < 2
10
+ usage if args.length == 2 && @reserved.include?(@name)
11
+ @separator = '-------------------------'
12
+ @recollect_path = File.join(ENV['HOME'], '.recollections')
13
+ FileUtils.mkdir_p(@recollect_path)
14
+ end
15
+
16
+ def usage(msg = nil)
17
+ puts msg unless msg.nil?
18
+ puts "USAGE: recollect ACTION [arg]"
19
+ puts ' Actions: list, new, edit, or <name> where <name> is the recollection to be displayed.'
20
+ puts ' list - provides a listing of all available recollections'
21
+ puts " name - displays the recollection matching 'name'"
22
+ puts ' new [name] - provides a listing of all available recollections'
23
+ puts ' edit [name] - provides a listing of all available recollections'
24
+ puts ' remove [name] - removes a recollections'
25
+ puts "Note: #{@reserved} are reserved and cannot be the name of a recollection."
26
+ exit 1
27
+ end
28
+
29
+ def recollection_names
30
+ recollections.map { |r| File.basename(r, File.extname(r)) }
31
+ end
32
+
33
+ def recollections
34
+ @recollections ||= Dir.glob(File.join(@recollect_path, '**'))
35
+ end
36
+
37
+ def verify_name(item = @name)
38
+ unless item_exists?(item)
39
+ puts "Unable to find a recollecter matching '#{item}'"
40
+ usage
41
+ end
42
+ end
43
+
44
+ def item_exists?(item)
45
+ recollections.find { |e| /#{item}\./ =~ e }
46
+ end
47
+
48
+ def write_file
49
+ `#{ENV['EDITOR']} #{File.join(@recollect_path, @name) + '.txt'}`
50
+ end
51
+
52
+ def list_recollections
53
+ puts "Available recollections:\n#{@separator}"
54
+ puts recollection_names.map { |r| ' ' + r }
55
+ end
56
+
57
+ def new_recollection
58
+ msg = "'#{@name}' Already exists; use edit to change."
59
+ abort msg if item_exists?(@name)
60
+ write_file
61
+ end
62
+
63
+ def edit_recollection
64
+ verify_name
65
+ write_file
66
+ end
67
+
68
+ def remove_recollection
69
+ verify_name
70
+ File.delete(File.join(@recollect_path, @name) + '.txt') if confirm?
71
+ end
72
+
73
+ def print_recollection
74
+ verify_name(@action)
75
+ puts @separator
76
+ #puts `cat #{File.join(@recollect_path, @action) + '.*'}`
77
+ File.open(File.join(@recollect_path, @action) + '.txt', 'r') do |f|
78
+ f.each_line do |line|
79
+ puts line
80
+ end
81
+ end
82
+ end
83
+
84
+ def confirm?
85
+ puts "Are you sure you want to remove #{@name} [Y/n]?"
86
+ a = $stdin.gets.chomp.downcase
87
+ a == 'y' ? true : false
88
+ end
89
+
90
+ def run
91
+ case @action
92
+ when 'list'
93
+ list_recollections
94
+ when 'new'
95
+ new_recollection
96
+ when 'edit'
97
+ edit_recollection
98
+ when 'remove'
99
+ remove_recollection
100
+ else
101
+ print_recollection
102
+ end
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,3 @@
1
+ module Recollect
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,20 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
2
+ require 'recollect/version'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'recollect'
6
+ s.version = Recollect::VERSION
7
+ s.authors = ['Tyler Poland']
8
+ s.email = 'recollect@tylerpoland.com'
9
+ s.homepage = 'http://github.com/tpoland/recollect'
10
+ s.summary = "Storage, Management and Retrieval of things you'd like to remember (recollect)."
11
+ s.description = s.summary
12
+ s.platform = Gem::Platform::RUBY
13
+ s.required_ruby_version = '~> 1.9'
14
+ s.has_rdoc = true
15
+ s.extra_rdoc_files = %w[LICENSE TODO]
16
+ s.bindir = 'bin'
17
+ s.executables = %w[recollect]
18
+ s.default_executable = 'recollect'
19
+ s.files = `git ls-files`.split("\n")
20
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: recollect
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Tyler Poland
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-04-26 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Storage, Management and Retrieval of things you'd like to remember (recollect).
14
+ email: recollect@tylerpoland.com
15
+ executables:
16
+ - recollect
17
+ extensions: []
18
+ extra_rdoc_files:
19
+ - LICENSE
20
+ - TODO
21
+ files:
22
+ - ".ruby-gemset"
23
+ - ".ruby-version"
24
+ - CHANGELOG
25
+ - LICENSE
26
+ - README.md
27
+ - TODO
28
+ - bin/recollect
29
+ - lib/recollect/recollect.rb
30
+ - lib/recollect/version.rb
31
+ - recollect.gemspec
32
+ homepage: http://github.com/tpoland/recollect
33
+ licenses: []
34
+ metadata: {}
35
+ post_install_message:
36
+ rdoc_options: []
37
+ require_paths:
38
+ - lib
39
+ required_ruby_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '1.9'
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ requirements: []
50
+ rubyforge_project:
51
+ rubygems_version: 2.6.11
52
+ signing_key:
53
+ specification_version: 4
54
+ summary: Storage, Management and Retrieval of things you'd like to remember (recollect).
55
+ test_files: []