osp 0.4.0 → 0.5.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
  SHA1:
3
- metadata.gz: 569423a826e7be5a16b70daa0d1726a2ec4d3ca9
4
- data.tar.gz: 94d944406202809244d7d4438c466bf6f7af8284
3
+ metadata.gz: 46891f45eba94adf6d8a85f41ae72fad47af6238
4
+ data.tar.gz: e46f551edf7948e3625cea51260a2103af8cd6ac
5
5
  SHA512:
6
- metadata.gz: d2f63e1c0e2ee680fa92c6dfae02109cf7e79938eb852701d4b87fc2f5a40e1a1e520703838230e75169d9e33335e5e8c04cf497997b891cc11c8dac030a06f3
7
- data.tar.gz: 9a763890d156cf60f2b9f0a2ef1d4a54d9266c7680c2e5799901a3a489b1f79ca00b8169066e4d6fb5a4559b9071b65497624a4f2c15b898263f2342b20144d1
6
+ metadata.gz: 6b48c4218a002df463bae78e2986e5cfe9471ab96545534113f57f2acfb6fbe74b144e0dd632c436751bb902bf240fa381813cce02400df9126a49fa78070ef8
7
+ data.tar.gz: 6471f2c637e7ecc0a161f61138c29d57ac3e4ce9edd15b78f23ebe114bcafa2c24ba92133ddf0e3cb5335fedf52c2168e63f37f73b839e7286b2ec269d908551
data/Makefile CHANGED
@@ -3,7 +3,7 @@ GEM_NAME = osp
3
3
 
4
4
  include Makefile.common
5
5
 
6
- # Email: root
6
+ # Email: example@example.com
7
7
  # Password: password
8
8
  dev:
9
9
  RUBYOPT=-rbundler/setup ruby --debug ./bin/osp -d passwords.osp
data/Makefile.common CHANGED
@@ -1,10 +1,11 @@
1
1
 
2
2
  # Ruby Common Big
3
- # 2016-02-14
3
+ # 2016-04-09
4
4
 
5
5
  MV = mv -nv
6
6
  RM = rm -rf
7
7
  MKDIR = mkdir -p
8
+ CHMOD = chmod
8
9
  BUNDLER = bundle
9
10
  BUNDLER_OPTIONS = --jobs=5 --retry=3
10
11
  GEMSPEC_FILE = $(GEM_NAME).gemspec
@@ -51,3 +52,7 @@ release: | releases
51
52
 
52
53
  releases:
53
54
  $(MKDIR) $@
55
+
56
+ tmp:
57
+ $(MKDIR) $@
58
+ $(CHMOD) u=rwx,go-rwx $@
data/README.md CHANGED
@@ -15,7 +15,7 @@ or via `Gemfile`:
15
15
 
16
16
  - [Usage Video](https://asciinema.org/a/32521)
17
17
  - [Blog Post about OSP](http://blog.fox21.at/2015/12/19/one-shall-pass-for-command-line.html)
18
- - [Gem](https://rubygems.org/gems/osp)
18
+ - [OSP Gem](https://rubygems.org/gems/osp)
19
19
  - [Travis CI Repository](https://travis-ci.org/TheFox/osp)
20
20
 
21
21
  ## Weblinks
data/bin/osp CHANGED
@@ -21,8 +21,8 @@ opts = OptionParser.new do |o|
21
21
  @options[:database_lock_path] = "#{path}~lock"
22
22
  end
23
23
 
24
- o.on_tail('--version', 'Show version.') do
25
- puts "osp #{TheFox::OSP::VERSION}"
24
+ o.on_tail('-V', '--version', 'Show version.') do
25
+ puts "osp #{TheFox::OSP::VERSION} (#{TheFox::OSP::DATE})"
26
26
  puts TheFox::OSP::HOMEPAGE
27
27
  exit
28
28
  end
@@ -54,11 +54,18 @@ if File.exist?(@options[:database_lock_path])
54
54
  exit
55
55
  end
56
56
  end
57
+ File.write(@options[:database_lock_path], 'tmp')
58
+ File.chmod(0600, @options[:database_lock_path])
57
59
  File.binwrite(@options[:database_lock_path], Process.pid)
58
60
 
59
61
  puts 'Master Login'
60
- email = @cli.ask(' Email: ')
61
- password = @cli.ask('Password: '){ |q| q.echo = '*' }
62
+ if $DEBUG
63
+ email = 'example@example.com'
64
+ password = 'password'
65
+ else
66
+ email = @cli.ask(' Email: ')
67
+ password = @cli.ask('Password: '){ |q| q.echo = '*' }
68
+ end
62
69
 
63
70
  Console.cursor_jump_to_column
64
71
  Console.cursor_up(2)
@@ -319,6 +326,8 @@ while true
319
326
  else
320
327
  puts 'No hosts found.'
321
328
  end
329
+ when 'c'
330
+ system('clear')
322
331
  when 'q'
323
332
  break
324
333
  when '?'
@@ -329,6 +338,7 @@ while true
329
338
  puts "\ti - Print informations about a host found by a search."
330
339
  puts "\te - Edit a host found by search."
331
340
  puts "\td - Delete a host found by search."
341
+ puts "\tc - Clear screen."
332
342
  puts "\tq - Quit search."
333
343
  puts "\t? - Print help."
334
344
  else
@@ -338,8 +348,10 @@ while true
338
348
  next if search_actions.count > 0
339
349
 
340
350
  puts
341
- search_actions << @cli.ask('[sliedq?] >> '){ |q| q.character = true }.downcase
351
+ search_actions << @cli.ask('[sliedcq?] >> '){ |q| q.character = true }.downcase
342
352
  end
353
+ when 'c'
354
+ system('clear')
343
355
  when 'x'
344
356
  actions << 'q'
345
357
  actions << 'w'
@@ -378,6 +390,7 @@ while true
378
390
  puts "\tn - New password."
379
391
  puts "\tl - List hosts from database."
380
392
  puts "\ts - Search submenu."
393
+ puts "\tc - Clear screen."
381
394
  puts "\tx - Same as wq."
382
395
  puts "\tw - Write database to file."
383
396
  puts "\tq - Quit."
@@ -389,7 +402,7 @@ while true
389
402
  next if actions.count > 0
390
403
 
391
404
  puts
392
- actions << @cli.ask('[nlsxwq?] > '){ |q| q.character = true }.downcase
405
+ actions << @cli.ask('[nlscxwq?] > '){ |q| q.character = true }.downcase
393
406
  end
394
407
 
395
408
  remove_lock
data/lib/osp/database.rb CHANGED
@@ -129,15 +129,21 @@ module TheFox
129
129
  db_out = Base64.strict_encode64(db_out)
130
130
 
131
131
  write_callback(1300, "Write temp file to '#{tmp}'.")
132
+ File.write(tmp, 'tmp')
133
+ File.chmod(0600, tmp)
132
134
  File.binwrite(tmp, db_out)
133
135
 
134
136
  backup_dts = Time.now.strftime('%Y%m%d-%H%M%S')
135
137
  backup = "#{@file_path}~backup_#{backup_dts}_" + Digest::SHA256.file(tmp).hexdigest[0..7]
136
138
 
137
139
  write_callback(1350, "Backup temp file to '#{backup}'.")
140
+ File.write(backup, 'tmp')
141
+ File.chmod(0600, backup)
138
142
  FileUtils.cp(tmp, backup)
139
143
 
140
144
  write_callback(1390, "Finally, move temp file to '#{@file_path}'.")
145
+ File.write(@file_path, 'tmp')
146
+ File.chmod(0600, @file_path)
141
147
  FileUtils.mv(tmp, @file_path)
142
148
 
143
149
  @has_changed = false
data/lib/osp/version.rb CHANGED
@@ -1,9 +1,9 @@
1
1
 
2
2
  module TheFox
3
3
  module OSP
4
- RELEASE_ID = 6
5
- VERSION = '0.4.0'
6
- DATE = '2016-03-05'
4
+ RELEASE_ID = 7
5
+ VERSION = '0.5.0'
6
+ DATE = '2016-05-21'
7
7
  HOMEPAGE = 'https://github.com/TheFox/osp'
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: osp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Mayer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-05 00:00:00.000000000 Z
11
+ date: 2016-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest