== Development Guide === Basic Development Set Up Helix Web Services runs on Unix-like machines only, typically Linux or OS X. If you want to use Windows, you will likely need to find an alternative for unicorn. Please understand that Windows is currently not tested or supported. Obtain a copy of the source code from the Perforce Workshop. You can preview the source at https://swarm.workshop.perforce.com/projects/perforce-software-helix-web-services. If you have an account, you can import the code from `//guest/perforce_software/helix-web-services/main/...` into your workspace. From there you will need: 1. A recent version of Ruby, Ruby 2.2+ from link:https://rvm.io/[RVM] is recommended. 2. link:http://bundler.io/[Bundler], typically installed via `gem install bundler`. First, you'll setup a p4d instance locally that's been seeded with some test data. ---- cd helix_web_services_client bundle install bundle exec p4util start bundle exec p4util init cd .. ---- (You can shut this server down with the command `bundle exec p4util kill` when you're done.) Next, you'll launch Helix Web Services running under Unicorn, via the Foreman command: ---- cd helix_web_services bundle install WORKSPACE_DIR=/tmp/clients bundle exec foreman start ---- In case you need methods that generate temporary client workspaces, you'll need the environment variable set. If you don't set it, it will likely go to a default directory you do not This should launch the application in the foreground. Use `CTRL+C` to kill it. This mechanism does not automatically reload all changes. Helix Web Services is a fairly simple Sinatra Rack application. It's entirely possible to launch it via a debugger under a different application server. This is typically done in IDEs such as RubyMine. Use the `config.ru` file in the `helix_web_services` directory and set the `WORKSPACE_DIR` environment variable. ==== Using the hws_console against a development mode server An `hws_console` application is available for local use, which can be useful for trying out a few commands. Launch it under bundler: ---- cd helix_web_services bundle exec ./bin/hws_console ---- This will create a basic PRY interactive console. To create a client instance, you will typically run: [source,ruby] ---- c = HelixWebServicesClient.new(url: 'http://localhost:9000', user: 'jdoe', password: 'johndoe1A!') ---- From there, `c` is a client instance, you can use to run commands. [source,ruby] ---- # Print the list of depot names as a string c.depots.map(&:name).join(", ") ----
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 15741 | ptomiak | Branch HWS for my use. | ||
//guest/perforce_software/helix-web-services/main/source/doc/09_development.asc | |||||
#1 | 15622 | tjuricek |
Move source code to 'source/' subdirectory of branch. build/ will remain where it is. |
||
//guest/perforce_software/helix-web-services/main/doc/09_development.asc | |||||
#1 | 15530 | tjuricek | Add basic development guide |