notes_cli 0.1.1 → 1.0.0

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
  SHA256:
3
- metadata.gz: 9116434ebc4d28d1fe93265e5d2e6c53b80f4f797fd1f4c6f6df61b8eeb107da
4
- data.tar.gz: e0439a171aa589f4c47a8e93e8116b7e5277e87779502cd7cf5f8047f174a4a7
3
+ metadata.gz: 6624e27858770f04d3c3b2eb740c55c3c688bf23a76b996b27aad967ec5a4734
4
+ data.tar.gz: f1d493a601faa6ee2f1925cb1e4a7362e755471d47005fa43327c69f599399f2
5
5
  SHA512:
6
- metadata.gz: e02811149e6569fc66229af97f2b15c55148183f762c2bda57b7b0904f973e44e05f2fc98a95f0f4393b71e0d1bb0c8924db17c70a7d8ea6c042c0860feb3a30
7
- data.tar.gz: d34480da81a40a5fed95e6e62f0b4bf92da18f9e6bc9e6e6a83f7aa49e5e36bdeab18eb0a66e4bd2705bff9d6b2d1344cfced08351d9a0eacd20528ac45fe8d0
6
+ metadata.gz: e5e8f1bd09caec7c073c9c3d7a416a7825290ecaf623cbbe13f0ca91db19be563dba61eb5356d56966e4687ddec5401e11b9bd08e3090ab8c586cb5f1c1b709d
7
+ data.tar.gz: 8440c749b88e8d4f8ae7108cf133aeb7f75e27b1684bc0e8be03a9fa7391546b54702ad5e8357686caef774a3d27402ed83573e2e15f9653cc6713cb24b52233
@@ -0,0 +1,30 @@
1
+ # Changelog
2
+
3
+ ## 0.0.0
4
+ Core functionalities implemented.
5
+
6
+ ## 0.1.0
7
+ Specify gem versions in Gemspec.
8
+
9
+ ## 0.1.1
10
+ Add install instruction to documentation.
11
+
12
+ ## 0.1.2
13
+ Minor refactor of `NoteLister`, adding a previously missing private section.
14
+
15
+ ## 0.1.3
16
+ Amend available commands and README to provide accurate documentation.
17
+
18
+ ## 0.1.4
19
+ Fix punctuation inconsistencies in documentation.
20
+
21
+ ## 0.1.5
22
+ Removes require statements for debuggers out of the main app.
23
+ Adds about section.
24
+
25
+ ## 0.2.0
26
+ Introduce `notes -e --editor` to allow users to set their favourite editor to open notebooks with.
27
+ Add `notes -o --open_notebook` to allow users to open a notebook in the context of their favourite editors.
28
+
29
+ ## 1.0.0
30
+ Specify a ruby version of 2.6.5.
@@ -1,21 +1,21 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- notes_cli (0.0.0)
4
+ notes_cli (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- ast (2.4.0)
9
+ ast (2.4.1)
10
10
  byebug (11.1.3)
11
11
  coderay (1.1.2)
12
12
  diff-lcs (1.3)
13
13
  docile (1.3.2)
14
- fakefs (1.2.2)
14
+ fakefs (0.20.1)
15
15
  method_source (1.0.0)
16
- parallel (1.19.1)
17
- parser (2.7.1.2)
18
- ast (~> 2.4.0)
16
+ parallel (1.19.2)
17
+ parser (2.7.2.0)
18
+ ast (~> 2.4.1)
19
19
  pry (0.13.1)
20
20
  coderay (~> 1.1)
21
21
  method_source (~> 1.0)
@@ -23,6 +23,7 @@ GEM
23
23
  byebug (~> 11.0)
24
24
  pry (~> 0.13.0)
25
25
  rainbow (3.0.0)
26
+ regexp_parser (1.8.2)
26
27
  rexml (3.2.4)
27
28
  rspec (3.9.0)
28
29
  rspec-core (~> 3.9.0)
@@ -37,16 +38,17 @@ GEM
37
38
  diff-lcs (>= 1.2.0, < 2.0)
38
39
  rspec-support (~> 3.9.0)
39
40
  rspec-support (3.9.3)
40
- rubocop (0.84.0)
41
+ rubocop (0.93.1)
41
42
  parallel (~> 1.10)
42
- parser (>= 2.7.0.1)
43
+ parser (>= 2.7.1.5)
43
44
  rainbow (>= 2.2.2, < 4.0)
45
+ regexp_parser (>= 1.8)
44
46
  rexml
45
- rubocop-ast (>= 0.0.3)
47
+ rubocop-ast (>= 0.6.0)
46
48
  ruby-progressbar (~> 1.7)
47
49
  unicode-display_width (>= 1.4.0, < 2.0)
48
- rubocop-ast (0.0.3)
49
- parser (>= 2.7.0.1)
50
+ rubocop-ast (0.8.0)
51
+ parser (>= 2.7.1.5)
50
52
  ruby-progressbar (1.10.1)
51
53
  simplecov (0.18.5)
52
54
  docile (~> 1.1)
@@ -58,13 +60,13 @@ PLATFORMS
58
60
  ruby
59
61
 
60
62
  DEPENDENCIES
61
- fakefs
63
+ fakefs (~> 0.5)
62
64
  notes_cli!
63
- pry
64
- pry-byebug
65
- rspec
66
- rubocop
67
- simplecov
65
+ pry (~> 0.12)
66
+ pry-byebug (~> 3.9)
67
+ rspec (~> 3.9)
68
+ rubocop (~> 0.86)
69
+ simplecov (~> 0.18)
68
70
 
69
71
  BUNDLED WITH
70
72
  1.17.2
data/README.md CHANGED
@@ -1,3 +1,8 @@
1
+ # About
2
+ Easily create, delete and list all your notes.
3
+ NotesCli lets you create workspaces and notebooks in which you can store notes.
4
+ Notes are created as md files for ease of storing code snippets.
5
+
1
6
  # Installation
2
7
  ```bash
3
8
  gem install notes_cli
@@ -5,25 +10,30 @@ gem install notes_cli
5
10
 
6
11
  # Getting started
7
12
 
8
- Tell notes_cli where your notes will be stored.
13
+ Tell notes_cli where your notes will be stored
9
14
  ```bash
10
15
  notes --notes_folder path/to/where/you/will/store/notes
11
16
  ```
12
17
 
13
- Define your first workspace.
18
+ Define your first workspace
14
19
  ```bash
15
20
  notes -w workspace_name
16
21
  ```
17
22
 
23
+ Set your default editor
24
+ ```bash
25
+ notes -e subl
26
+ ```
27
+
18
28
  # DSL
19
29
  ## Notes folder
20
- Where you will store all notes, including your workspaces and notebooks as the top layers.
30
+ Where you will store all notes, including your workspaces and notebooks as the top layers
21
31
 
22
32
  ## Workspace
23
- Where you will store notebooks.
33
+ Where you will store notebooks
24
34
 
25
35
  ## Notebook
26
- Where you will store notes.
36
+ Where you will store notes
27
37
 
28
38
  ## Example
29
39
  Basic case scenario, where:
@@ -52,12 +62,12 @@ notes
52
62
  ```
53
63
 
54
64
  ## Create
55
- ### Create a note in the current workspace
65
+ Create a note in the current workspace
56
66
  ```bash
57
67
  notes -n notebook note_title
58
68
  ```
59
69
 
60
- ### Creating a note in a nested notebook
70
+ Creating a note in a nested notebook
61
71
  ```bash
62
72
  notes -n path/to/notebook note_title
63
73
  ```
@@ -96,6 +106,12 @@ Listing all notes in a given notebook
96
106
  notes -l notebook
97
107
  ```
98
108
 
109
+ ## Open
110
+ Open a notebook in the context of your favourite editor
111
+ ```bash
112
+ notes -o notebook
113
+ ```
114
+
99
115
  ## Switch
100
116
  Switching workspace
101
117
  ```bash
@@ -105,4 +121,11 @@ notes -w workspace_name
105
121
  Switching workspace and creating a note there
106
122
  ```bash
107
123
  notes -w workspace_name -n notebook note_title
108
- ```
124
+ ```
125
+
126
+ ## Help
127
+ Display available commands
128
+
129
+ ```bash
130
+ notes --help
131
+ ```
@@ -6,8 +6,6 @@ module NotesCli
6
6
  CONFIG_PATH = File.join(LIBRARY, 'config.yml')
7
7
  end
8
8
 
9
- require 'pry'
10
- require 'pry-byebug'
11
9
  require 'yaml'
12
10
  require 'fileutils'
13
11
  require 'optparse'
@@ -8,22 +8,26 @@ if ARGV.empty?
8
8
  end
9
9
 
10
10
  OptionParser.new do |opt|
11
- opt.on('-n --new_note TITLE PATH/TO/FILE') { |option| workspace.create_note(option, ARGV) }
11
+ opt.on('-n --new_note NOTEBOOK NOTE_TITLE') { |option| workspace.create_note(option, ARGV) }
12
12
 
13
- opt.on('-d --delete_note TITLE PATH/TO/FILE ') { |option| workspace.delete_note(option, ARGV) }
13
+ opt.on('-d --delete_note NOTEBOOK NOTE_TITLE ') { |option| workspace.delete_note(option, ARGV) }
14
14
 
15
- opt.on('-l --list_notes TITLE PATH/TO/NOTEBOOK') do |option|
15
+ opt.on('-l --list_notes NOTEBOOK NOTE_TITLE') do |option|
16
16
  workspace.list_notes(option)
17
17
  end
18
18
 
19
+ opt.on('-o --open_notebook NOTEBOOK') { |option| workspace.open_notebook(option) }
20
+
21
+ opt.on('-e --editor EDITOR') { |option| workspace.update_entry('editor', option) }
22
+
19
23
  opt.on('-w --workspace WORKSPACE') do |option|
20
24
  puts "Switched to #{option} wokspace" if workspace.switch(option)
21
- end
25
+ end
22
26
 
23
27
  opt.on('--notes_folder PATH/TO/FOLDER') do |option|
24
28
  workspace.update_entry('notes_folder', option)
25
29
  end
26
-
30
+
27
31
  opt.on('--which_workspace ANY_CHARACTER') do |_option|
28
32
  puts "Current workspace is #{workspace.current_workspace}"
29
33
  end
@@ -19,12 +19,22 @@ class Workspace
19
19
  NoteLister.new(notebook).call
20
20
  end
21
21
 
22
+ def open_notebook(notebook)
23
+ system("#{editor} #{notebook_path(notebook)}")
24
+ end
25
+
22
26
  def switch(workspace)
23
27
  return unless workspace_exists?(workspace) || create?('workspace')
24
28
 
25
29
  update_entry('workspace', workspace)
26
30
  end
27
31
 
32
+ def editor
33
+ return config['editor'] if config && config['editor']
34
+
35
+ raise StandardError, 'Please set your editor'
36
+ end
37
+
28
38
  def update_entry(key, value)
29
39
  current_config = config
30
40
  current_config ? current_config[key] = value.strip.chomp : current_config = { key => value }
@@ -14,6 +14,8 @@ class NoteLister
14
14
  empty_notebook_notification
15
15
  end
16
16
 
17
+ private
18
+
17
19
  def handle_errors
18
20
  raise StandardError, 'no such notebook' unless notebook_exists?(@notebook)
19
21
  end
@@ -1,3 +1,3 @@
1
1
  module NotesCli
2
- VERSION = '0.1.1'
2
+ VERSION = '1.0.0'
3
3
  end
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.homepage =
23
23
  'https://github.com/joe-at-github/notes_cli'
24
24
  s.license = 'MIT'
25
+ s.required_ruby_version = Gem::Requirement.new('>= 2.6.5')
25
26
  s.add_development_dependency 'fakefs', '~> 0.5'
26
27
  s.add_development_dependency 'pry', '~> 0.12'
27
28
  s.add_development_dependency 'pry-byebug', '~> 3.9'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notes_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joeffrey Lamy
@@ -105,13 +105,12 @@ extra_rdoc_files: []
105
105
  files:
106
106
  - ".gitignore"
107
107
  - ".rspec"
108
+ - CHANGELOG.md
108
109
  - Gemfile
109
110
  - Gemfile.lock
110
111
  - LICENSE.txt
111
112
  - README.md
112
113
  - bin/notes
113
- - config.db
114
- - config.yml.db
115
114
  - lib/notes_cli.rb
116
115
  - lib/notes_cli/controllers/option_parser.rb
117
116
  - lib/notes_cli/models/workspace.rb
@@ -135,7 +134,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
134
  requirements:
136
135
  - - ">="
137
136
  - !ruby/object:Gem::Version
138
- version: '0'
137
+ version: 2.6.5
139
138
  required_rubygems_version: !ruby/object:Gem::Requirement
140
139
  requirements:
141
140
  - - ">="
data/config.db DELETED
Binary file
Binary file