gd CLI
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
lib
test
.gitignore
Gemfile
README.rdoc
Rakefile
gd.gemspec
gd.rdoc

README.rdoc

gd

This is a small project that tries to enable some basic GD tasks to be accessible through CLI. It is still work in progress. If you got something interesting in mind let me know at svarovsky.tomas@gmail.com

Installation

git clone git://github.com/fluke777/gd.git
cd gd
rake gem
sudo gem install pkg/gd-0.0.1.gem

Usage

I tried to make this as easy to use as possible. You can get the list of commands by running

gd

You can see that at this moment you can do numerous things

clone_project        
create_project       
create_user          
delete_user          
help                 
list_domain_users    
list_roles           
list_users           
project_stash        
project_stash_add    
project_stash_default
project_stash_remove 
set_role             
user_stash           
user_stash_add       
user_stash_default   
user_stash_remove    
validate

If you want further information about the command use help

gd help command

This should provide brief but useful information about usage of the command.

I tried to automate some typical tasks and tried to make the tool behave so it could be used in the UNIX way. I assume that credentials are set in a way you can read below in following examples.

Finding some useful information about a user by an email address is a snap (which cannot be said about UI)

gd list_users | grep joe@example.com

You can easily find out how many people are there in the project

gd list_users | wc -l

How many people are there from the company by excluding gooddata users

gd list_users | grep -v gooddata.com

How many admins does the project sport?

gd list_users | cut -d, -f5 | grep adminRole | wc -l

Well this one may break if you got commas in names but yeah

Maybe you are interested in whether your project is valid

gd validate

Since it is following the principle “Keep quiet if everything is ok” you should find out that it worked by inspecting the exit code

echo $?

And some more .…

Credentials

At the moment there are 3 global parameters that you need to provide for most commands to work. That is gooddata login, password and project. This is great for scripts but awkward for interactive use. You can set the current project and user credentials in stash so you can work more interactively and with less typing. I am thinking about moving project id from the global parameters since it is not usually needed so this might change in future releases.

You can add your account

gd user_stash_add joe@example.com 1234

or just

gd user_stash_add

and it will ask you necessary questions. You can have more than one. In such case one is marked as default and that is the one that will be used. You can switch between those by using

gd user_stash_default

Similarly you can use

gd user_stash_remove

The same is possible with projects with commands

gd project_stash_add
gd project_stash_default
gd project_stash_remove

Check help for details. You can list the stored values by (the default value is marked by asterisk)

gd project_stash
gd user_stash

All this information is stored in ~/.gd and it is in plain JSON so you can edit it by hand if you please. Be aware that it is not encrypted in any way so if you are concerned about this stuff keep it in mind.

How you can help?

Let me know if something does not work is poorly documented or you like/dislike anything. You can reach me at svarovsky.tomas@gmail.com