ghetto_notes 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +9 -2
- data/lib/ghetto_notes/installer.rb +14 -3
- data/lib/ghetto_notes/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2618901cb19815a56959f5e93b1caf368301c7a8a32c88e88adbd6bfe5770987
|
4
|
+
data.tar.gz: c48976f34df27d8e75704ac2289a3834b474e4b8721fb7e0d783631d03a788f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f050d061a0d7f1b791676302e4020a110b470cc5ca665f931e034af7fc2a7ef9c03e7540fc1f8ecd45df16f5ecb8b23a7a9a09978595586426b301e716007445
|
7
|
+
data.tar.gz: 9421b70807606547de5029b1ae1a96d15f063ea8120533c7e835654a29767c8d520a4518b794360d9f157d11c24a420d133a3f2f33c35c17fea89a04f1539286
|
data/Gemfile.lock
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ghetto_notes (0.1.4)
|
5
|
+
|
1
6
|
GEM
|
2
7
|
remote: https://rubygems.org/
|
3
8
|
specs:
|
@@ -25,8 +30,10 @@ PLATFORMS
|
|
25
30
|
ruby
|
26
31
|
|
27
32
|
DEPENDENCIES
|
28
|
-
|
29
|
-
|
33
|
+
bundler (~> 1.16)
|
34
|
+
ghetto_notes!
|
35
|
+
pry (~> 0.13.0)
|
36
|
+
rspec (~> 3.9.0)
|
30
37
|
|
31
38
|
BUNDLED WITH
|
32
39
|
1.16.3
|
@@ -2,16 +2,17 @@ require 'tempfile'
|
|
2
2
|
|
3
3
|
module GhettoNotes
|
4
4
|
class Installer
|
5
|
-
attr_reader :sync_dir
|
5
|
+
attr_reader :sync_dir, :crontab
|
6
6
|
|
7
|
-
def initialize(sync_dir)
|
7
|
+
def initialize(sync_dir, crontab: Crontab.new)
|
8
8
|
@sync_dir = sync_dir
|
9
|
+
@crontab = crontab
|
9
10
|
end
|
10
11
|
|
11
12
|
def perform
|
12
13
|
cmd = "#{GhettoNotes.bin_file} sync #{sync_dir}"
|
13
14
|
crontab_entry = "*/2 * * * * #{cmd}"
|
14
|
-
existing_tab =
|
15
|
+
existing_tab = crontab.current.split("\n")
|
15
16
|
|
16
17
|
if existing_tab.include?(crontab_entry)
|
17
18
|
$stderr.puts 'Already installed'
|
@@ -25,6 +26,16 @@ module GhettoNotes
|
|
25
26
|
new_crontab << "\n"
|
26
27
|
new_crontab.close
|
27
28
|
|
29
|
+
crontab.set_from(new_crontab.path)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class Crontab
|
34
|
+
def current
|
35
|
+
`crontab -l`
|
36
|
+
end
|
37
|
+
|
38
|
+
def set_from(fname)
|
28
39
|
`crontab #{new_crontab.path}`
|
29
40
|
end
|
30
41
|
end
|
data/lib/ghetto_notes/version.rb
CHANGED