aro 0.2.7 → 0.2.8

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.
@@ -24,7 +24,7 @@ class Aro::Dom::Menu < ActiveRecord::Base
24
24
  end
25
25
 
26
26
  def directory
27
- Aro::Dom::DataBase::Directory.find_by(uuid: uuid)
27
+ @directory ||= Aro::Dom::DataBase::Directory.find_by(uuid: uuid)
28
28
  end
29
29
 
30
30
  def generate_new_item(localized_name, for_type: :user)
@@ -45,14 +45,14 @@ class Aro::Dom::Menu < ActiveRecord::Base
45
45
  return unless is_menu_named?(:ma_ain) &&
46
46
  menu_items.empty?
47
47
 
48
- [:settings, :quit].each{|k|
48
+ [:library, :settings, :quit].each{|k|
49
49
  i = generate_new_item(k, for_type: :system)
50
50
 
51
51
  i.aro_file.write!(
52
52
  Aro::Dom::Store.build_exec_oss_om_params!(
53
+ k,
53
54
  Aro::Dom::Ma_ain,
54
- "exec_#{k}!",
55
- k
55
+ "exec_#{k}!"
56
56
  )
57
57
  )
58
58
  }
@@ -67,9 +67,9 @@ class Aro::Dom::Menu < ActiveRecord::Base
67
67
 
68
68
  i.aro_file.write!(
69
69
  Aro::Dom::Store.build_exec_oss_om_params!(
70
+ k,
70
71
  Aro::Dom::Oss_OpenMenu,
71
- "open_#{k}!",
72
- k
72
+ "open_#{k}!"
73
73
  )
74
74
  )
75
75
  }
@@ -70,9 +70,6 @@ class Aro::Dom::MenuItem < ActiveRecord::Base
70
70
  raise "missing or invalid action_params: #{action_params.inspect}"
71
71
  end
72
72
 
73
- puts action_params
74
- puts "here " * 111
75
- puts action_storage_key.class
76
73
  result = nil
77
74
  case action_storage_key
78
75
  when :OSS_OM
@@ -101,10 +98,11 @@ class Aro::Dom::MenuItem < ActiveRecord::Base
101
98
  Aro::Dom::Action::TYPES.keys.select{|k|
102
99
  k == action_storage_key
103
100
  }.first,
104
- store.safe_get_key("action_params")
101
+ store.safe_get_key("action_params"),
102
+ store.safe_get_key("action_data")
105
103
  )
106
104
  else
107
- Aro::Dom::Ma_ain.i2097i_bookmark
105
+ Aro::Dom::Ma_ain.sane_backtrace!
108
106
  puts __method__
109
107
  puts inspect
110
108
  puts :todo_implement_invalid_action_handling
@@ -18,6 +18,8 @@ module Aro
18
18
  "Aro::Cor",
19
19
  "Aro::Dom::Oss_OpenMenu",
20
20
  "Aro::Dom::Ma_ain",
21
+ "Aro::Dom::Library",
22
+ "Aro::Dom::Book",
21
23
  "Aro::Dom::Git",
22
24
  "Aro::Dom::Ssh"
23
25
  ]
@@ -74,6 +76,11 @@ module Aro
74
76
  Aro::P.say("sourcing existing Aro::Cor env...")
75
77
  Aro::Cor.instance.source_config
76
78
 
79
+ # # temp debugging
80
+ # # explicitly debug in development and data_base logging
81
+ # Aro::Cor.set_ivar(:LOG_DATABASE, :true.to_s)
82
+ # Aro::Cor.set_ivar(:ENV, Aro::Cor::ENVS[:DEVELOPMENT])
83
+
77
84
  # set up oss_om workspace
78
85
  Aro::P.say("Aro::Dom::Ma_ain.init!")
79
86
  Aro::Dom::Ma_ain.init!
@@ -85,21 +92,19 @@ module Aro
85
92
  required_local_files = [
86
93
  ".gitignore",
87
94
  ".git/config",
88
- File.basename(private_key_path),
89
- File.basename(private_key_path) + :".pub".to_s,
95
+ ::File.basename(private_key_path),
96
+ ::File.basename(private_key_path) + :".pub".to_s,
90
97
  ]
91
98
  missing_required_files = required_local_files.any?{|rlf| !::File.exist?(rlf)}
92
- return Aro::Dom::Git.log unless missing_required_files
99
+ return true unless missing_required_files
93
100
  # run the install program until setup is complete
94
101
  # return false to cancel
95
102
  while missing_required_files do
96
103
  gitconfig_path = ::File.join(key_path, ".git/config")
97
104
  Aro::P.say("checking for local .git/config at #{gitconfig_path}")
98
105
  if ::File.exist?(gitconfig_path)
99
- break unless required_local_files.empty?{|rlf| !::File.exist?(rlf)}
100
-
101
106
  Aro::P.say("#{self.name} already installed. continuing...")
102
- return Aro::Dom::Git.log
107
+ return true if required_local_files.all?{|rlf| ::File.exist?(rlf)}
103
108
  else
104
109
  Aro::P.say("missing local .git/config!")
105
110
  Aro::P.say("setting up local git config...")
@@ -143,14 +148,16 @@ module Aro
143
148
  system("chmod 700 #{private_key_path}")
144
149
  Aro::P.say("#{self.name} uses the project .gitignore to ensure privacy.")
145
150
  Aro::P.say("write .gitignore!")
146
- File.open(".gitignore", "w+") do |f|
151
+ ::File.open(".gitignore", "w+") do |f|
147
152
  f.write([
148
153
  "#",
149
154
  "#",
150
155
  "# auto-generated by #{self.name} > #{key_domain} on #{Time.now}",
151
156
  "#",
152
157
  "# ignore oss_om private key!",
153
- File.basename(private_key_path),
158
+ ::File.basename(private_key_path),
159
+ "# ignore oss_om public key!",
160
+ ::File.join(::File.basename(private_key_path), ".pub"),
154
161
  "#",
155
162
  "# ignore entire '.oss_om/' directory!",
156
163
  "#{Aro::Dom::Ma_ain::ARO_DIRECTORY.to_s}/*",
@@ -169,21 +176,16 @@ module Aro
169
176
  default_config = {
170
177
  user_email: git_email,
171
178
  user_name: git_username,
172
- init_defaultBranch: :foss_om,
173
179
  user_signingkey: "#{private_key_path}.pub",
174
180
  gpg_format: :ssh,
175
181
  commit_gpgsign: true,
176
182
  core_editor: :nano
177
183
  }.each{|k, v|
178
184
  Aro::P.say("system(git config #{k.to_s.gsub("_", ".")} #{v})")
179
- system(:"git config #{k.to_s.gsub("_", ".")} #{v}".to_s)
185
+ system(:"git config #{k.to_s.gsub("_", ".")} '#{v}'".to_s)
180
186
  }
181
187
  end
182
188
 
183
- Aro::P.say("system(git checkout -b #{default_config[:init_defaultBranch]})")
184
- system(:"git checkout -b #{default_config[:init_defaultBranch]}".to_s)
185
- Aro::P.say("system(git branch -D main")
186
- system(:"git branch -D main".to_s)
187
189
  Aro::P.say("system(git add .)")
188
190
  system(:"git add .".to_s)
189
191
  Aro::P.say("system(git commit -m '#{key_domain} initial commit'")
@@ -192,7 +194,7 @@ module Aro
192
194
  Aro::P.say("#{self.name} installed successfully.")
193
195
  end
194
196
 
195
- return Aro::Dom::Git.log
197
+ return true
196
198
  end
197
199
 
198
200
  def self.create_exec_oss_om_entry_for(menu_item)
@@ -240,38 +242,12 @@ module Aro
240
242
  Aro::P.say("oss_om_method '#{selected_method_name}' selected")
241
243
 
242
244
  menu_item.store.save_exec_oss_om_params!(
245
+ menu_item.localized_name,
243
246
  selected_const_name.constantize,
244
- selected_method_name,
245
- menu_item.localized_name
247
+ selected_method_name
246
248
  )
247
249
  end
248
250
 
249
- def self.create_exec_system_entry_for(menu_item)
250
- unless Aro::Dom::Ma_ain.is_encrypted?
251
- Aro::P.say(__method__)
252
- Aro::P.say("redirecting to settings until Aro::Dom::Ma_ain.is_encrypted!")
253
- Aro::Dom::Ma_ain.exec_settings!
254
- return
255
- end
256
-
257
- puts __method__
258
- puts self.name
259
- Aro::Dom::Ma_ain.i2097i_bookmark
260
- end
261
-
262
- def self.create_exec_data_base_entry_for(menu_item)
263
- unless Aro::Dom::Ma_ain.is_encrypted?
264
- Aro::P.say(__method__)
265
- Aro::P.say("redirecting to settings until Aro::Dom::Ma_ain.is_encrypted!")
266
- Aro::Dom::Ma_ain.exec_settings!
267
- return
268
- end
269
-
270
- puts __method__
271
- puts self.name
272
- Aro::Dom::Ma_ain.i2097i_bookmark
273
- end
274
-
275
251
  def self.open_git!
276
252
  Aro::Dom::Git.open!
277
253
  end
@@ -298,14 +274,14 @@ module Aro
298
274
  ".git/hooks/pre-commit"
299
275
  )
300
276
 
301
- Aro::Dom::Ma_ain.i2097i_bookmark
277
+ Aro::Dom::Ma_ain.sane_backtrace!
302
278
  puts "todo: ensure pre-commit file matches current generated content"
303
279
  pre_commit_validation_allow_invalid = true
304
280
  pre_commit_hook_valid = ::File.exist?(pre_commit_hook_path) && pre_commit_validation_allow_invalid
305
281
  return true if pre_commit_hook_valid
306
282
  Aro::P.say("warning: pre_commit_validation_allow_invalid is set to #{pre_commit_validation_allow_invalid}!")
307
283
 
308
- File.open(pre_commit_hook_path, "w+") do |f|
284
+ ::File.open(pre_commit_hook_path, "w+") do |f|
309
285
  f.write([
310
286
  "#",
311
287
  "#",
@@ -0,0 +1,104 @@
1
+ # frozen_string_literal: true
2
+
3
+ =begin
4
+
5
+ plugins.rb
6
+
7
+ aro dom plugins.
8
+
9
+ by i2097i
10
+
11
+ =end
12
+
13
+ module Aro
14
+ module Dom
15
+ class Plugins
16
+
17
+ def self.choose_plugin
18
+ ensure_plugins_dir_exists!
19
+
20
+ options = [
21
+ {name: :back, value: :back}
22
+ ] + Dir[::File.join(plugins_dir, "*")].map{|f|
23
+ {name: ::File.basename(f), value: f}
24
+ }
25
+
26
+ selected_option = Aro::P.default_select(
27
+ I18n.t("open_menu.plugins.select_plugin"),
28
+ options
29
+ )
30
+
31
+ return false if selected_option.kind_of?(Symbol) &&
32
+ selected_option == :back
33
+
34
+ raise "invalid file path! #{selected_option}" unless File.exist?(selected_option)
35
+
36
+ Aro::P.say("selected plugin: #{selected_option}")
37
+ confirmed = Aro::P.p.ask(
38
+ I18n.t(
39
+ "open_menu.plugins.confirm_plugin",
40
+ file_name: File.basename(selected_option)
41
+ )
42
+ )
43
+
44
+ if :y.to_s != confirmed
45
+ Aro::P.say(I18n.t("open_menu.plugins.user_cancelled"))
46
+ return false
47
+ end
48
+
49
+ # todo: validate_plugin_here
50
+
51
+ # ready to read plugin
52
+ selected_option
53
+ end
54
+
55
+ def self.plugins_dir
56
+ ::File.join(Aro::Cor.ivar(:OSS_OM_HOME), :plugins.to_s)
57
+ end
58
+
59
+ private
60
+
61
+ def self.ensure_plugins_dir_exists!
62
+ FileUtils.mkdir_p(plugins_dir) unless Dir.exist?(plugins_dir)
63
+ ensure_plugin_default_files_exists!
64
+ end
65
+
66
+ def self.sample_plugin_raw
67
+ [
68
+ "# frozen_string_literal: true\n",
69
+ "=begin\n",
70
+ " sample_plugin.rb\n",
71
+ " aro dom sample plugin\n",
72
+ " by #{`whoami`.strip}\n",
73
+ "=end\n",
74
+ "module Aro",
75
+ " module Dom",
76
+ " class SamplePlugin",
77
+ " def self.oss_om_start!(plugin_data = {})",
78
+ " puts self.name",
79
+ " puts __method__",
80
+ " puts \"running oss_om sample plugin...\"",
81
+ " plugin_data[\"sample_plugin_key\"] = \"hello_from_oss_om_plugin\"",
82
+ " plugin_data",
83
+ " end",
84
+ " end",
85
+ " end",
86
+ "end",
87
+ "\n",
88
+ ].join("\n")
89
+ end
90
+
91
+ def self.ensure_plugin_default_files_exists!
92
+ [
93
+ [".keep", ""],
94
+ ["sample_plugin.rb", sample_plugin_raw]
95
+ ].each{|a|
96
+ file_path = ::File.join(plugins_dir, a[Aro::Dom::Ma_ain::O])
97
+ ::File.open(file_path, "w+") {|f|
98
+ f.write(a[Aro::Dom::Ma_ain::S])
99
+ } unless ::File.exist?(file_path)
100
+ }
101
+ end
102
+ end
103
+ end
104
+ end
@@ -19,7 +19,7 @@ module Aro
19
19
  EXEC_METHODS = [
20
20
  :print_env,
21
21
  :print_cor_def,
22
- :edit_config
22
+ :edit_ivars
23
23
  ]
24
24
 
25
25
  def self.print_env
@@ -34,17 +34,70 @@ module Aro
34
34
 
35
35
  def self.print_cor_def
36
36
  self.instance.source_config
37
- Aro::P.say("Aro::Cor::DEF")
38
- Aro::P.say("\n" + Aro::Cor::DEF.map{|k, v|
39
- "#{k}: " + JSON.pretty_generate(Aro::Cor::DEF[k])
40
- }.join("\n"))
37
+ Aro::P.less(JSON.pretty_generate(Aro::Cor::DEF))
41
38
  end
42
39
 
43
- def self.edit_config
44
- puts self.name
45
- puts __method__
46
- puts :todo_open_cor_editor
47
- Aro::Dom::Ma_ain.i2097i_bookmark
40
+ def self.edit_ivars
41
+
42
+ Aro::P.say("#{self.name}.#{__method__}")
43
+ selected_def_key = Aro::P.default_select(
44
+ I18n.t("open_menu.edit_ivars_select"),
45
+ [{name: :back, value: :back}] + Aro::Cor::DEF.select{|k, v|
46
+ # do not allow writing to OSS_OM_HOME from oss_om
47
+ v[:access] == Aro::Cor::DEF_ACCESS[:WRITE] && k != :OSS_OM_HOME
48
+ }.map{|k, v|
49
+ {name: "#{k} (#{ivar(k)})", value: k}
50
+ }
51
+ )
52
+
53
+ if selected_def_key == :back
54
+ Aro::Dom::Ma_ain.open!(:cor)
55
+ return
56
+ end
57
+
58
+ Aro::P.say("'#{selected_def_key}' selected")
59
+
60
+ new_value = nil
61
+ while new_value.nil? ||
62
+ !self.instance.valid_var?(
63
+ new_value,
64
+ selected_def_key,
65
+ Aro::Cor::DEF[selected_def_key]
66
+ )
67
+
68
+ case Aro::Cor::DEF[selected_def_key][:type]
69
+ when :bool
70
+ new_value = !(ivar(selected_def_key) == :true.to_s)
71
+ when :int, :string
72
+ new_value = Aro::P.p.ask(
73
+ I18n.t(
74
+ "open_menu.new_ivar_value_prompt",
75
+ def_key: selected_def_key,
76
+ current_value: ivar(selected_def_key),
77
+ value_type: Aro::Cor::DEF[selected_def_key][:type]
78
+ )
79
+ )
80
+ when :values
81
+ new_value = Aro::P.default_select(
82
+ I18n.t("open_menu.edit_ivars_possible_values_select", def_key: selected_def_key),
83
+ [
84
+ {name: :back, value: :back}
85
+ ] + Aro::Cor::DEF[
86
+ selected_def_key
87
+ ][:possible_values].map{|k, v|
88
+ Aro::P.say("#{k}_desc: #{v}") # v is description localized text
89
+
90
+ {name: k, value: k}
91
+ }
92
+ )
93
+
94
+ return if new_value == :back
95
+ end
96
+
97
+ end
98
+
99
+ set_ivar(selected_def_key, new_value)
100
+ Aro::Dom::Ma_ain.open!(:cor)
48
101
  end
49
102
 
50
103
  ARO_IVA_PREFIX = :ARO_IVA_
@@ -188,7 +241,7 @@ module Aro
188
241
  # adapts I18n translations to generate bash environment vars.
189
242
  #
190
243
  # example usage:
191
- # Aro::Cor::DEF[:Z_MAX]
244
+ # Aro::Cor::DEF[:ENV]
192
245
  DEF = {
193
246
  #
194
247
  # => ivars
@@ -197,33 +250,39 @@ module Aro
197
250
  type: Aro::Cor::TYPES[:VALUES],
198
251
  access: Aro::Cor::DEF_ACCESS[:WRITE],
199
252
  value: Aro::Cor::ENVS[:PRODUCTION],
200
- description: I18n.t("cor.env.description"),
253
+ description: I18n.t("cor.ivars.env.description"),
201
254
  possible_values: {
202
- development: I18n.t("cor.env.development_description"),
203
- production: I18n.t("cor.env.production_description"),
204
- test: I18n.t("cor.env.test_description"),
255
+ development: I18n.t("cor.ivars.env.development_description"),
256
+ production: I18n.t("cor.ivars.env.production_description"),
257
+ test: I18n.t("cor.ivars.env.test_description"),
205
258
  }
206
259
  },
207
- LOG_DATABASE: {
260
+ VERBOSE: {
208
261
  type: Aro::Cor::TYPES[:BOOL],
209
262
  access: Aro::Cor::DEF_ACCESS[:WRITE],
210
263
  value: Aro::Cor::BOOLS[:FALSE],
211
- description: I18n.t("cor.log_aro_db_description"),
264
+ description: I18n.t("cor.ivars.verbose_description"),
212
265
  },
213
266
  OSS_OM_HOME: {
214
267
  type: Aro::Cor::TYPES[:STRING],
215
268
  access: Aro::Cor::DEF_ACCESS[:WRITE],
216
269
  value: nil,
217
- description: I18n.t("cor.oss_om_home.description"),
270
+ description: I18n.t("cor.ivars.oss_om_home.description"),
218
271
  possible_values: {
219
- path: I18n.t("cor.oss_om_home.path_description"),
272
+ path: I18n.t("cor.ivars.oss_om_home.path_description"),
220
273
  }
221
274
  },
222
- VERBOSE: {
275
+ HIDE_F_OSS_OM_MENU: {
276
+ type: Aro::Cor::TYPES[:BOOL],
277
+ access: Aro::Cor::DEF_ACCESS[:WRITE],
278
+ value: Aro::Cor::BOOLS[:TRUE],
279
+ description: I18n.t("cor.ivars.hide_f_oss_om_description"),
280
+ },
281
+ LOG_DATABASE: {
223
282
  type: Aro::Cor::TYPES[:BOOL],
224
283
  access: Aro::Cor::DEF_ACCESS[:WRITE],
225
284
  value: Aro::Cor::BOOLS[:FALSE],
226
- description: I18n.t("cor.verbose_description"),
285
+ description: I18n.t("cor.ivars.log_db_description"),
227
286
  },
228
287
 
229
288
  #
@@ -233,43 +292,43 @@ module Aro
233
292
  type: Aro::Cor::TYPES[:STRING],
234
293
  access: Aro::Cor::DEF_ACCESS[:READ],
235
294
  value: Aro::Mancy::NAME_FILE,
236
- description: I18n.t("cor.aro_env.OSS_OM_FILE_description"),
295
+ description: I18n.t("cor.ovars.OSS_OM_FILE_description"),
237
296
  },
238
297
  O: {
239
298
  type: Aro::Cor::TYPES[:INT],
240
299
  access: Aro::Cor::DEF_ACCESS[:READ],
241
300
  value: Aro::Mancy::O,
242
- description: I18n.t("cor.aro_env.O_description"),
301
+ description: I18n.t("cor.ovars.O_description"),
243
302
  },
244
303
  S: {
245
304
  type: Aro::Cor::TYPES[:INT],
246
305
  access: Aro::Cor::DEF_ACCESS[:READ],
247
306
  value: Aro::Mancy::S,
248
- description: I18n.t("cor.aro_env.S_description"),
307
+ description: I18n.t("cor.ovars.S_description"),
249
308
  },
250
309
  OS: {
251
310
  type: Aro::Cor::TYPES[:INT],
252
311
  access: Aro::Cor::DEF_ACCESS[:READ],
253
312
  value: Aro::Mancy::OS,
254
- description: I18n.t("cor.aro_env.OS_description"),
313
+ description: I18n.t("cor.ovars.OS_description"),
255
314
  },
256
315
  E: {
257
316
  type: Aro::Cor::TYPES[:INT],
258
317
  access: Aro::Cor::DEF_ACCESS[:READ],
259
318
  value: Aro::Mancy::E,
260
- description: I18n.t("cor.aro_env.E_description"),
319
+ description: I18n.t("cor.ovars.E_description"),
261
320
  },
262
321
  N: {
263
322
  type: Aro::Cor::TYPES[:INT],
264
323
  access: Aro::Cor::DEF_ACCESS[:READ],
265
324
  value: Aro::Mancy::N,
266
- description: I18n.t("cor.aro_env.N_description"),
325
+ description: I18n.t("cor.ovars.N_description"),
267
326
  },
268
- N: {
327
+ V: {
269
328
  type: Aro::Cor::TYPES[:INT],
270
329
  access: Aro::Cor::DEF_ACCESS[:READ],
271
330
  value: Aro::Mancy::V,
272
- description: I18n.t("cor.aro_env.V_description"),
331
+ description: I18n.t("cor.ovars.V_description"),
273
332
  },
274
333
  }
275
334
 
@@ -298,6 +357,14 @@ module Aro
298
357
  Aro::Cor.ivar(:ENV) == Aro::Cor::ENVS[:TEST].to_s
299
358
  end
300
359
 
360
+ def self.is_development?
361
+ Aro::Cor.ivar(:ENV) == Aro::Cor::ENVS[:DEVELOPMENT].to_s
362
+ end
363
+
364
+ def self.is_production?
365
+ Aro::Cor.ivar(:ENV) == Aro::Cor::ENVS[:PRODUCTION].to_s
366
+ end
367
+
301
368
  # out vars
302
369
  def self.ovar(suffix)
303
370
  Aro::Cor::DEF[suffix][:value]
@@ -399,7 +466,7 @@ module Aro
399
466
  }.each{|kv|
400
467
  Aro::D.say("variable_to_set: #{kv}")
401
468
  result = Aro::Cor.instance.cor_set_ruby_env!(kv[0].gsub(Aro::Cor::ARO_IVA_PREFIX.to_s, ""), kv[1])
402
- Aro::D.say("value_was_set: #{result}")
469
+ Aro::D.say("ENV[#{kv[0]}] set successfully: #{result}")
403
470
  }
404
471
 
405
472
  invalid_defs = validate_config
@@ -492,9 +559,9 @@ module Aro
492
559
  cor_menu.rename_item(menu_item, method_name) unless existing_item.nil?
493
560
  menu_item.aro_file.write!(
494
561
  Aro::Dom::Store.build_exec_oss_om_params!(
562
+ "#{:cor} #{method_name}",
495
563
  self,
496
- method_name,
497
- "#{:cor} #{method_name}"
564
+ method_name
498
565
  )
499
566
  )
500
567
  # clear existing item var
@@ -21,7 +21,6 @@ module Aro
21
21
  ]
22
22
 
23
23
  def self.open!
24
- generate_git_menu_items!
25
24
  Aro::Dom::Ma_ain.open!(:git)
26
25
  end
27
26
 
@@ -40,30 +39,6 @@ module Aro
40
39
  system(:"git config list --local".to_s)
41
40
  end
42
41
 
43
- private
44
-
45
- def self.generate_git_menu_items!
46
- git_menu = Aro::Dom::DataBase.open_menu(:git)
47
- return unless Aro::Mancy::S == git_menu.menu_items.count
48
-
49
- existing_item = git_menu.menu_items.first
50
- raise "missing existing item in #{self.name}.#{__method__}!" if existing_item.nil?
51
- EXEC_METHODS.each{|method_name|
52
- menu_item = existing_item || git_menu.generate_new_item(method_name, for_type: :system)
53
-
54
- git_menu.rename_item(menu_item, method_name) unless existing_item.nil?
55
- menu_item.aro_file.write!(
56
- Aro::Dom::Store.build_exec_oss_om_params!(
57
- self,
58
- method_name,
59
- "#{:git} #{method_name}"
60
- )
61
- )
62
- # clear existing item var
63
- existing_item = nil unless existing_item.nil?
64
- }
65
- end
66
-
67
42
  end
68
43
  end
69
44
  end
@@ -20,10 +20,15 @@ module Aro
20
20
  ID_KEY_BASE = :id_oss_om
21
21
 
22
22
  def self.open!
23
- generate_ssh_menu_items!
24
23
  Aro::Dom::Ma_ain.open!(:ssh)
25
24
  end
26
25
 
26
+ def self.encryption_installed?
27
+ ::File.exist?(id_key_path) &&
28
+ ::File.exist?("#{id_key_path}.pub") &&
29
+ !encrypt!({not: :equal}).kind_of?(Hash)
30
+ end
31
+
27
32
  def self.print_public_key
28
33
  Aro::P.less(::File.read("#{id_key_path}.pub"))
29
34
  end
@@ -75,45 +80,25 @@ module Aro
75
80
  end
76
81
 
77
82
  def self.id_key_path
78
- ::File.join(Aro::Cor.ivar(:OSS_OM_HOME), ID_KEY_BASE.to_s)
83
+ id_path = ::File.join(Aro::Cor.ivar(:OSS_OM_HOME), Aro::Dom::Ssh::ID_KEY_BASE.to_s)
84
+ raise "missing_id_key!" if Aro::Dom::Ma_ain.is_initialized? && !::File.exist?(id_path)
85
+ id_path
79
86
  end
80
87
 
81
88
  private
82
89
 
83
- def self.generate_ssh_menu_items!
84
- ssh_menu = Aro::Dom::DataBase.open_menu(:ssh)
85
- return unless Aro::Mancy::S == ssh_menu.menu_items.count
86
- # todo: generate ssh menu items if needed here
87
- existing_item = ssh_menu.menu_items.first
88
- raise "missing existing item in #{self.name}.#{__method__}!" if existing_item.nil?
89
- EXEC_METHODS.each{|method_name|
90
- menu_item = existing_item || ssh_menu.generate_new_item(method_name, for_type: :system)
91
-
92
- ssh_menu.rename_item(menu_item, method_name) unless existing_item.nil?
93
- menu_item.aro_file.write!(
94
- Aro::Dom::Store.build_exec_oss_om_params!(
95
- self,
96
- method_name,
97
- "#{:ssh} #{method_name}"
98
- )
99
- )
100
- # clear existing item var
101
- existing_item = nil unless existing_item.nil?
102
- }
103
- end
104
-
105
90
  def self.encrypt!(decrypted_json)
106
- Aro::Dom::Ma_ain.i2097i_bookmark
107
- puts __method__
108
- puts :expects_decrypted_json
91
+ # Aro::Dom::Ma_ain.sane_backtrace!
92
+ # puts __method__
93
+ # puts :expects_decrypted_json
109
94
 
110
95
  return decrypted_json
111
96
  end
112
97
 
113
98
  def self.decrypt!(encrypted_json)
114
- Aro::Dom::Ma_ain.i2097i_bookmark
115
- puts __method__
116
- puts :expects_encrypted_json
99
+ # Aro::Dom::Ma_ain.sane_backtrace!
100
+ # puts __method__
101
+ # puts :expects_encrypted_json
117
102
 
118
103
  return encrypted_json
119
104
  end