Module: CommandLineFlunky

Defined in:
lib/coderunner/repository_manager.rb

Constant Summary collapse

STARTUP_MESSAGE =
"\n------CodeRunner Repository Manager------"
MANUAL_HEADER =
<<EOF

-------------CodeRunner Repository Manager Manual---------------

  Written by Edmund Highcock (2014)

NAME

  coderunnerrepo


SYNOPSIS

  coderunnerrepo <command> [arguments] [options]


DESCRIPTION

  Create and manipulate a coderunner repository: a collection of simulation
  folders and defaults files that a synchronised across systems using git. 

EXAMPLES

  $ coderunnerrepo init <name>

  $ coderunnerrepo clone <url>

  $ coderunnerrepo pull 

  $ coderunnerrepo pull -r <remote>

  $ coderunnerrepo push 

  $ coderunnerrepo add <folder>

  $ coderunnerrepo adrm <name> <url>


EOF
COMMANDS_WITH_HELP =
[
  ['add_remote', 'adrm', 2,  'Add a remote url to the repository. The url must end in \'.git\'', ['name', 'url'], [:Y]],
  ['add_folder', 'add', 1,  'Add the folder to the repository... this adds the directory tree and all coderunner data files to the repository, e.g. .code_runner_info.rb, script defaults, command histories etc. Note that this command must be issued in the root of the repository, or with the -Y flag giving the root of the repository.', ['folder'], [:Y]],
  ['bare_repo_command', 'brc', 1,  'Execute the given command within the twin bare repository', ['command'], [:Y]],
  ['clone_repo', 'clone', 2,  'Clone the given url to a working repo with the given name (NB creates both a bare and working repository). Give the url of the bare repository (with a name ending in .cr.git)', ['url', 'name'], []],
  ['init_repository', 'init', 1,  'Create a new repository with the given name. The name must not end in ".git". In fact, two repositories will be created, a working repo and a bare repo ending in cr.git. The bare repo is used to send and receive changes to remotes: the working repo should only push and pull to and from its twin bare repo.', ['name'], []],
  ['list_remotes', 'lsr', 0,  'List remotes in the bare repository (the working repository should only have one remote: origin.', [], [:Y]],
  ['pull_repository', 'pull', 0,  'Pull repository from all remotes, or from a comma-separated list of remotes given by the -r option.', [], [:r, :Y]],
  ['push_and_create_repository', 'pushcr', 0,  'Push to a comma-separated list of remotes given by the -r option; this command assumes that there is no repository on the remote and creates twin pair of a bare repo and a working checkout.', [], [:r, :Y]],
  ['push_repository', 'push', 0,  'Push repository to all remotes, or to a comma-separated list of remotes given by the -r option.', [], [:r, :Y]],
  ['remote_synchronize_down', 'rsyncd', 2,  'Bring the contents of the remote folder corresponding to the given folder (which must be a subfolder of a local coderunner repository) to the local system. The folder cannot be the top level of the repository. This command uses rsync to actually copy the files. The --delete option is not specified (i.e. files that do not exist on the remote will not be deleted).', ['remote', 'folder'], []],
  ['remote_synchronize_up', 'rsyncu', 2,  'Send the contents of the given folder (which must be a subfolder of a local coderunner repository) to the remote folder corresponding to it. The folder cannot be the top level of the repository. This command uses rsync to actually copy the files. The --delete option is not specified (i.e. files that do not exist in the folder).', ['remote', 'folder'], []],
  ['set_repo_metadata', 'mdata', 1,  "Give a hash of metadata to modify e.g., '{autocommit: false}. Things that can be modified are: autocommit: true/false, automatically commit repo changes made by CodeRunner, default true'.", ['hash'], [:Y]],

]
COMMAND_LINE_FLAGS_WITH_HELP =
[
#['--boolean', '-b', GetoptLong::NO_ARGUMENT, 'A boolean option'],
['--remotes', '-r', GetoptLong::REQUIRED_ARGUMENT, 'A comma separated list of remotes.'],
['--other-folder', '-Y', GetoptLong::REQUIRED_ARGUMENT, 'Specify the path of the folder where you want to run this command.'],

]
LONG_COMMAND_LINE_OPTIONS =
[
#["--no-short-form", "", GetoptLong::NO_ARGUMENT, %[This boolean option has no short form]],
]
CLF_BOOLS =

specifying flag sets a bool to be true

[]
CLF_INVERSE_BOOLS =

specifying flag sets a bool to be false

[]
PROJECT_NAME =
'coderunnerrepo'
SCRIPT_FILE =

end

__FILE__

Class Method Summary collapse

Class Method Details

.method_missing(method, *args) ⇒ Object



89
90
91
92
# File 'lib/coderunner/repository_manager.rb', line 89

def self.method_missing(method, *args)
#     p method, args
  CodeRunner::RepositoryManager.send(method, *args)
end