intent 0.5.5 → 0.6.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: 63f5433d3a5bff8c95271194b5bc5df740274ae9d42f405f16a1bf11a5f11cc3
4
- data.tar.gz: a7fc46a07d03ce70c2339d3cc535038a040fb60847ad224997e57316642e1ec8
3
+ metadata.gz: 86c9e5d7f4f81b1db6abe7c6fbd2ec7daebbfef06abaa05e3129697743648e63
4
+ data.tar.gz: ca5a9c91a8ee077bc018c0b5a2251d6e84dfbc4ab2ce371a1fff96dfc65596bc
5
5
  SHA512:
6
- metadata.gz: a314b0917a17bce8e386964fcdfaa4c791f2ed36168428fd9412ddace6c4e847efc1a831519c8d095ee1721bd4e60e4c2a5265a895ef202d2cbdc8d8ec507247
7
- data.tar.gz: 82607a04b4d1d3f8a91f78a3dc1cba8e2c0dd4e82348fb1dc98b1270e76d32de543d9977a88643495c019529b2fed317cd6e68481009bd9376fbeef1e956390a
6
+ metadata.gz: de2d74dc9068848a13f5b85d6fd58aefb0381d908e9ff7e2f0d2d81c688afd715dc7bc3d50b584650c3acbc5596cb4ebcd010a5c3b37de4a4ea52f296a3a2ed1
7
+ data.tar.gz: f8b7273cb674c0cd9336a1d3acac3cc88a96e31d2a1cf9736ddf03f9d1c56bd5b8aa2ab7112c62655283b78a40d99f2ae70679cb101e3e02f509a66741c05834
data/bin/project_doc ADDED
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+ require "tty-markdown"
3
+ require "tty-pager"
4
+
5
+ PROJECTS_PATH = File.dirname(ENV['TODO_TXT'])
6
+
7
+ class ProjectDocCommand
8
+ def self.print_help(output)
9
+ output.puts "Pass in a project name to read its main document."
10
+ output.puts "Future iterations could display a list of available documents."
11
+ # Command idea: Add milestone to document
12
+ end
13
+
14
+ def self.run(args, output=STDOUT)
15
+ if args.empty?
16
+ print_help(output)
17
+ else
18
+ project_name = args.first.delete("^0–9a-z\-")
19
+ project_path = "#{PROJECTS_PATH}/#{project_name}"
20
+
21
+ if Dir.exists?(project_path)
22
+ pager = TTY::Pager.new
23
+ intent = File.read("#{project_path}/#{project_name}.md")
24
+ pager.page(TTY::Markdown.parse(intent))
25
+ end
26
+ end
27
+ end
28
+ end
29
+
30
+ ProjectDocCommand.run(ARGV.dup)
@@ -0,0 +1,123 @@
1
+ #!/usr/bin/env ruby
2
+ require "tty-box"
3
+ require "tty-screen"
4
+ require "tty-reader"
5
+ require "tty-cursor"
6
+ require "tty-pager"
7
+ require "pastel"
8
+ require "todo-txt"
9
+
10
+ list = Todo::List.new(ENV['TODO_TXT'])
11
+
12
+ box = TTY::Box.frame(
13
+ width: TTY::Screen.width,
14
+ height: TTY::Screen.height-1,
15
+ align: :center,
16
+ border: :thick,
17
+ style: {
18
+ fg: :bright_yellow,
19
+ border: {
20
+ fg: :white,
21
+ }
22
+ }
23
+ )
24
+
25
+ focus_index = 0
26
+
27
+ def truncate(str, width)
28
+ return str unless str.length >= width
29
+
30
+ "#{str.slice(0, width-3)}..."
31
+ end
32
+
33
+ def draw_card(top, item, focus)
34
+
35
+ style = unless top == focus
36
+ { fg: :white, border: { fg: :white } }
37
+ else
38
+ { fg: :bright_white, border: { fg: :bright_magenta, bg: :black } }
39
+ end
40
+
41
+ title = if top == focus
42
+ {bottom_right: "[x: close][enter: launch]"}
43
+ else
44
+ {}
45
+ end
46
+
47
+ #pastel = Pastel.new
48
+ width = 90
49
+
50
+ TTY::Box.frame(width: width, height: 4, left: 4, title: title, border: :thick, style: style) do
51
+ "\s#{truncate(item[:title], 88)}"
52
+ end
53
+ end
54
+
55
+ projects = [
56
+ { title: "maetl", index: File.read(File.expand_path("~/Documents/Projects/maetl/maetl.md")) },
57
+ { title: "calyx", index: File.read(File.expand_path("~/Documents/Projects/calyx/calyx.md")) },
58
+ { title: "yarrow", index: File.read(File.expand_path("~/Documents/Projects/yarrow/yarrow.md")) }
59
+ ]
60
+
61
+ items_per_page = (TTY::Screen.height-1) / 4
62
+
63
+ # items = list.by_not_done.by_context("@reading").slice(0, items_per_page).map do |item|
64
+ # { title: item.text, href: item.text }
65
+ # end
66
+
67
+ $cursor = TTY::Cursor
68
+ #print $cursor.hide
69
+
70
+ def draw_list(items, focus)
71
+ buffer = []
72
+ items.each_with_index do |item, i|
73
+ buffer << draw_card(i, item, focus)
74
+ end
75
+ result = buffer.join("")
76
+
77
+ print $cursor.clear_screen + $cursor.move_to(0,0)
78
+ print result
79
+ end
80
+
81
+ draw_list(projects, focus_index)
82
+
83
+ reader = TTY::Reader.new(interrupt: :exit)
84
+
85
+ reader.on(:keyctrl_x, :keyescape) do
86
+ print $cursor.clear_screen + $cursor.move_to(0,0)
87
+ print $cursor.show
88
+ exit
89
+ end
90
+
91
+ reader.on(:keytab, :keydown) do
92
+ if focus_index == projects.count - 1
93
+ focus_index = 0
94
+ else
95
+ focus_index += 1
96
+ end
97
+ draw_list(projects, focus_index)
98
+ end
99
+
100
+ reader.on(:keyup) do
101
+ if focus_index == 0
102
+ focus_index = projects.count - 1
103
+ else
104
+ focus_index -= 1
105
+ end
106
+ draw_list(projects, focus_index)
107
+ end
108
+
109
+ reader.on(:keypress) do |key|
110
+ # if key.value == "x"
111
+ # items.delete_at(focus_index)
112
+ # focus_index -= 1 if focus_index >= items.count
113
+ # draw_list(items, focus_index)
114
+ # end
115
+ end
116
+
117
+ reader.on(:keyenter) do
118
+ `chrome-cli open #{items[focus_index][:href]}`
119
+ end
120
+
121
+ loop do
122
+ reader.read_line(echo: false)
123
+ end
data/bin/todo_review ADDED
@@ -0,0 +1,123 @@
1
+ #!/usr/bin/env ruby
2
+ require "tty-box"
3
+ require "tty-screen"
4
+ require "tty-reader"
5
+ require "tty-cursor"
6
+ require "tty-pager"
7
+ require "pastel"
8
+ require "todo-txt"
9
+
10
+ list = Todo::List.new(ENV['TODO_TXT'])
11
+
12
+ box = TTY::Box.frame(
13
+ width: TTY::Screen.width,
14
+ height: TTY::Screen.height-1,
15
+ align: :center,
16
+ border: :thick,
17
+ style: {
18
+ fg: :bright_yellow,
19
+ border: {
20
+ fg: :white,
21
+ }
22
+ }
23
+ )
24
+
25
+ focus_index = 0
26
+
27
+ def truncate(str, width)
28
+ return str unless str.length >= width
29
+
30
+ "#{str.slice(0, width-3)}..."
31
+ end
32
+
33
+ def draw_card(top, item, focus)
34
+
35
+ style = unless top == focus
36
+ { fg: :white, border: { fg: :white } }
37
+ else
38
+ { fg: :bright_white, border: { fg: :bright_magenta, bg: :black } }
39
+ end
40
+
41
+ title = if top == focus
42
+ {bottom_right: "[x: close][enter: launch]"}
43
+ else
44
+ {}
45
+ end
46
+
47
+ #pastel = Pastel.new
48
+ width = 90
49
+
50
+ TTY::Box.frame(width: width, height: 4, left: 4, title: title, border: :thick, style: style) do
51
+ "\s#{truncate(item[:title], 88)}\n\s#{truncate(item[:href], 88)}"
52
+ end
53
+ end
54
+
55
+ items = [
56
+ { title: "maetl website", href: "https://maetl.net/" },
57
+ { title: "tty-cursor on Github", href: "https://github.com/piotrmurach/tty-cursor" },
58
+ { title: "Tangram Design", href: "https://tangram.co.nz" },
59
+ ]
60
+
61
+ items_per_page = (TTY::Screen.height-1) / 4
62
+
63
+ items = list.by_not_done.by_context("@reading").slice(0, items_per_page).map do |item|
64
+ { title: item.text, href: item.text }
65
+ end
66
+
67
+ $cursor = TTY::Cursor
68
+ print $cursor.hide
69
+
70
+ def draw_list(items, focus)
71
+ buffer = []
72
+ items.each_with_index do |item, i|
73
+ buffer << draw_card(i, item, focus)
74
+ end
75
+ result = buffer.join("")
76
+
77
+ print $cursor.clear_screen + $cursor.move_to(0,0)
78
+ print result
79
+ end
80
+
81
+ draw_list(items, focus_index)
82
+
83
+ reader = TTY::Reader.new(interrupt: :exit)
84
+
85
+ reader.on(:keyctrl_x, :keyescape) do
86
+ print $cursor.clear_screen + $cursor.move_to(0,0)
87
+ print $cursor.show
88
+ exit
89
+ end
90
+
91
+ reader.on(:keytab, :keydown) do
92
+ if focus_index == items.count - 1
93
+ focus_index = 0
94
+ else
95
+ focus_index += 1
96
+ end
97
+ draw_list(items, focus_index)
98
+ end
99
+
100
+ reader.on(:keyup) do
101
+ if focus_index == 0
102
+ focus_index = items.count - 1
103
+ else
104
+ focus_index -= 1
105
+ end
106
+ draw_list(items, focus_index)
107
+ end
108
+
109
+ reader.on(:keypress) do |key|
110
+ if key.value == "x"
111
+ items.delete_at(focus_index)
112
+ focus_index -= 1 if focus_index >= items.count
113
+ draw_list(items, focus_index)
114
+ end
115
+ end
116
+
117
+ reader.on(:keyenter) do
118
+ `chrome-cli open #{items[focus_index][:href]}`
119
+ end
120
+
121
+ loop do
122
+ reader.read_line(echo: false)
123
+ end
data/intent.gemspec CHANGED
@@ -18,14 +18,13 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_runtime_dependency "todo-txt", "~> 0.11"
22
- spec.add_runtime_dependency "pastel", "~> 0.6"
23
- spec.add_runtime_dependency "git", "~> 1.3.0"
24
- spec.add_runtime_dependency "terminal-notifier", "~> 1.8.0"
21
+ spec.add_runtime_dependency "todo-txt", "~> 0.12"
22
+ spec.add_runtime_dependency "pastel", "~> 0.8"
23
+ spec.add_runtime_dependency "git", "~> 1.9.1"
24
+ spec.add_runtime_dependency "terminal-notifier", "~> 2.0"
25
25
  spec.add_runtime_dependency "ghost", "~> 1.0.0"
26
26
 
27
-
28
- spec.add_development_dependency "bundler", "~> 1.10"
29
- spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "bundler"
28
+ spec.add_development_dependency "rake"
30
29
  spec.add_development_dependency "rspec"
31
30
  end
@@ -0,0 +1,90 @@
1
+ require "tty-box"
2
+ require "tty-screen"
3
+ require "tty-reader"
4
+ require "tty-cursor"
5
+ require "tty-pager"
6
+ require "pastel"
7
+ require "todo-txt"
8
+
9
+ module Intent
10
+ module UI
11
+ class Panel
12
+ def initialize(x, y, width, height)
13
+ @x = x
14
+ @y = y
15
+ @width = width
16
+ @height = height
17
+ end
18
+
19
+ def draw
20
+ TTY::Box.frame(
21
+ left: @x,
22
+ top: @y,
23
+ width: @width,
24
+ height: @height,
25
+ align: :center,
26
+ border: :light,
27
+ style: {
28
+ fg: :white,
29
+ border: {
30
+ fg: :white,
31
+ }
32
+ }
33
+ )
34
+ end
35
+ end
36
+
37
+ class Window
38
+ def initialize
39
+ @width = TTY::Screen.width
40
+ @height = TTY::Screen.height-1
41
+ @panels = [Panel.new(0, 0, @width, @height)]
42
+ @cursor = TTY::Cursor
43
+ end
44
+
45
+ def split_vertical(view1=nil, view2=nil)
46
+ width = (@width / 2) - 1
47
+ height = @height - 2
48
+
49
+ @panels << Panel.new(1, 1, width, height)
50
+ @panels << Panel.new(width + 1, 1, width, height)
51
+ end
52
+
53
+ def split_horizontal(view1=nil, view2=nil)
54
+ width = @width - 2
55
+ height = (@height / 2) - 2
56
+ end
57
+
58
+ def box_frame
59
+ TTY::Box.frame(
60
+ width: @width,
61
+ height: @height,
62
+ align: :center,
63
+ border: :thick,
64
+ style: {
65
+ fg: :blue,
66
+ border: {
67
+ fg: :white,
68
+ }
69
+ }
70
+ )
71
+ end
72
+
73
+ def draw
74
+ @cursor.clear_screen
75
+
76
+ print box_frame
77
+
78
+ @panels.each do |panel|
79
+ @cursor.move_to
80
+
81
+ print panel.draw
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
87
+
88
+ win = Intent::UI::Window.new
89
+ win.split_vertical
90
+ win.draw
@@ -1,3 +1,3 @@
1
1
  module Intent
2
- VERSION = '0.5.5'
2
+ VERSION = '0.6.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Rickerby
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-02 00:00:00.000000000 Z
11
+ date: 2021-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: todo-txt
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.11'
19
+ version: '0.12'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.11'
26
+ version: '0.12'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pastel
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.6'
33
+ version: '0.8'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.6'
40
+ version: '0.8'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: git
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.3.0
47
+ version: 1.9.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.3.0
54
+ version: 1.9.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: terminal-notifier
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.8.0
61
+ version: '2.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.8.0
68
+ version: '2.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: ghost
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -84,30 +84,30 @@ dependencies:
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '1.10'
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '1.10'
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rake
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: '10.0'
103
+ version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '10.0'
110
+ version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rspec
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -122,26 +122,30 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
- description:
125
+ description:
126
126
  email:
127
127
  - me@maetl.net
128
128
  executables:
129
+ - project_doc
129
130
  - projects
131
+ - projects_active
130
132
  - review
131
133
  - todo
134
+ - todo_review
132
135
  extensions: []
133
136
  extra_rdoc_files: []
134
137
  files:
135
138
  - ".gitignore"
136
139
  - ".travis.yml"
137
- - CODE_OF_CONDUCT.md
138
140
  - Gemfile
139
141
  - LICENSE.txt
140
- - README.md
141
142
  - Rakefile
143
+ - bin/project_doc
142
144
  - bin/projects
145
+ - bin/projects_active
143
146
  - bin/review
144
147
  - bin/todo
148
+ - bin/todo_review
145
149
  - intent.gemspec
146
150
  - lib/gem_ext/todo-txt.rb
147
151
  - lib/intent.rb
@@ -152,12 +156,13 @@ files:
152
156
  - lib/intent/review/manager.rb
153
157
  - lib/intent/todo.rb
154
158
  - lib/intent/todo/manager.rb
159
+ - lib/intent/ui/ttyui.rb
155
160
  - lib/intent/version.rb
156
161
  homepage: http://maetl.net
157
162
  licenses:
158
163
  - MIT
159
164
  metadata: {}
160
- post_install_message:
165
+ post_install_message:
161
166
  rdoc_options: []
162
167
  require_paths:
163
168
  - lib
@@ -172,9 +177,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
177
  - !ruby/object:Gem::Version
173
178
  version: '0'
174
179
  requirements: []
175
- rubyforge_project:
176
- rubygems_version: 2.7.6
177
- signing_key:
180
+ rubygems_version: 3.1.2
181
+ signing_key:
178
182
  specification_version: 4
179
183
  summary: Text-based project management
180
184
  test_files: []
data/CODE_OF_CONDUCT.md DELETED
@@ -1,13 +0,0 @@
1
- # Contributor Code of Conduct
2
-
3
- As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
-
5
- We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
-
7
- Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
-
9
- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
-
11
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
-
13
- This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/README.md DELETED
@@ -1,41 +0,0 @@
1
- # Intent
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/intent`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'intent'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install intent
22
-
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
-
33
- ## Contributing
34
-
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/intent. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
36
-
37
-
38
- ## License
39
-
40
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
-