hookapp 0.0.7 → 2.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,30 @@
1
+ require 'hook-helpers'
2
+ require 'test_helper'
3
+
4
+ class CloneTest < Test::Unit::TestCase
5
+ include HookHelpers
6
+
7
+ def setup
8
+ @basedir = HOOK_FILES_DIR
9
+ create_temp_files
10
+ end
11
+
12
+ def teardown
13
+ clean_temp_files
14
+ end
15
+
16
+ def test_clone
17
+ count = 3
18
+
19
+ files = Dir.glob(File.join(HOOK_FILES_DIR, '*.md'))
20
+
21
+ # Link all files to last file
22
+ hook('link', *files[0..count - 1])
23
+ links = hook('ls', files[count - 1]).strip
24
+
25
+ hook('clone', files[count-1], files[count])
26
+ cloned_links = hook('ls', files[count]).strip
27
+
28
+ assert_match(links, cloned_links, "#{files[count - 1]} links should match #{files[count]} links")
29
+ end
30
+ end
@@ -0,0 +1,30 @@
1
+ require 'hook-helpers'
2
+ require 'test_helper'
3
+
4
+ class EncodeTest < Test::Unit::TestCase
5
+ include HookHelpers
6
+
7
+ def setup
8
+ end
9
+
10
+ def teardown
11
+ end
12
+
13
+ # # FIXME: I don't know why this isn't getting output
14
+ # def test_encode_args
15
+ # result = hook('percent', 'encode', %(here's a "string?"))
16
+ # assert_match(/here%27s%20a%20%22string%3F%22/, result, 'URL encoded string should match')
17
+ # end
18
+
19
+ def test_encode_stdin
20
+ result = pread_stdin({}, %(here's a "string?"), HOOK_EXEC, 'percent', 'encode')
21
+ assert_match(/here%27s%20a%20%22string%3F%22/, result, 'URL encoded string should match')
22
+ end
23
+
24
+ def test_encode_decode_stdin
25
+ original_string = %(here's a "string?")
26
+ encoded = pread_stdin({}, original_string, HOOK_EXEC, 'percent', 'encode')
27
+ decoded = pread_stdin({}, encoded, HOOK_EXEC, 'percent', 'decode')
28
+ assert_match(decoded, original_string, 'URL encoded string should match')
29
+ end
30
+ end
@@ -0,0 +1,39 @@
1
+ require 'hook-helpers'
2
+ require 'test_helper'
3
+
4
+ class LinkTest < Test::Unit::TestCase
5
+ include HookHelpers
6
+
7
+ def setup
8
+ @basedir = HOOK_FILES_DIR
9
+ create_temp_files
10
+ end
11
+
12
+ def teardown
13
+ clean_temp_files
14
+ end
15
+
16
+ def test_link
17
+ count = 3
18
+
19
+ files = Dir.glob(File.join(HOOK_FILES_DIR, '*.md'))[0..(count - 1)]
20
+
21
+ # Link all files to last file
22
+ hook('link', *files)
23
+
24
+ assert_count_links(files[-1], count - 1, "Last file should have #{count - 1} links")
25
+ assert_count_links(files[0], 1, 'First file should have 1 link')
26
+ end
27
+
28
+ def test_bi_link
29
+ count = 3
30
+
31
+ files = Dir.glob(File.join(HOOK_FILES_DIR, '*.md'))[0..(count - 1)]
32
+
33
+ # Link all files bi-directionally
34
+ hook('link', '-a', *files)
35
+
36
+ assert_count_links(files[-1], count - 1, "Last file should have #{count - 1} links")
37
+ assert_count_links(files[0], count - 1, "First file should have #{count - 1} links")
38
+ end
39
+ end
@@ -0,0 +1,25 @@
1
+ require 'hook-helpers'
2
+ require 'test_helper'
3
+
4
+ class ListTest < Test::Unit::TestCase
5
+ include HookHelpers
6
+
7
+ def setup
8
+ @basedir = HOOK_FILES_DIR
9
+ create_temp_files
10
+ end
11
+
12
+ def teardown
13
+ clean_temp_files
14
+ end
15
+
16
+ def test_list
17
+ count = 2
18
+ files = Dir.glob(File.join(HOOK_FILES_DIR, '*.md'))[0..(count - 1)]
19
+ # Link all files to last file
20
+ hook('link', *files)
21
+
22
+ assert_count_links(files[-1], count - 1, "Last file should have #{count - 1} links")
23
+ assert_links_include(files[-1], File.basename(files[0]), 'Links on last file should include first file')
24
+ end
25
+ end
@@ -0,0 +1,34 @@
1
+ require 'hook-helpers'
2
+ require 'test_helper'
3
+
4
+ class RemoveTest < Test::Unit::TestCase
5
+ include HookHelpers
6
+
7
+ def setup
8
+ @basedir = HOOK_FILES_DIR
9
+ create_temp_files
10
+ end
11
+
12
+ def teardown
13
+ clean_temp_files
14
+ end
15
+
16
+ def test_remove
17
+ count = 5
18
+
19
+ files = Dir.glob(File.join(HOOK_FILES_DIR, '*.md'))[0..(count - 1)]
20
+
21
+ # Link all files to last file
22
+ hook('link', *files)
23
+
24
+ assert_count_links(files[-1], count - 1, "Last file should start with #{count - 1} links")
25
+
26
+ hook('remove', files[-1], files[0])
27
+
28
+ assert_count_links(files[-1], count - 2, "Last file should have #{count - 2} links")
29
+
30
+ hook('remove', '--all', '--force', files[-1])
31
+
32
+ assert_count_links(files[-1], 0, "Last file should end with 0 links")
33
+ end
34
+ end
@@ -0,0 +1,21 @@
1
+ require 'hook-helpers'
2
+ require 'test_helper'
3
+
4
+ class EncodeTest < Test::Unit::TestCase
5
+ include HookHelpers
6
+
7
+ def setup
8
+ end
9
+
10
+ def teardown
11
+ end
12
+
13
+ def test_shell_scripts
14
+ %w[bash fish zsh].each do |sh|
15
+ source = IO.read(File.join(HOOK_COMPLETIONS_DIR, 'hook_completion.' + sh))
16
+ result = hook('scripts', sh)
17
+
18
+ assert_match(source, result, 'Script output should match')
19
+ end
20
+ end
21
+ end
metadata CHANGED
@@ -1,71 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hookapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 2.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-10 00:00:00.000000000 Z
11
+ date: 2021-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rake
14
+ name: aruba
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 13.0.1
19
+ version: 0.14.14
20
20
  type: :development
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: 13.0.1
26
+ version: 0.14.14
27
27
  - !ruby/object:Gem::Dependency
28
- name: rdoc
28
+ name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 6.1.2
33
+ version: 13.0.1
34
34
  type: :development
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: 6.1.2
40
+ version: 13.0.1
41
41
  - !ruby/object:Gem::Dependency
42
- name: aruba
42
+ name: rdoc
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.14.14
47
+ version: 6.3.2
48
48
  type: :development
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: 0.14.14
54
+ version: 6.3.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: gli
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '='
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 2.19.0
61
+ version: 2.20.1
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: 2.19.0
68
+ version: 2.20.1
69
69
  description:
70
70
  email: me@brettterpstra.com
71
71
  executables:
@@ -79,31 +79,36 @@ files:
79
79
  - CHANGELOG.md
80
80
  - Gemfile
81
81
  - Gemfile.lock
82
+ - LICENSE.md
83
+ - OVERVIEW.md
82
84
  - README.md
83
85
  - README.rdoc
84
86
  - Rakefile
85
87
  - bin/hook
88
+ - buildnotes.md
86
89
  - features/hook.feature
87
90
  - features/step_definitions/hook_steps.rb
88
91
  - features/support/env.rb
89
92
  - hook.rdoc
90
93
  - hookapp.gemspec
94
+ - lib/completion/hook_completion.bash
95
+ - lib/completion/hook_completion.fish
96
+ - lib/completion/hook_completion.zsh
97
+ - lib/helpers/fuzzyfilefinder
91
98
  - lib/hook.rb
99
+ - lib/hook/hookapp.rb
92
100
  - lib/hook/hooker.rb
101
+ - lib/hook/markdown_document_listener.rb
102
+ - lib/hook/string.rb
93
103
  - lib/hook/version.rb
94
- - test/default_test.rb
95
- - test/hookfiles/01.test
96
- - test/hookfiles/02.test
97
- - test/hookfiles/03.test
98
- - test/hookfiles/04.test
99
- - test/hookfiles/05.test
100
- - test/hookfiles/06.test
101
- - test/hookfiles/07.test
102
- - test/hookfiles/08.test
103
- - test/hookfiles/09.test
104
- - test/hookfiles/10.test
105
- - test/hookfiles/11.test
106
- - test/hookfiles/12.test
104
+ - test/helpers/hook-helpers.rb
105
+ - test/hook_clip_test.rb
106
+ - test/hook_clone_test.rb
107
+ - test/hook_encode_test.rb
108
+ - test/hook_link_test.rb
109
+ - test/hook_list_test.rb
110
+ - test/hook_remove_test.rb
111
+ - test/hook_scripts_test.rb
107
112
  - test/test_helper.rb
108
113
  homepage: https://brettterpstra.com
109
114
  licenses: []
@@ -129,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
134
  - !ruby/object:Gem::Version
130
135
  version: '0'
131
136
  requirements: []
132
- rubygems_version: 3.0.6
137
+ rubygems_version: 3.2.16
133
138
  signing_key:
134
139
  specification_version: 4
135
140
  summary: A CLI for Hook.app (macOS)
data/test/default_test.rb DELETED
@@ -1,14 +0,0 @@
1
- require 'test_helper'
2
-
3
- class DefaultTest < Test::Unit::TestCase
4
-
5
- def setup
6
- end
7
-
8
- def teardown
9
- end
10
-
11
- def test_the_truth
12
- assert true
13
- end
14
- end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes