ruby-zoom 4.5.0 → 4.5.1

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
  SHA1:
3
- metadata.gz: 7e24741581c5ef1f83d4decb56f4174ba0daf8fe
4
- data.tar.gz: e891c15c54c8d463da1bf1cf6df704d174f2c93b
3
+ metadata.gz: 10788664e72eaeaad581c1097eecd0e7114fc31a
4
+ data.tar.gz: b7bff318e1386bb839520de8ebe62315434b9ec8
5
5
  SHA512:
6
- metadata.gz: a8328bc8f7e697de49828c0dea1e81fc464eb8130a52294af8b60bb35ccf168a2a044055048d37f39250c9bb2160a162ce551fd1e997548dd242b5858c65a962
7
- data.tar.gz: 88da71aee03e6e74d28c58981cc7ee608b6f8ec6f47e5cbf262a0db54ea8fb37c65d35235dfbec539a3d0f61df200debafa527910107ac2ba9358288ffd0e470
6
+ metadata.gz: 1f5b567886b3ee100cf19c2065bf4bc3fd98b42c1a7eb42c12c129f1be21379e80a20b93adec218d64ed70456ee273a0cce5592cf917053f9fbdda8dfd301223
7
+ data.tar.gz: abcbb6123f6e5bbbcef0132515d50321200f070c5cd6d11273b92b002061bf02853b86b2a40c8fca0eddeb7d9777fec1b8909cbd8e426004ab5b33dc01f22c80
@@ -19,6 +19,16 @@ class Zoom::Profile < Hash
19
19
  return self["before"]
20
20
  end
21
21
 
22
+ def camel_case_to_underscore(clas)
23
+ # Convert camelcase class to unscore separated string
24
+ name = clas.to_s.split("::")[-1]
25
+ name.gsub!(/([A-Z]+)([A-Z][a-z])/, "\\1_\\2")
26
+ name.gsub!(/([a-z0-9])([A-Z])/, "\\1_\\2")
27
+ name.tr!("-", "_")
28
+ return name.downcase
29
+ end
30
+ private :camel_case_to_underscore
31
+
22
32
  def class_name
23
33
  return self["class"]
24
34
  end
@@ -119,7 +129,13 @@ class Zoom::Profile < Hash
119
129
  end
120
130
  private :hilight_pattern
121
131
 
122
- def initialize(n, o = "echo", f = "#", b = "", a = "")
132
+ def initialize(n = nil, o = nil, f = nil, b = nil, a = nil)
133
+ a ||= ""
134
+ b ||= ""
135
+ f ||= ""
136
+ n ||= camel_case_to_underscore(self.class.to_s)
137
+ o ||= "echo"
138
+
123
139
  self["class"] = self.class.to_s
124
140
  after(a)
125
141
  before(b)
@@ -1,10 +1,12 @@
1
1
  class Zoom::Profile::Ack < Zoom::Profile
2
- def initialize(n, o = "ack", f = "--smart-case", b = "", a = "")
2
+ def initialize(n = nil, o = nil, f = nil, b = nil, a = nil)
3
3
  # Special case because of debian
4
+ o ||= "ack"
4
5
  if ((o == "ack") && ScoobyDoo.where_are_you("ack-grep"))
5
6
  o = "ack-grep"
6
7
  end
7
8
 
9
+ f ||= "--smart-case"
8
10
  super(n, o, f, b, a)
9
11
  @format_flags = [
10
12
  "--follow",
@@ -1,5 +1,7 @@
1
1
  class Zoom::Profile::Ag < Zoom::Profile
2
- def initialize(n, o = "ag", f = "-S", b = "", a = "")
2
+ def initialize(n = nil, o = nil, f = nil, b = nil, a = nil)
3
+ f ||= "-S"
4
+ o ||= "ag"
3
5
  super(n, o, f, b, a)
4
6
  @format_flags = [
5
7
  "-f",
@@ -1,5 +1,7 @@
1
1
  class Zoom::Profile::Find < Zoom::Profile
2
- def initialize(n, o = "find", f = "", b = "", a = "")
2
+ def initialize(n = nil, o = nil, f = nil, b = nil, a = nil)
3
+ f ||= ""
4
+ o ||= "find"
3
5
  super(n, o, f, b, a)
4
6
  @taggable = true
5
7
  end
@@ -1,5 +1,7 @@
1
1
  class Zoom::Profile::Grep < Zoom::Profile
2
- def initialize(n, o = "grep", f = "-i", b = "", a = "")
2
+ def initialize(n = nil, o = nil, f = nil, b = nil, a = nil)
3
+ f ||= "-i"
4
+ o ||= "grep"
3
5
  super(n, o, f, b, a)
4
6
  @format_flags = [
5
7
  "--color=never",
@@ -1,18 +1,17 @@
1
1
  class Zoom::SecurityProfile::Passwords < Zoom::SecurityProfile
2
- def initialize(n, o = nil, f = "", b = "", a = "")
3
- flags = ""
2
+ def initialize(n = nil, o = nil, f = nil, b = nil, a = nil)
4
3
  case Zoom::ProfileManager.default_profile
5
4
  when /^ack(-grep)?$/
6
- flags = "--smart-case"
5
+ f ||= "--smart-case"
7
6
  when "ag"
8
- flags = "-Su"
7
+ f ||= "-Su"
9
8
  when "grep"
10
- flags = "-ai"
9
+ f ||= "-ai"
11
10
  when "pt"
12
- flags = "-SU --hidden"
11
+ f ||= "-SU --hidden"
13
12
  end
14
13
 
15
- super(n, nil, flags, b, a)
14
+ super(n, nil, f, b, a)
16
15
  @pattern = "(key|pass(wd|word)?)[^:=,>]? *[:=,>]"
17
16
  @taggable = true
18
17
  end
@@ -1,5 +1,7 @@
1
1
  class Zoom::Profile::Pt < Zoom::Profile
2
- def initialize(n, o = "pt", f = "-S", b = "", a = "")
2
+ def initialize(n = nil, o = nil, f = nil, b = nil, a = nil)
3
+ f ||= "-S"
4
+ o ||= "pt"
3
5
  super(n, o, f, b, a)
4
6
  @format_flags = "-e -f --nocolor --nogroup"
5
7
  @taggable = true
@@ -1,18 +1,17 @@
1
1
  class Zoom::SecurityProfile::UnsafeC < Zoom::SecurityProfile
2
- def initialize(n, o = nil, f = "", b = "", a = "")
3
- flags = ""
2
+ def initialize(n = nil, o = nil, f = nil, b = nil, a = nil)
4
3
  case Zoom::ProfileManager.default_profile
5
4
  when /^ack(-grep)?$/
6
- flags = "--smart-case --cc --cpp"
5
+ f ||= "--smart-case --cc --cpp"
7
6
  when "ag"
8
- flags = "-S -G \"\\.(c|h)(pp)?$\""
7
+ f ||= "-S -G \"\\.(c|h)(pp)?$\""
9
8
  when "grep"
10
- flags = "-i --include=\"*.[ch]\" --include=\"*.[ch]pp\""
9
+ f ||= "-i --include=\"*.[ch]\" --include=\"*.[ch]pp\""
11
10
  when "pt"
12
- flags = "-S -G \"\\.(c|h)(pp)?$\""
11
+ f ||= "-S -G \"\\.(c|h)(pp)?$\""
13
12
  end
14
13
 
15
- super(n, nil, flags, b, a)
14
+ super(n, nil, f, b, a)
16
15
  @pattern = [
17
16
  "(",
18
17
  [
@@ -1,22 +1,21 @@
1
1
  class Zoom::SecurityProfile::UnsafeJava < Zoom::SecurityProfile
2
- def initialize(n, o = nil, f = "", b = "", a = "")
3
- flags = ""
2
+ def initialize(n = nil, o = nil, f = nil, b = nil, a = nil)
4
3
  case Zoom::ProfileManager.default_profile
5
4
  when /^ack(-grep)?$/
6
- flags = "--smart-case --java"
5
+ f ||= "--smart-case --java"
7
6
  when "ag"
8
- flags = "-S -G \"\\.(java|properties)$\""
7
+ f ||= "-S -G \"\\.(java|properties)$\""
9
8
  when "grep"
10
- flags = [
9
+ f ||= [
11
10
  "-i",
12
11
  "--include=\"*.java\"",
13
12
  "--include=\"*.properties\""
14
13
  ].join(" ")
15
14
  when "pt"
16
- flags = "-S -G \"\\.(java|properties)$\""
15
+ f ||= "-S -G \"\\.(java|properties)$\""
17
16
  end
18
17
 
19
- super(n, nil, flags, b, a)
18
+ super(n, nil, f, b, a)
20
19
  @pattern = [
21
20
  "(sun\\.misc\\.)?Unsafe",
22
21
  "(\\.getRuntime|readObject|Runtime)\\("
@@ -1,18 +1,17 @@
1
1
  class Zoom::SecurityProfile::UnsafeJs < Zoom::SecurityProfile
2
- def initialize(n, o = nil, f = "", b = "", a = "")
3
- flags = ""
2
+ def initialize(n = nil, o = nil, f = nil, b = nil, a = nil)
4
3
  case Zoom::ProfileManager.default_profile
5
4
  when /^ack(-grep)?$/
6
- flags = "--smart-case --js"
5
+ f ||= "--smart-case --js"
7
6
  when "ag"
8
- flags = "-S -G \"\\.js$\""
7
+ f ||= "-S -G \"\\.js$\""
9
8
  when "grep"
10
- flags = "-i --include=\"*.js\""
9
+ f ||= "-i --include=\"*.js\""
11
10
  when "pt"
12
- flags = "-S -G \"\\.js$\""
11
+ f ||= "-S -G \"\\.js$\""
13
12
  end
14
13
 
15
- super(n, nil, flags, b, a)
14
+ super(n, nil, f, b, a)
16
15
  @pattern = "\\.((append|eval|html)\\(|innerHTML)"
17
16
  @taggable = true
18
17
  end
@@ -1,23 +1,22 @@
1
1
  class Zoom::SecurityProfile::UnsafePhp < Zoom::SecurityProfile
2
- def initialize(n, o = nil, f = "", b = "", a = "")
3
- flags = ""
2
+ def initialize(n = nil, o = nil, f = nil, b = nil, a = nil)
4
3
  case Zoom::ProfileManager.default_profile
5
4
  when /^ack(-grep)?$/
6
- flags = "--smart-case --php"
5
+ f ||= "--smart-case --php"
7
6
  when "ag"
8
- flags = "-S -G \"\\.ph(p[345t]?|tml)$\""
7
+ f ||= "-S -G \"\\.ph(p[345t]?|tml)$\""
9
8
  when "grep"
10
- flags = [
9
+ f ||= [
11
10
  "-i",
12
11
  "--include=\"*.php\"",
13
12
  "--include=\"*.php[345t]\"",
14
13
  "--include=\"*.phtml\""
15
14
  ].join(" ")
16
15
  when "pt"
17
- flags = "-S -G \"\\.ph(p[345t]?|tml)$\""
16
+ f ||= "-S -G \"\\.ph(p[345t]?|tml)$\""
18
17
  end
19
18
 
20
- super(n, nil, flags, b, a)
19
+ super(n, nil, f, b, a)
21
20
  # From here: https://www.eukhost.com/blog/webhosting/dangerous-php-functions-must-be-disabled/
22
21
  # OMG is anything safe?!
23
22
  @pattern = [
@@ -1,18 +1,17 @@
1
1
  class Zoom::SecurityProfile::UnsafePython < Zoom::SecurityProfile
2
- def initialize(n, o = nil, f = "", b = "", a = "")
3
- flags = ""
2
+ def initialize(n = nil, o = nil, f = nil, b = nil, a = nil)
4
3
  case Zoom::ProfileManager.default_profile
5
4
  when /^ack(-grep)?$/
6
- flags = "--smart-case --python"
5
+ f ||= "--smart-case --python"
7
6
  when "ag"
8
- flags = "-S -G \"\\.py$\""
7
+ f ||= "-S -G \"\\.py$\""
9
8
  when "grep"
10
- flags = "-i --include=\"*.py\""
9
+ f ||= "-i --include=\"*.py\""
11
10
  when "pt"
12
- flags = "-S -G \"\\.py$\""
11
+ f ||= "-S -G \"\\.py$\""
13
12
  end
14
13
 
15
- super(n, nil, flags, b, a)
14
+ super(n, nil, f, b, a)
16
15
  @pattern = [
17
16
  "(",
18
17
  [
@@ -1,16 +1,15 @@
1
1
  class Zoom::SecurityProfile::UnsafeRuby < Zoom::SecurityProfile
2
- def initialize(n, o = nil, f = "", b = "", a = "")
3
- flags = ""
2
+ def initialize(n = nil, o = nil, f = nil, b = nil, a = nil)
4
3
  case Zoom::ProfileManager.default_profile
5
4
  when /^ack(-grep)?$/
6
- flags = "--smart-case --ruby"
5
+ f ||= "--smart-case --ruby"
7
6
  when "ag"
8
- flags = [
7
+ f ||= [
9
8
  "-S",
10
9
  "-G \"\\.(erb|r(ake|b|html|js|xml)|spec)$|Rakefile\""
11
10
  ].join(" ")
12
11
  when "grep"
13
- flags = [
12
+ f ||= [
14
13
  "-i",
15
14
  "--include=\"*.erb\"",
16
15
  "--include=\"*.rake\"",
@@ -22,13 +21,13 @@ class Zoom::SecurityProfile::UnsafeRuby < Zoom::SecurityProfile
22
21
  "--include=\"Rakefile\""
23
22
  ].join(" ")
24
23
  when "pt"
25
- flags = [
24
+ f ||= [
26
25
  "-S",
27
26
  "-G \"\\.(erb|r(ake|b|html|js|xml)|spec)$|Rakefile\""
28
27
  ].join(" ")
29
28
  end
30
29
 
31
- super(n, nil, flags, b, a)
30
+ super(n, nil, f, b, a)
32
31
  @pattern = [
33
32
  "%x\\(",
34
33
  "\\.constantize",
@@ -39,12 +39,7 @@ class Zoom::ProfileManager
39
39
  def self.security_profiles
40
40
  profs = Array.new
41
41
  Zoom::SecurityProfile.subclasses.each do |clas|
42
- # Convert camelcase class to unscore separated string
43
- name = clas.to_s.split("::")[-1]
44
- name.gsub!(/([A-Z]+)([A-Z][a-z])/, "\\1_\\2")
45
- name.gsub!(/([a-z0-9])([A-Z])/, "\\1_\\2")
46
- name.tr!("-", "_")
47
- profs.push(clas.new(name.downcase))
42
+ profs.push(clas.new)
48
43
  end
49
44
  return profs
50
45
  end
@@ -1,7 +1,7 @@
1
1
  clas = Zoom::ProfileManager.default_profile.capitalize
2
2
  superclass = Zoom::Profile.profile_by_name("Zoom::Profile::#{clas}")
3
3
  class Zoom::SecurityProfile < superclass
4
- def initialize(n, o = nil, f = "", b = "", a = "")
4
+ def initialize(n = nil, o = nil, f = nil, b = nil, a = nil)
5
5
  super(n, Zoom::ProfileManager.default_profile, f, b, a)
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-zoom
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.0
4
+ version: 4.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Whittaker
@@ -59,7 +59,7 @@ dependencies:
59
59
  version: '2.0'
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: 2.0.1
62
+ version: 2.0.2
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
@@ -69,7 +69,7 @@ dependencies:
69
69
  version: '2.0'
70
70
  - - ">="
71
71
  - !ruby/object:Gem::Version
72
- version: 2.0.1
72
+ version: 2.0.2
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: fagin
75
75
  requirement: !ruby/object:Gem::Requirement