Giter Club home page Giter Club logo

cache-git-studio's Introduction

Git Plugin for Studio

InterSystems Caché Studio plugin to use Git.

Requirements

Installation

  • Clone repository or just download latest version into a local directory
git clone https://github.com/intersystems-ib/cache-git-studio.git
  • Open a Terminal session in Cache
  • Switch to a namespace where you want to use Git source control
zn "ENSEMBLE"
  • Load and compile the downloaded source code
set path="C:\Temp\cache-iat-pubsub\cache"
do $system.OBJ.ImportDir(path,"*.xml","ck",.error,1)

Setup

Configure cache-git-studio using ^GITConfig global.

Windows example

// path to git binaries
set ^GITConfig($username,"gitpath")="C:\Users\MyUser\AppData\Local\Programs\Git\bin\"	

// path to git work directory
set ^GITConfig($username,"workdir")="c:\sandbox\MyApp\"         	                         

// [optional] author name used in git commits
set ^GITConfig($username,"authorname")="John Doe"            	  	                         

// [optional] author email used in git commits
set ^GITConfig($username,"authoremail")="[email protected]"    	                       

// temp. file to store git output
set ^GITConfig($username,"output")="c:\git.output.txt"

// temp. file to store git errors
set ^GITConfig($username,"error")="c:\git.error.txt"

// [optional] use UDL format instead of XML (default)
set ^GITConfig($username,"udl")="1" 

// [optional] use xml as file extension always.
// when using UDL you may want to turn this off (0) so extensions will be like: cls, mac, etc.
set ^GITConfig($username,"xmlextension")="0"

// [optional] classmethod to call after reloading files
set ^GITConfig($username,"on.reloadfiles")=$lb("Studio.SourceControl.Sample.Callback", "Change")

// [optional] classmethod to call after a workdir load operation
set ^GITConfig($username,"on.workdirload")=$lb("Studio.SourceControl.Sample.Callback", "Change")

// [optional] classmethod to call after a pull operation
set ^GITConfig($username,"on.pull")=$lb("Studio.SourceControl.Sample.Callback", "Change")

Linux example

// path to git binaries
set ^GITConfig($username,"gitpath")="/usr/local/git/bin/"  	

// path to git work directory
set ^GITConfig($username,"workdir")="/workspace/myuser/myrepo/"

// path to home directory
set ^GITConfig($username,"homedir")="/home/ensemble"            	

// [optional] author name used in git commits
set ^GITConfig($username,"authorname")="John Doe"            	  	                         

// [optional] author email used in git commits
set ^GITConfig($username,"authoremail")="[email protected]"    	                       

// temp. file to store git output
set ^GITConfig($username,"output")="/tmp/output.txt"

// temp. file to store git errors
set ^GITConfig($username,"error")="/tmp/error.txt"

// [optional] use UDL format instead of XML (default)
set ^GITConfig($username,"udl")="1" 

// [optional] use xml as file extension always. 
// when using UDL you may want to turn this off (0) so extensions will be like: cls, mac, etc.
set ^GITConfig($username,"xmlextension")="0"

// [optional] classmethod to call after reloading files
set ^GITConfig($username,"on.reloadfiles")=$lb("Studio.SourceControl.Sample.Callback", "Change")

// [optional] classmethod to call after a workdir load operation
set ^GITConfig($username,"on.workdirload")=$lb("Studio.SourceControl.Sample.Callback", "Change")

// [optional] classmethod to call after a pull operation
set ^GITConfig($username,"on.pull")=$lb("Studio.SourceControl.Sample.Callback", "Change")

Configure your namespace to use Studio.SourceControl.GIT as the source control class:

  • Management Portal > System Administration > Additional Settings > Source Control.
  • Select your namespace.
  • Select Studio.SourceControl.GIT as the source control class.

Credentials management

  • cache-git-studio does not prompt for passwords in Caché Studio.
  • cache-git-studio does not provide any specific credentials management features.
  • If you need to perform password protected operations, it is needed that you configure your local installation to avoid git to prompt for any password.
  • You must protect the files where your passwords are stored (file permissions).

Windows

You can use the _netrc file of the effective O.S. user that run Caché processes to store your credentials. Example: C:\Users\user1\_netrc

machine git.company.com
login user1 
password mypassword

Linux

You can use git-credential-store.

git config credential.helper 'store --file=~/.git-credentials'

Shared environment

Git is used generally in a non-shared environment, every developer has its own work environment.

However, in some cases you could need to use cache-git-studio in a shared environment (same instance, same namespace, different Caché developers).

In shared environments, a simple approach is:

  • Use different Caché users for each developer.

  • Use the same working directory for each developer, so source code will be exported/imported from the same shared location:

set ^GITConfig($username, "workdir")="/workspace/myproject/"
  • Use different output and error temporary files for each developer:
set ^GITConfig($username,"output")="/tmp/git.output.jdoe"
set ^GITConfig($username,"output")="/tmp/git.error.jdoe"
  • Use a common git user for all developers: All git actions will be performed using the same git user but commits will have different authors.

  • Configure commit author for each developer:

^GITConfig($username,"authoremail")="[email protected]"
^GITConfig($username,"authorname")="jdoe"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.