ghetto_notes 0.1.4 → 0.1.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8984f67e30036d22e3c47dc9fd96ba9d86d282fb6f880b167221846c008ee4d4
4
- data.tar.gz: 542e231d4e45b7ffd378374d1c3bfd70153073fc9af2afc4199357e2ae385f18
3
+ metadata.gz: 2618901cb19815a56959f5e93b1caf368301c7a8a32c88e88adbd6bfe5770987
4
+ data.tar.gz: c48976f34df27d8e75704ac2289a3834b474e4b8721fb7e0d783631d03a788f4
5
5
  SHA512:
6
- metadata.gz: 8f5a90211bc48ce3328beac507bbee1f32d61496e46e986059a6787ba8eada3a2ec48f30229b78aa3ead94cdd71542e4644f9bf852a04ed44fabf159325f43d4
7
- data.tar.gz: e30ade8de543473e84e2f6f0176ec7c9e06ea2e17ed8267ca6a10003361b9a37a9ad17c7fd35627ceb249a4ee3caa5dee5e66caa5913c6c02679a39a78720c42
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
- pry
29
- rspec
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 = `crontab -l`.split("\n")
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
@@ -1,3 +1,3 @@
1
1
  module GhettoNotes
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ghetto_notes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Grenfell