gync 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/.rvmrc +55 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +24 -0
- data/README.markdown +56 -0
- data/Rakefile +0 -10
- data/VERSION +1 -1
- data/bin/gync +6 -5
- data/gync.gemspec +20 -10
- data/lib/gync.rb +20 -26
- data/lib/gync/git.rb +63 -0
- data/spec/bin/gync_test_app +1 -0
- data/spec/gync_spec.rb +125 -3
- data/spec/spec_helper.rb +8 -0
- metadata +76 -84
- data/README.rdoc +0 -19
data/.rspec
CHANGED
data/.rvmrc
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# This is an RVM Project .rvmrc file, used to automatically load the ruby
|
4
|
+
# development environment upon cd'ing into the directory
|
5
|
+
|
6
|
+
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
|
7
|
+
environment_id="ruby-1.8.7-p352@gync"
|
8
|
+
|
9
|
+
#
|
10
|
+
# Uncomment following line if you want options to be set only for given project.
|
11
|
+
#
|
12
|
+
# PROJECT_JRUBY_OPTS=( --1.9 )
|
13
|
+
|
14
|
+
#
|
15
|
+
# First we attempt to load the desired environment directly from the environment
|
16
|
+
# file. This is very fast and efficient compared to running through the entire
|
17
|
+
# CLI and selector. If you want feedback on which environment was used then
|
18
|
+
# insert the word 'use' after --create as this triggers verbose mode.
|
19
|
+
#
|
20
|
+
if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
|
21
|
+
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
|
22
|
+
then
|
23
|
+
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
24
|
+
|
25
|
+
if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
|
26
|
+
then
|
27
|
+
. "${rvm_path:-$HOME/.rvm}/hooks/after_use"
|
28
|
+
fi
|
29
|
+
else
|
30
|
+
# If the environment file has not yet been created, use the RVM CLI to select.
|
31
|
+
if ! rvm --create "$environment_id"
|
32
|
+
then
|
33
|
+
echo "Failed to create RVM environment '${environment_id}'."
|
34
|
+
exit 1
|
35
|
+
fi
|
36
|
+
fi
|
37
|
+
|
38
|
+
#
|
39
|
+
# If you use an RVM gemset file to install a list of gems (*.gems), you can have
|
40
|
+
# it be automatically loaded. Uncomment the following and adjust the filename if
|
41
|
+
# necessary.
|
42
|
+
#
|
43
|
+
# filename=".gems"
|
44
|
+
# if [[ -s "$filename" ]]
|
45
|
+
# then
|
46
|
+
# rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
|
47
|
+
# fi
|
48
|
+
|
49
|
+
# If you use bundler, this might be useful to you:
|
50
|
+
# if command -v bundle && [[ -s Gemfile ]]
|
51
|
+
# then
|
52
|
+
# bundle install
|
53
|
+
# fi
|
54
|
+
|
55
|
+
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,20 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
archive-tar-minitar (0.5.2)
|
5
|
+
columnize (0.3.5)
|
4
6
|
diff-lcs (1.1.3)
|
5
7
|
git (1.2.5)
|
6
8
|
jeweler (1.6.4)
|
7
9
|
bundler (~> 1.0)
|
8
10
|
git (>= 1.2.5)
|
9
11
|
rake
|
12
|
+
linecache (0.46)
|
13
|
+
rbx-require-relative (> 0.0.4)
|
14
|
+
linecache19 (0.5.12)
|
15
|
+
ruby_core_source (>= 0.1.4)
|
10
16
|
rake (0.9.2.2)
|
17
|
+
rbx-require-relative (0.0.5)
|
11
18
|
rcov (0.9.11)
|
12
19
|
rspec (2.3.0)
|
13
20
|
rspec-core (~> 2.3.0)
|
@@ -17,6 +24,21 @@ GEM
|
|
17
24
|
rspec-expectations (2.3.0)
|
18
25
|
diff-lcs (~> 1.1.2)
|
19
26
|
rspec-mocks (2.3.0)
|
27
|
+
ruby-debug (0.10.4)
|
28
|
+
columnize (>= 0.1)
|
29
|
+
ruby-debug-base (~> 0.10.4.0)
|
30
|
+
ruby-debug-base (0.10.4)
|
31
|
+
linecache (>= 0.3)
|
32
|
+
ruby-debug-base19 (0.11.25)
|
33
|
+
columnize (>= 0.3.1)
|
34
|
+
linecache19 (>= 0.5.11)
|
35
|
+
ruby_core_source (>= 0.1.4)
|
36
|
+
ruby-debug19 (0.11.6)
|
37
|
+
columnize (>= 0.3.1)
|
38
|
+
linecache19 (>= 0.5.11)
|
39
|
+
ruby-debug-base19 (>= 0.11.19)
|
40
|
+
ruby_core_source (0.1.5)
|
41
|
+
archive-tar-minitar (>= 0.5.2)
|
20
42
|
|
21
43
|
PLATFORMS
|
22
44
|
ruby
|
@@ -26,3 +48,5 @@ DEPENDENCIES
|
|
26
48
|
jeweler (~> 1.6.4)
|
27
49
|
rcov
|
28
50
|
rspec (~> 2.3.0)
|
51
|
+
ruby-debug
|
52
|
+
ruby-debug19
|
data/README.markdown
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# Gync
|
2
|
+
|
3
|
+
by Sergey Potapov
|
4
|
+
|
5
|
+
## Description
|
6
|
+
|
7
|
+
This tool allows you to synchronize application data using git version system.
|
8
|
+
|
9
|
+
For example I use [rednotebook](http://rednotebook.sourceforge.net) and
|
10
|
+
[gnucash](http://www.gnucash.org). I have a number of devices(PC, laptop,etc.).
|
11
|
+
When I open rednotebook on my laptop I want to see changes done on my PC.
|
12
|
+
|
13
|
+
|
14
|
+
## Get started
|
15
|
+
|
16
|
+
I suppose you have already a git repository. You can use github if you don't care about privacy.
|
17
|
+
|
18
|
+
Install gync:
|
19
|
+
|
20
|
+
gem install gync
|
21
|
+
|
22
|
+
Create config file in you home directory `$HOME/.gync.yml`. For example:
|
23
|
+
|
24
|
+
rednotebook:
|
25
|
+
local: "/absolute/path/to/directory/you/want/to/synchonize"
|
26
|
+
remote: "/path/to/already/created/remote/git/repository"
|
27
|
+
gnucash:
|
28
|
+
local: "/local/path/to/gnucash/data"
|
29
|
+
local: "/remote/repo/for/gnucash"
|
30
|
+
|
31
|
+
Then just run your application:
|
32
|
+
|
33
|
+
gync rednotebook
|
34
|
+
|
35
|
+
When you run it this way gync pulls changes before your applications started
|
36
|
+
and pushes when it is finished.
|
37
|
+
|
38
|
+
For convenience you can create aliases in your `.bashrc`(or any other shell rc file):
|
39
|
+
|
40
|
+
alias rednotebook="gync rednotebook"
|
41
|
+
alias gnucash="gync gnucash"
|
42
|
+
|
43
|
+
## Contributing to gync
|
44
|
+
|
45
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
46
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
47
|
+
* Fork the project
|
48
|
+
* Start a feature/bugfix branch
|
49
|
+
* Commit and push until you are happy with your contribution
|
50
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
51
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
52
|
+
|
53
|
+
## Copyright
|
54
|
+
|
55
|
+
Copyright (c) 2011 Potapov Sergey. See LICENSE.txt for
|
56
|
+
further details.
|
data/Rakefile
CHANGED
@@ -37,13 +37,3 @@ RSpec::Core::RakeTask.new(:rcov) do |spec|
|
|
37
37
|
end
|
38
38
|
|
39
39
|
task :default => :spec
|
40
|
-
|
41
|
-
require 'rake/rdoctask'
|
42
|
-
Rake::RDocTask.new do |rdoc|
|
43
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
44
|
-
|
45
|
-
rdoc.rdoc_dir = 'rdoc'
|
46
|
-
rdoc.title = "gync #{version}"
|
47
|
-
rdoc.rdoc_files.include('README*')
|
48
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
49
|
-
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/bin/gync
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
3
4
|
require 'rubygems'
|
4
|
-
require '
|
5
|
-
require File.expand_path('../../lib/gync', __FILE__)
|
5
|
+
require 'ruby-debug'
|
6
6
|
|
7
|
-
|
7
|
+
require 'gync'
|
8
|
+
require 'optparse'
|
8
9
|
|
9
|
-
case
|
10
|
+
case ARGV.first.to_s
|
10
11
|
when /^(-h|--help|help|\s*)$/
|
11
12
|
Gync.print_help
|
12
13
|
else
|
13
|
-
Gync.run
|
14
|
+
Gync.run ARGV
|
14
15
|
end
|
data/gync.gemspec
CHANGED
@@ -4,39 +4,43 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.0
|
7
|
+
s.name = %q{gync}
|
8
|
+
s.version = "0.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Potapov Sergey"]
|
12
|
-
s.date =
|
13
|
-
s.
|
14
|
-
s.
|
12
|
+
s.date = %q{2011-11-27}
|
13
|
+
s.default_executable = %q{gync}
|
14
|
+
s.description = %q{Synchronizes data of desktop applications using Git}
|
15
|
+
s.email = %q{blake131313@gmail.com}
|
15
16
|
s.executables = ["gync"]
|
16
17
|
s.extra_rdoc_files = [
|
17
18
|
"LICENSE.txt",
|
18
|
-
"README.
|
19
|
+
"README.markdown"
|
19
20
|
]
|
20
21
|
s.files = [
|
21
22
|
".document",
|
22
23
|
".rspec",
|
24
|
+
".rvmrc",
|
23
25
|
"Gemfile",
|
24
26
|
"Gemfile.lock",
|
25
27
|
"LICENSE.txt",
|
26
|
-
"README.
|
28
|
+
"README.markdown",
|
27
29
|
"Rakefile",
|
28
30
|
"VERSION",
|
29
31
|
"bin/gync",
|
30
32
|
"gync.gemspec",
|
31
33
|
"lib/gync.rb",
|
34
|
+
"lib/gync/git.rb",
|
35
|
+
"spec/bin/gync_test_app",
|
32
36
|
"spec/gync_spec.rb",
|
33
37
|
"spec/spec_helper.rb"
|
34
38
|
]
|
35
|
-
s.homepage =
|
39
|
+
s.homepage = %q{http://github.com/greyblake/gync}
|
36
40
|
s.licenses = ["MIT"]
|
37
41
|
s.require_paths = ["lib"]
|
38
|
-
s.rubygems_version =
|
39
|
-
s.summary =
|
42
|
+
s.rubygems_version = %q{1.6.2}
|
43
|
+
s.summary = %q{Synchronizes data of desktop applications}
|
40
44
|
|
41
45
|
if s.respond_to? :specification_version then
|
42
46
|
s.specification_version = 3
|
@@ -46,17 +50,23 @@ Gem::Specification.new do |s|
|
|
46
50
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
47
51
|
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
48
52
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
53
|
+
s.add_development_dependency(%q<ruby-debug>, [">= 0"])
|
54
|
+
s.add_development_dependency(%q<ruby-debug19>, [">= 0"])
|
49
55
|
else
|
50
56
|
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
51
57
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
52
58
|
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
53
59
|
s.add_dependency(%q<rcov>, [">= 0"])
|
60
|
+
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
61
|
+
s.add_dependency(%q<ruby-debug19>, [">= 0"])
|
54
62
|
end
|
55
63
|
else
|
56
64
|
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
57
65
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
58
66
|
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
59
67
|
s.add_dependency(%q<rcov>, [">= 0"])
|
68
|
+
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
69
|
+
s.add_dependency(%q<ruby-debug19>, [">= 0"])
|
60
70
|
end
|
61
71
|
end
|
62
72
|
|
data/lib/gync.rb
CHANGED
@@ -1,23 +1,31 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
require 'ostruct'
|
3
|
+
require 'socket'
|
4
|
+
require 'shellwords'
|
3
5
|
require 'git'
|
6
|
+
require 'gync/git'
|
4
7
|
|
5
8
|
module Gync
|
6
9
|
extend self
|
7
|
-
class Error < Exception; end
|
8
|
-
|
9
10
|
def print_help
|
10
|
-
puts
|
11
|
+
puts <<-HELP
|
12
|
+
Synchronizes application data using git.
|
13
|
+
Usage:
|
14
|
+
gync COMMAND <command_options>
|
15
|
+
gync --help
|
16
|
+
|
17
|
+
For more help please visit https://github.com/greyblake/gync
|
18
|
+
HELP
|
11
19
|
end
|
12
20
|
|
13
|
-
def run(
|
14
|
-
@opts = opts_for
|
15
|
-
|
16
|
-
|
17
|
-
|
21
|
+
def run(args)
|
22
|
+
@opts = opts_for args.first
|
23
|
+
git = Gync::Git.new(@opts.local, @opts.remote)
|
24
|
+
git.pull
|
25
|
+
system Shellwords.shelljoin args
|
26
|
+
git.push
|
18
27
|
rescue Exception => err
|
19
28
|
STDERR.puts err
|
20
|
-
raise err
|
21
29
|
exit 1
|
22
30
|
end
|
23
31
|
|
@@ -26,29 +34,15 @@ module Gync
|
|
26
34
|
end
|
27
35
|
|
28
36
|
def config_file
|
29
|
-
File.join(home_dir, '.gync.yml')
|
30
|
-
end
|
31
|
-
|
32
|
-
def git_pull
|
33
|
-
git = Git.open(@opts.local)
|
34
|
-
git.fetch
|
35
|
-
git.merge 'origin/master'
|
36
|
-
end
|
37
|
-
|
38
|
-
def git_push
|
39
|
-
git = Git.open(@opts.local)
|
40
|
-
changed_files = git.status.changed.keys
|
41
|
-
git.add changed_files
|
42
|
-
git.commit "Gync commit"
|
43
|
-
git.push "origin", "master"
|
37
|
+
ENV['GYNC_CONFIG'] || File.join(home_dir, '.gync.yml')
|
44
38
|
end
|
45
39
|
|
46
40
|
def opts_for(command)
|
47
41
|
opts = YAML.load_file(config_file)
|
48
42
|
# validate
|
49
43
|
result = opts[command] || raise("There is no `#{command}` section #{config_file}")
|
50
|
-
result['local']
|
51
|
-
result['remote']
|
44
|
+
result['local'] || raise("There is no `#{command}.local` section #{config_file}")
|
45
|
+
result['remote'] || raise("There is no `#{command}.remote` section #{config_file}")
|
52
46
|
OpenStruct.new(result)
|
53
47
|
end
|
54
48
|
end
|
data/lib/gync/git.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
module Gync
|
2
|
+
class Git
|
3
|
+
def initialize(local_path, remote_path)
|
4
|
+
@local_path, @remote_path = local_path, remote_path
|
5
|
+
end
|
6
|
+
|
7
|
+
def pull
|
8
|
+
reopen_repo!
|
9
|
+
@git.fetch
|
10
|
+
@git.merge 'origin/master'
|
11
|
+
end
|
12
|
+
|
13
|
+
def push
|
14
|
+
reopen_repo!
|
15
|
+
if not changed_files.empty? or not new_files.empty? or not removed_files.empty?
|
16
|
+
@git.add changed_files unless changed_files.empty?
|
17
|
+
@git.add new_files unless new_files.empty?
|
18
|
+
@git.remove removed_files unless removed_files.empty?
|
19
|
+
@git.commit commit_msg
|
20
|
+
@git.push "origin", "master"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def reopen_repo!
|
28
|
+
@git = ::Git.open(@local_path)
|
29
|
+
rescue ArgumentError
|
30
|
+
@git = ::Git.init(@local_path)
|
31
|
+
@git.add_remote "origin", @remote_path
|
32
|
+
end
|
33
|
+
|
34
|
+
def changed_files
|
35
|
+
get_file_names @git.status.changed
|
36
|
+
end
|
37
|
+
|
38
|
+
def new_files
|
39
|
+
get_file_names @git.status.untracked
|
40
|
+
end
|
41
|
+
|
42
|
+
def removed_files
|
43
|
+
get_file_names @git.status.deleted
|
44
|
+
end
|
45
|
+
|
46
|
+
def commit_msg
|
47
|
+
host = Socket.gethostname
|
48
|
+
if host and not host.empty?
|
49
|
+
"Gync commit from #{host}"
|
50
|
+
else
|
51
|
+
"Gync commit"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def get_file_names(files)
|
56
|
+
if RUBY_VERSION =~ /^1.8/
|
57
|
+
files.map{|f| f.first}
|
58
|
+
else
|
59
|
+
files.keys
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
data/spec/gync_spec.rb
CHANGED
@@ -1,7 +1,129 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "Gync" do
|
4
|
-
|
5
|
-
|
4
|
+
def config_path ; "/tmp/test_gync_config.yml" ; end
|
5
|
+
def init_repo ; "/tmp/gync_test_init_repo" ; end
|
6
|
+
def local_repo ; "/tmp/gync_test_local_repo" ; end
|
7
|
+
def pseudo_remote_repo; "/tmp/gync_test_pseudo_remote_repo"; end
|
8
|
+
def remote_repo ; "/tmp/gync_test_remote_repo" ; end
|
9
|
+
|
10
|
+
def config_content
|
11
|
+
<<-CONFIG
|
12
|
+
gync_test_app:
|
13
|
+
local: "#{local_repo}"
|
14
|
+
remote: "#{remote_repo}"
|
15
|
+
CONFIG
|
16
|
+
end
|
17
|
+
|
18
|
+
def create_init_repo
|
19
|
+
FileUtils.mkdir_p init_repo
|
20
|
+
FileUtils.cd init_repo
|
21
|
+
FileUtils.touch "file_1"
|
22
|
+
FileUtils.touch "file_2"
|
23
|
+
git = Git.init
|
24
|
+
git.add ["file_1", "file_2"]
|
25
|
+
git.commit "initial commit"
|
26
|
+
end
|
27
|
+
|
28
|
+
def in_remote_repo
|
29
|
+
git = Git.open pseudo_remote_repo
|
30
|
+
git.fetch
|
31
|
+
git.merge 'origin/master'
|
32
|
+
FileUtils.cd pseudo_remote_repo
|
33
|
+
yield git
|
34
|
+
git.push "origin", "master"
|
35
|
+
end
|
36
|
+
|
37
|
+
def in_local_repo
|
38
|
+
FileUtils.cd local_repo
|
39
|
+
yield
|
40
|
+
end
|
41
|
+
|
42
|
+
def run_application!
|
43
|
+
system "gync gync_test_app"
|
44
|
+
end
|
45
|
+
|
46
|
+
before(:each) do
|
47
|
+
ENV['GYNC_CONFIG'] = config_path
|
48
|
+
File.open(config_path, 'w'){|f| f.puts config_content}
|
49
|
+
create_init_repo
|
50
|
+
Git.clone init_repo, remote_repo, :bare => true
|
51
|
+
Git.clone remote_repo, local_repo
|
52
|
+
Git.clone remote_repo, pseudo_remote_repo
|
53
|
+
end
|
54
|
+
|
55
|
+
after(:each) do
|
56
|
+
FileUtils.rm_rf remote_repo
|
57
|
+
FileUtils.rm_rf init_repo
|
58
|
+
FileUtils.rm_rf local_repo
|
59
|
+
FileUtils.rm_rf pseudo_remote_repo
|
60
|
+
FileUtils.rm_rf config_path
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "when application starts" do
|
64
|
+
it "pulls changes" do
|
65
|
+
in_remote_repo do |git|
|
66
|
+
FileUtils.touch "third_file"
|
67
|
+
git.add "third_file"
|
68
|
+
git.commit "second commit"
|
69
|
+
end
|
70
|
+
run_application!
|
71
|
+
in_local_repo do
|
72
|
+
File.exists?("./third_file").should == true
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe "when application is finished" do
|
78
|
+
it "pushed changed files" do
|
79
|
+
in_local_repo do
|
80
|
+
File.open('./file_1', 'a+') {|f| f.puts "New content"}
|
81
|
+
end
|
82
|
+
run_application!
|
83
|
+
in_remote_repo do |git|
|
84
|
+
File.read('./file_1').should =~ /New content/
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
it "pushes new files" do
|
89
|
+
in_local_repo do
|
90
|
+
File.open('./new_file', 'w') {|f| f.puts "New file content"}
|
91
|
+
end
|
92
|
+
run_application!
|
93
|
+
in_remote_repo do |git|
|
94
|
+
File.exists?('./new_file').should == true
|
95
|
+
File.read('./new_file').should =~ /New file content/
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
it "pushes removed files" do
|
100
|
+
in_local_repo{ FileUtils.rm "./file_1" }
|
101
|
+
run_application!
|
102
|
+
in_remote_repo do |git|
|
103
|
+
File.exists?('./file_1').should == false
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe "when there is no local repo yet" do
|
109
|
+
before :each do
|
110
|
+
FileUtils.rm_rf local_repo
|
111
|
+
FileUtils.mkdir_p local_repo
|
112
|
+
lambda{ Git.open local_repo}.should raise_error
|
113
|
+
end
|
114
|
+
|
115
|
+
it "inits repo" do
|
116
|
+
run_application!
|
117
|
+
lambda{ Git.open local_repo}.should_not raise_error
|
118
|
+
end
|
119
|
+
|
120
|
+
it "adds remote repo" do
|
121
|
+
run_application!
|
122
|
+
git = Git.open local_repo
|
123
|
+
remote = git.remotes.first
|
124
|
+
remote.should_not be_nil
|
125
|
+
remote.name.should == "origin"
|
126
|
+
remote.url.should == remote_repo
|
127
|
+
end
|
6
128
|
end
|
7
129
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
2
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
|
4
|
+
GYNC_ROOT = File.expand_path File.join(File.dirname(__FILE__), '..')
|
5
|
+
ENV['PATH'] = "#{GYNC_ROOT}/bin:" + ENV['PATH']
|
6
|
+
ENV['PATH'] = "#{GYNC_ROOT}/spec/bin:" + ENV['PATH']
|
7
|
+
|
3
8
|
require 'rspec'
|
4
9
|
require 'gync'
|
10
|
+
require 'ruby-debug'
|
11
|
+
require 'fileutils'
|
5
12
|
|
6
13
|
# Requires supporting files with custom matchers and macros, etc,
|
7
14
|
# in ./support/ and its subdirectories.
|
@@ -10,3 +17,4 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
|
10
17
|
RSpec.configure do |config|
|
11
18
|
|
12
19
|
end
|
20
|
+
|
metadata
CHANGED
@@ -1,140 +1,132 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: gync
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 2
|
10
|
-
version: 0.0.2
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Potapov Sergey
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-11-27 00:00:00.000000000 +02:00
|
13
|
+
default_executable: gync
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
21
16
|
name: rspec
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &17414380 !ruby/object:Gem::Requirement
|
24
18
|
none: false
|
25
|
-
requirements:
|
19
|
+
requirements:
|
26
20
|
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 3
|
29
|
-
segments:
|
30
|
-
- 2
|
31
|
-
- 3
|
32
|
-
- 0
|
21
|
+
- !ruby/object:Gem::Version
|
33
22
|
version: 2.3.0
|
34
23
|
type: :development
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: bundler
|
38
24
|
prerelease: false
|
39
|
-
|
25
|
+
version_requirements: *17414380
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: bundler
|
28
|
+
requirement: &17413900 !ruby/object:Gem::Requirement
|
40
29
|
none: false
|
41
|
-
requirements:
|
30
|
+
requirements:
|
42
31
|
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
hash: 23
|
45
|
-
segments:
|
46
|
-
- 1
|
47
|
-
- 0
|
48
|
-
- 0
|
32
|
+
- !ruby/object:Gem::Version
|
49
33
|
version: 1.0.0
|
50
34
|
type: :development
|
51
|
-
version_requirements: *id002
|
52
|
-
- !ruby/object:Gem::Dependency
|
53
|
-
name: jeweler
|
54
35
|
prerelease: false
|
55
|
-
|
36
|
+
version_requirements: *17413900
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: jeweler
|
39
|
+
requirement: &17413380 !ruby/object:Gem::Requirement
|
56
40
|
none: false
|
57
|
-
requirements:
|
41
|
+
requirements:
|
58
42
|
- - ~>
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
hash: 7
|
61
|
-
segments:
|
62
|
-
- 1
|
63
|
-
- 6
|
64
|
-
- 4
|
43
|
+
- !ruby/object:Gem::Version
|
65
44
|
version: 1.6.4
|
66
45
|
type: :development
|
67
|
-
|
68
|
-
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *17413380
|
48
|
+
- !ruby/object:Gem::Dependency
|
69
49
|
name: rcov
|
50
|
+
requirement: &17412860 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *17412860
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: ruby-debug
|
61
|
+
requirement: &17412340 !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
type: :development
|
70
68
|
prerelease: false
|
71
|
-
|
69
|
+
version_requirements: *17412340
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: ruby-debug19
|
72
|
+
requirement: &17411840 !ruby/object:Gem::Requirement
|
72
73
|
none: false
|
73
|
-
requirements:
|
74
|
-
- -
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
|
77
|
-
segments:
|
78
|
-
- 0
|
79
|
-
version: "0"
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
80
78
|
type: :development
|
81
|
-
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: *17411840
|
82
81
|
description: Synchronizes data of desktop applications using Git
|
83
82
|
email: blake131313@gmail.com
|
84
|
-
executables:
|
83
|
+
executables:
|
85
84
|
- gync
|
86
85
|
extensions: []
|
87
|
-
|
88
|
-
extra_rdoc_files:
|
86
|
+
extra_rdoc_files:
|
89
87
|
- LICENSE.txt
|
90
|
-
- README.
|
91
|
-
files:
|
88
|
+
- README.markdown
|
89
|
+
files:
|
92
90
|
- .document
|
93
91
|
- .rspec
|
92
|
+
- .rvmrc
|
94
93
|
- Gemfile
|
95
94
|
- Gemfile.lock
|
96
95
|
- LICENSE.txt
|
97
|
-
- README.
|
96
|
+
- README.markdown
|
98
97
|
- Rakefile
|
99
98
|
- VERSION
|
100
99
|
- bin/gync
|
101
100
|
- gync.gemspec
|
102
101
|
- lib/gync.rb
|
102
|
+
- lib/gync/git.rb
|
103
|
+
- spec/bin/gync_test_app
|
103
104
|
- spec/gync_spec.rb
|
104
105
|
- spec/spec_helper.rb
|
106
|
+
has_rdoc: true
|
105
107
|
homepage: http://github.com/greyblake/gync
|
106
|
-
licenses:
|
108
|
+
licenses:
|
107
109
|
- MIT
|
108
110
|
post_install_message:
|
109
111
|
rdoc_options: []
|
110
|
-
|
111
|
-
require_paths:
|
112
|
+
require_paths:
|
112
113
|
- lib
|
113
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
114
115
|
none: false
|
115
|
-
requirements:
|
116
|
-
- -
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
|
119
|
-
|
120
|
-
- 0
|
121
|
-
version: "0"
|
122
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ! '>='
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
121
|
none: false
|
124
|
-
requirements:
|
125
|
-
- -
|
126
|
-
- !ruby/object:Gem::Version
|
127
|
-
|
128
|
-
segments:
|
129
|
-
- 0
|
130
|
-
version: "0"
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
131
126
|
requirements: []
|
132
|
-
|
133
127
|
rubyforge_project:
|
134
|
-
rubygems_version: 1.
|
128
|
+
rubygems_version: 1.6.2
|
135
129
|
signing_key:
|
136
130
|
specification_version: 3
|
137
131
|
summary: Synchronizes data of desktop applications
|
138
132
|
test_files: []
|
139
|
-
|
140
|
-
has_rdoc:
|
data/README.rdoc
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
= gync
|
2
|
-
|
3
|
-
Description goes here.
|
4
|
-
|
5
|
-
== Contributing to gync
|
6
|
-
|
7
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
8
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
9
|
-
* Fork the project
|
10
|
-
* Start a feature/bugfix branch
|
11
|
-
* Commit and push until you are happy with your contribution
|
12
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
-
|
15
|
-
== Copyright
|
16
|
-
|
17
|
-
Copyright (c) 2011 Potapov Sergey. See LICENSE.txt for
|
18
|
-
further details.
|
19
|
-
|