Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
khelll committed Sep 1, 2014
1 parent 9b4078e commit 3582d17
Showing 1 changed file with 54 additions and 25 deletions.
79 changes: 54 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,36 @@ It assumes that you have the destination repository initiated.

```ruby
require 'git_duplicator'
from = GitDuplicator::Repository
.new('source repo name', 'source repo url')
to = GitDuplicator::Repository
.new('destination repo name', 'destination repo url')

from = GitDuplicator::Repository.new('source repo name', 'source repo url')

to = GitDuplicator::Repository.new('mirrored repo name', 'mirrored repo url')

GitDuplicator.perform(from, to)


```
#### Advanced usage
- You can create the destination repository automatically. This needs you to provide the needed authentication credentials for the script.
- You can set the clone working path locally for the script to work. It's a temporary workplace that will get swiped after finishing.

```ruby
require 'git_duplicator'
from = GitDuplicator::Repository
.new('source repo name', 'source repo url')
to = GitDuplicator::Services::GithubRepository
.new('destination repo name', 'destination owner',
credentials: { auth2_token: 'some token' },
remote_options: { has_issues: false, has_wiki: false })
GitDuplicator.perform(from, to, force_create_destination: true, clone_path: 'path/to/clone/folder')

from = GitDuplicator::Repository.new('source repo name', 'source repo url')

to = GitDuplicator::Services::GithubRepository.new(
'mirrored repo name', 'mirrored owner',
credentials: { auth2_token: 'some token' },
remote_options: { has_issues: false, has_wiki: false }
)

GitDuplicator.perform(
from, to,
force_create_destination: true,
clone_path: 'path/to/clone/folder'
)

```
### Duplicate with future updates

Expand All @@ -66,15 +76,20 @@ It assumes that you have the destination repository initiated.

```ruby
require 'git_duplicator'
from = GitDuplicator::Repository
.new('source repo name', 'source repo url')
to = GitDuplicator::Repository
.new('destination repo name', 'destination repo url')

from = GitDuplicator::Repository.new('source repo name', 'source repo url')

to = GitDuplicator::Repository.new('mirrored repo name', 'mirrored repo url')

GitDuplicator.perform_for_update(from, to)

# Later on if you want to update the mirrored one
local_repo = GitDuplicator::Repository
.new('source repo name', 'source repo url', 'path/to/working/directory')
local_repo = GitDuplicator::Repository.new(
'source repo name',
'source repo url',
'path/to/working/directory'
)

local_repo.update_mirrored

```
Expand All @@ -84,17 +99,31 @@ local_repo.update_mirrored

```ruby
require 'git_duplicator'
from = GitDuplicator::Repository
.new('source repo name', 'source repo url')
to = GitDuplicator::Services::GithubRepository
.new('destination repo name', 'destination owner',
credentials: { auth2_token: 'some token' })
GitDuplicator.perform_for_update(from, to, force_create_destination: true, clone_path: 'path/to/clone/folder')

from = GitDuplicator::Repository.new('source repo name', 'source repo url')

to = GitDuplicator::Services::GithubRepository.new(
'mirrored repo name',
'mirrored owner',
credentials: { auth2_token: 'some token' },
remote_options: { has_issues: false, has_wiki: false }
)

GitDuplicator.perform_for_update(
from, to,
force_create_destination: true,
clone_path: 'path/to/clone/folder'
)

# Later on if you want to update the mirrored one
local_repo = GitDuplicator::Repository
.new('source repo name', 'source repo url', 'path/to/working/directory')
local_repo = GitDuplicator::Repository.new(
'source repo name',
'source repo url',
'path/to/working/directory'
)

local_repo.update_mirrored

```

### Available Services
Expand Down

0 comments on commit 3582d17

Please sign in to comment.