lldbrun 0.3.1 → 0.4.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: 8bab398d5fe28131405572ed92aa8a4425185a27e4009b7a65a479d7b96f7f92
4
- data.tar.gz: 2c321eea4051b3c8eb6f47385dd2db9699a73f3aab48511e208ddca188232fba
3
+ metadata.gz: 51bc8f7923be8eb61169fe83a3c19936863cdaed70b9d66655944338e565b87f
4
+ data.tar.gz: 3154dd190e1b5309f8031b1914e80434e6094aff49a72215d18b5a8a61ddef90
5
5
  SHA512:
6
- metadata.gz: c85794d9270602bde05e49ab6532674277e3186c6e6e11ff23ccbc9cb4579372e107c7c4993e9d0985bc299e362864d4cd291ea3780025ad4010e5e650bf5881
7
- data.tar.gz: 3ad747e56ab0f0021523f4b5127e0c0f553ebf6589a21a170c30468390eade8b9fd3511f3a88a09ecd31dfdb7af49605b5e3f192f2dc0a183acecb7716864ce6
6
+ metadata.gz: 892eff775bc6cd59237c7b750c3ac74a3424326e6dfec706d3c2544b19aa5c6f23ca89be80a7d77a27c6d5e1a73d73e8f8c56cd3f8a4d682267869c5a18e3d48
7
+ data.tar.gz: 822ab9b19204104817f3b3a87be8e131dcbf77cc76d00ebca003357a3ffb2ec878451c3b77a262b70645d85f823bffa9b46a71d8743b3c4d7cf1763b8406427d
@@ -2,14 +2,17 @@ require 'byebug'
2
2
  module Lldbrun
3
3
  class ParserARGV
4
4
 
5
- DEFAULT_LLDB = ''
6
- DEFAULT_START_DIR = `pwd`.strip
5
+ COUNT_LLDB_VERSIONS = 99
6
+ DEFAULT_LLDB = 'lldb'
7
+ DEFAULT_LLDB_OPTIONS = ''
8
+ DEFAULT_START_DIR = `pwd`.strip
7
9
 
8
- PARAMETER_FILE_PATH = '-f'
9
- PARAMETER_SCAN_DIR = '-s'
10
- PARAMETER_HELP = '-h'
11
- PARAMETER_RUN = '-r'
12
- PARAMETER_LLDB = '-l'
10
+ PARAMETER_FILE_PATH = '-f'
11
+ PARAMETER_SCAN_DIR = '-s'
12
+ PARAMETER_HELP = '-h'
13
+ PARAMETER_RUN = '-r'
14
+ PARAMETER_LLDB = '-e'
15
+ PARAMETER_LLDB_OPTIONS = '-l'
13
16
 
14
17
  attr_reader :argv, :params
15
18
 
@@ -25,18 +28,22 @@ module Lldbrun
25
28
  params[PARAMETER_FILE_PATH] or DEFAULT_START_DIR
26
29
  end
27
30
 
28
- def param_lldb
29
- params[PARAMETER_LLDB] or DEFAULT_LLDB
30
- end
31
-
32
31
  def param_scan_dir
33
32
  params[PARAMETER_SCAN_DIR] or DEFAULT_START_DIR
34
33
  end
35
34
 
35
+ def param_lldb_options
36
+ params[PARAMETER_LLDB_OPTIONS] or DEFAULT_LLDB_OPTIONS
37
+ end
38
+
36
39
  def param_auto_run?
37
40
  params[PARAMETER_RUN] ? params[PARAMETER_RUN] == 'true' : true
38
41
  end
39
42
 
43
+ def param_lldb
44
+ params[PARAMETER_LLDB] or search_lldb
45
+ end
46
+
40
47
  private
41
48
 
42
49
  def check_info
@@ -72,5 +79,36 @@ module Lldbrun
72
79
  p 'LLDBRUN: BAD PARAMETERS'
73
80
  info
74
81
  end
82
+
83
+ def search_lldb
84
+ versions = {}
85
+ COUNT_LLDB_VERSIONS.times do |number|
86
+ version = number < 10 ? '' : "-#{number.to_s.split('').join('.')}"
87
+ versions[number] = "lldb#{version}" if which?("lldb#{version}")
88
+ end
89
+ set_lldb_version(versions)
90
+ end
91
+
92
+ def set_lldb_version(versions)
93
+ number_version, lldb_command = versions.sort.last
94
+ lldb_not_found unless number_version
95
+ warning_lldb_version(lldb_command) if number_version < 40
96
+ params[PARAMETER_LLDB] = lldb_command
97
+ end
98
+
99
+ def warning_lldb_version(lldb_command)
100
+ p "---------------------------------------------------------------------------------------------------------------------------"
101
+ p "WARNING!!! PROBABLY YOUR CURRENT VERSION #{lldb_command} MAYBE < lldb-4.0. THIS MAY BE PROBLEM. PLEASE INSTALL lldb-4.0 end above"
102
+ p "---------------------------------------------------------------------------------------------------------------------------"
103
+ end
104
+
105
+ def lldb_not_found
106
+ p "LLDB NOT FOUND!!! PLEASE INSTALL LLDB"
107
+ exit 1
108
+ end
109
+
110
+ def which?(command)
111
+ system("which #{command} >/dev/null")
112
+ end
75
113
  end
76
114
  end
@@ -21,7 +21,7 @@ module Lldbrun
21
21
  private
22
22
 
23
23
  def lldb_run_command
24
- "lldb #{argv_parser.param_file_path}"
24
+ "#{argv_parser.param_lldb} #{argv_parser.param_file_path}"
25
25
  end
26
26
 
27
27
  def generate_start_command
@@ -45,7 +45,7 @@ module Lldbrun
45
45
  end
46
46
 
47
47
  def lldb_standard_params
48
- ' ' << argv_parser.param_lldb
48
+ ' ' << argv_parser.param_lldb_options
49
49
  end
50
50
 
51
51
  def lldb_run
@@ -1,3 +1,3 @@
1
1
  module Lldbrun
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lldbrun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleh Hudeichuk