simple_sync 0.0.1 → 0.0.2

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
  SHA1:
3
- metadata.gz: 103aad0ffc5a90c307ccc0f9ed7c78a167978a72
4
- data.tar.gz: 33655b87ce9d39722b5a4cc9a295b1d99d784587
3
+ metadata.gz: 2d33cda9c934b024253b445ade7038c6761e8428
4
+ data.tar.gz: c5c4f2432020f4dbd23af2054f78239553e04b83
5
5
  SHA512:
6
- metadata.gz: 3e0c8dcf91ff8d3e882aec76b402627d3230509e9170d1fe52c68eaafb1583564502c68bd9dacc9bc6baafbc430b3422c5ffa7caa7854fd0529e7068dc990013
7
- data.tar.gz: 41c3dfb3b0b547cdac28190df1a5ef9eb1362e1475f83ca9820332327224717f45f78faaa5b72dfceee7d8cabb65ff76b7b4731b5fe7fafb956d2145ac2cf31d
6
+ metadata.gz: d6b3db16a47cd174c3e346978cb3e3b4f81640a858f06ed26a7e21c9015dc3acf019a706f56cbeb34ca62a87aa67d915e206480ce6d6a6cc66bb915d3f79ac20
7
+ data.tar.gz: 26d4e1635d9853450973db7e8d7e3babed4aa3c315e605267487e8bf8316d88a9e2d388a5b46f5aa9fa7b27a4c03abcaf54305351eb33f57586e5aeb7be07611
data/.gitignore CHANGED
@@ -23,3 +23,4 @@ mkmf.log
23
23
  *.swp
24
24
  test/test_destination/*
25
25
  !test/test_destination/.keep
26
+ .ruby-version
data/Gemfile CHANGED
@@ -1,8 +1,6 @@
1
1
  source 'https://rubygems.org'
2
- gem 'rsync'
3
- gem 'rake'
4
-
5
2
  group :development, :test do
3
+ gem 'rake'
6
4
  gem 'minitest'
7
5
  gem 'minitest-rg'
8
6
  gem 'pry'
data/bin/simple_sync CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  require 'simple_sync'
4
4
  bs = SimpleSync.new
5
- bs.load_config
6
- bs.copy_to_destination
7
-
5
+ result = bs.load_config
6
+ if result[:status] == 'success'
7
+ bs.copy_to_destination
8
+ else
9
+ puts "Error loading cnfiguration #{result[:message]}"
10
+ end
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- require 'rsync'
3
2
  require 'json'
4
3
 
5
4
  class SimpleSync
@@ -11,22 +10,23 @@ class SimpleSync
11
10
 
12
11
  def read_config_from_file
13
12
  if File.exists?(@config_file)
14
- #puts "opening file #{@config_file}"
13
+ puts "opening file #{@config_file}"
15
14
  config = File.open(@config_file).read
16
15
  elsif File.exists?(File.join(Dir.home, @config_file))
17
16
  config = File.open(File.join(Dir.home, @config_file)).read
18
- #puts "opening file #{File.join(Dir.home, @config_file)}"
17
+ puts "opening file #{File.join(Dir.home, @config_file)}"
19
18
  else
20
- #puts "opening environment #{ENV['BACKUP_SYNC']}"
21
- return { status: 'error ', message: "could not find configuration file #{@config_file}" } unless ENV['BACKUP_SYNC']
22
- return { status: 'error ', message: "could not find configuration file #{@config_file}" } unless File.exists?(ENV['BACKUP_SYNC'])
23
- config = File.open(ENV['BACKUP_SYNC']).read
19
+ puts "opening environment #{ENV['SIMPLE_SYNC']}"
20
+ return { status: 'error', message: "could not find configuration file #{@config_file}" } unless ENV['SIMPLE_SYNC']
21
+ return { status: 'error', message: "could not find configuration file #{@config_file}" } unless File.exists?(ENV['SIMPLE_SYNC'])
22
+ config = File.open(ENV['SIMPLE_SYNC']).read
24
23
  end
25
24
  { status: 'success', config: config }
26
25
  end
27
26
 
28
27
  def load_config
29
28
  configuration = read_config_from_file()
29
+ #puts configuration
30
30
  return configuration if configuration[:status] == 'error'
31
31
  @config_list = JSON.parse(configuration[:config], symbolize_names: true)
32
32
  return { status: 'success' }
@@ -1,3 +1,3 @@
1
- module SimpleSync
2
- VERSION = "0.0.1"
1
+ class SimpleSync
2
+ VERSION = "0.0.2"
3
3
  end
data/simple_sync.gemspec CHANGED
@@ -2,6 +2,7 @@
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'simple_sync/version'
5
+ require 'bundler'
5
6
 
6
7
  Gem::Specification.new do |spec|
7
8
  spec.name = "simple_sync"
@@ -24,4 +25,5 @@ Gem::Specification.new do |spec|
24
25
  spec.add_development_dependency "pry-nav", "~>0.2"
25
26
  spec.add_development_dependency "autotest-standalone", "~>4.4"
26
27
 
28
+ Bundler.require(:default, :development)
27
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Claburn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-02 00:00:00.000000000 Z
11
+ date: 2014-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -92,7 +92,6 @@ extra_rdoc_files: []
92
92
  files:
93
93
  - ".autotest"
94
94
  - ".gitignore"
95
- - ".ruby-version"
96
95
  - ".travis.yml"
97
96
  - Gemfile
98
97
  - LICENSE.txt
@@ -147,4 +146,3 @@ test_files:
147
146
  - test/test_source/somedirectory/dir1/another_file1.txt
148
147
  - test/test_source/somedirectory/dir2/another_file2.txt
149
148
  - test/unit/test_simple_sync.rb
150
- has_rdoc:
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.1