File: git.coffee
Defined in: | lib/resin/vcs/git |
Method Summary
-
~
(String)
getGitDirectory(directory)
Private
Get git directory for a certain path
By git directory, we mean the hidden .git folder that every git repository have
result = getGitDirectory('/opt/projects/myapp') console.log(result)
-
~
(String)
getCurrentGitDirectory()
Private
Get current git directory
Get the path to the .git directory in the current directory
$ cd /Users/me/Projects/foobar && resin ...
-
~
(void)
isGitRepository(directory, callback)
Private
Check if a directory is a git repository
isGitRepository 'my/git/repo', (error, isGitRepository) -> throw error if error? if isGitRepository console.log('Yes, it\'s a git repo!') else console.log('I should use git here!')
-
~
(void)
getRepositoryInstance(directory, callback)
Private
Get repository instance
An instance of a gitCli repository, for internal usage.
-
~
(Boolean)
isValidGitApplication(application)
Private
Check if an application is a git app
resin.models.application.get 91, (error, application) -> throw error if error? result = isValidGitApplication(application) console.log(result)
-
~
(void)
hasRemote(repository, name, callback)
Private
Check if a repository has a certain remote
repository = getRepositoryInstance('my/git/repo') hasRemote repository, 'origin', (error, hasRemote) -> throw error if error? if hasRemote console.log('It has an origin remote!') else console.log('It doesn\'t has an origin remote!')
-
~
(void)
addRemote(repository, name, url, callback)
Private
Add a remote to a git repository
repository = getRepositoryInstance('my/git/repo') addRemote repository, 'resin', 'git@git.resin.io:johndoe/app.git', (error) -> throw error if error? $ cd my/git/repo && git remote -v resin git@git.resin.io:johndoe/app.git (fetch) resin git@git.resin.io:johndoe/app.git (push)
-
~
(void)
initProjectWithApplication(application, directory, callback)
Initialize an application project
- Add the corresponding git remote.
-
~
(void)
isResinProject(directory, callback)
Check if an application was already initialized
It checks if we have a resin remote added already.
Method Details
~
(String)
getGitDirectory(directory)
Private
Get git directory for a certain path
By git directory, we mean the hidden .git folder that every git repository have
result = getGitDirectory('/opt/projects/myapp')
console.log(result)
# /opt/projects/myapp/.git
~
(String)
getCurrentGitDirectory()
Private
Get current git directory
Get the path to the .git directory in the current directory
$ cd /Users/me/Projects/foobar && resin ...
result = getCurrentGitDirectory()
console.log(result)
# /Users/me/Projects/foobar/.git
~
(void)
isGitRepository(directory, callback)
Private
Check if a directory is a git repository
isGitRepository 'my/git/repo', (error, isGitRepository) -> throw error if error? if isGitRepository
console.log('Yes, it\'s a git repo!') else
console.log('I should use git here!')
~
(void)
getRepositoryInstance(directory, callback)
Private
Get repository instance
An instance of a gitCli repository, for internal usage.
getRepositoryInstance 'my/git/repo', (error, repository) -> throw error if error? # I can now use gitCli functions on `repository`
~
(Boolean)
isValidGitApplication(application)
Private
Check if an application is a git app
resin.models.application.get 91, (error, application) -> throw error if error? result = isValidGitApplication(application) console.log(result) # True
~
(void)
hasRemote(repository, name, callback)
Private
Check if a repository has a certain remote
repository = getRepositoryInstance('my/git/repo')
hasRemote repository, 'origin', (error, hasRemote) -> throw error if error? if hasRemote
console.log('It has an origin remote!') else
console.log('It doesn\'t has an origin remote!')
~
(void)
addRemote(repository, name, url, callback)
Private
Add a remote to a git repository
repository = getRepositoryInstance('my/git/repo')
addRemote repository, 'resin', 'git@git.resin.io:johndoe/app.git', (error) -> throw error if error?
$ cd my/git/repo && git remote -v
resin git@git.resin.io:johndoe/app.git (fetch)
resin git@git.resin.io:johndoe/app.git (push)
~
(void)
initProjectWithApplication(application, directory, callback)
Initialize an application project
- Add the corresponding git remote.
resin.models.application.get 91, (error, application) -> throw error if error?
initProjectWithApplication application, 'my/new/project', (error) ->
throw error if error?
~
(void)
isResinProject(directory, callback)
Check if an application was already initialized
It checks if we have a resin remote added already.
isResinProject 'my/resin/app', (error, initialized) -> if initialized
console.log('It\'s already a resin app!') else
console.log('It\'s just a boring project! It should be resinified!')