ruby-zoom 3.0.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.
@@ -0,0 +1,34 @@
1
+ module ZoomError
2
+ class Error < RuntimeError
3
+ end
4
+
5
+ class ExecutableNotFoundError < Error
6
+ def initialize(exe)
7
+ super("Executable #{exe} not found!")
8
+ end
9
+ end
10
+
11
+ class ProfileAlreadyExistsError < Error
12
+ def initialize(profile)
13
+ super("Profile #{profile} already exists!")
14
+ end
15
+ end
16
+
17
+ class ProfileCanNotBeModifiedError < Error
18
+ def initialize(profile)
19
+ super("Profile #{profile} can not be modified!")
20
+ end
21
+ end
22
+
23
+ class ProfileClassUnknownError < Error
24
+ def initialize(clas)
25
+ super("Profile class #{clas} unknown!")
26
+ end
27
+ end
28
+
29
+ class ProfileDoesNotExistError < Error
30
+ def initialize(profile)
31
+ super("Profile #{profile} does not exist!")
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,91 @@
1
+ require "scoobydoo"
2
+ require "shellwords"
3
+
4
+ class ZoomProfile < Hash
5
+ attr_accessor :taggable
6
+
7
+ def append(append = nil)
8
+ self["append"] = append if (append)
9
+ return self["append"]
10
+ end
11
+
12
+ def colors
13
+ # TODO color support
14
+ ""
15
+ end
16
+
17
+ def exe(args, pattern)
18
+ system("#{self.to_s} #{args} #{pattern} #{self.append}")
19
+ end
20
+
21
+ def flags(flags = nil)
22
+ self["flags"] = flags if (flags)
23
+ return self["flags"]
24
+ end
25
+
26
+ def self.from_json(json)
27
+ begin
28
+ return Object::const_get(json["class"]).new(
29
+ json["operator"].nil? ? "" : json["class"],
30
+ json["flags"].nil? ? "" : json["flags"],
31
+ json["prepend"].nil? ? "" : json["prepend"],
32
+ json["append"].nil? ? "" : json["append"]
33
+ )
34
+ rescue NameError => e
35
+ raise ZoomError::ProfileClassUnknownError.new(
36
+ json["class"]
37
+ )
38
+ end
39
+ end
40
+
41
+ def info
42
+ [
43
+ "Class : #{self.class.to_s}",
44
+ "Prepend : #{self["prepend"]}",
45
+ "Operator: #{self["operator"]}",
46
+ "Flags : #{self["flags"]}",
47
+ "Append : #{self["append"]}"
48
+ ].join("\n").strip
49
+ end
50
+
51
+ def initialize(
52
+ operator = "echo",
53
+ flags = "#",
54
+ envprepend = "",
55
+ append = ""
56
+ )
57
+ self["class"] = self.class.to_s
58
+ self.operator(operator)
59
+ self.flags(flags)
60
+ self.prepend(envprepend)
61
+ self.append(append)
62
+ @pager = "z --pager"
63
+ @taggable = false
64
+ end
65
+
66
+ def operator(operator = nil)
67
+ if (operator)
68
+ op = ScoobyDoo.where_are_you(operator)
69
+ if (op)
70
+ self["operator"] = op
71
+ else
72
+ self["operator"] = ScoobyDoo.where_are_you("echo")
73
+ end
74
+ end
75
+ return self["operator"]
76
+ end
77
+
78
+ def prepend(envprepend = nil)
79
+ self["prepend"] = envprepend if (envprepend)
80
+ return self["prepend"]
81
+ end
82
+
83
+ def to_s
84
+ [
85
+ self.colors,
86
+ self["prepend"],
87
+ self["operator"],
88
+ self["flags"]
89
+ ].join(" ").strip
90
+ end
91
+ end
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby-zoom
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Miles Whittaker
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-10-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: minitest
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.8'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 5.8.1
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '5.8'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 5.8.1
33
+ - !ruby/object:Gem::Dependency
34
+ name: scoobydoo
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '0.1'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 0.1.1
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '0.1'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 0.1.1
53
+ description: Do you like to search through code using ag, ack, or grep? Good! This
54
+ tool is for you! Zoom adds some convenience to ag/ack/grep by allowing you to quickly
55
+ open your search results in your editor of choice. When looking at large code-bases,
56
+ it can be a pain to have to scroll to find the filename of each result. Zoom prints
57
+ a tag number in front of each result that ag/ack/grep outputs. Then you can quickly
58
+ open that tag number with Zoom to jump straight to the source. Zoom is even persistent
59
+ across all your sessions! You can search in one terminal and jump to a tag in another
60
+ terminal from any directory!
61
+ email: mjwhitta@gmail.com
62
+ executables:
63
+ - zf
64
+ - zg
65
+ - z
66
+ - zl
67
+ - zr
68
+ - zc
69
+ extensions: []
70
+ extra_rdoc_files: []
71
+ files:
72
+ - bin/z
73
+ - bin/zc
74
+ - bin/zf
75
+ - bin/zg
76
+ - bin/zl
77
+ - bin/zr
78
+ - lib/ack_profile.rb
79
+ - lib/ag_profile.rb
80
+ - lib/find_profile.rb
81
+ - lib/grep_profile.rb
82
+ - lib/passwords_profile.rb
83
+ - lib/string.rb
84
+ - lib/zoom.rb
85
+ - lib/zoom_error.rb
86
+ - lib/zoom_profile.rb
87
+ homepage: http://mjwhitta.github.io/zoom
88
+ licenses:
89
+ - GPL-3.0
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 2.4.8
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: Quickly open CLI search results in your favorite editor!
111
+ test_files: []
112
+ has_rdoc: