Rakefile #15

  • //
  • guest/
  • doug_scheirer/
  • helix-web-services/
  • main/
  • source/
  • Rakefile
  • View
  • Commits
  • Open Download .zip Download (12 KB)
require 'rake/clean'
require 'rake/packagetask'
require 'bundler'

# We setup our configuration to create a fake "installation" to this directory.
# In cases you run everything locally, it dumps data, pid, and log files under
# here.
#
# See tasks like basic:start or cloud:start for real usage.
INSTALL_DIR = '/tmp/hws'
CLEAN.include(INSTALL_DIR)

task :set_writable do
  Dir.glob('**/Gemfile.lock').each do |f|
    File.chmod(0644, f)
  end
end

Rake::PackageTask.new('helix-web-services', :noversion) do |package|
  package.need_tar = true

  package.package_files.include('data/certs/*')
  package.package_files.include('contrib/**/*')
  package.package_files.include('doc/**/*')
  package.package_files.include('git_fusion_strings/**/*')
  package.package_files.include('helix_web_services/**/*')
  package.package_files.include('helix_web_services_client/**/*')
  package.package_files.include('packaging/**/*')
  package.package_files.include('Gemfile')
  package.package_files.include('Gemfile.lock')
  package.package_files.include('Rakefile')
  package.package_files.include('LICENSE')
  package.package_files.include('helix-web-services-notes.txt')
end
CLEAN.include('pkg')

task :package => [:set_writable]

desc 'Create primary source deliverables'
task :build => [:package]

desc 'Rebuild the main ASCIIDoc documentation'
task :asciidoc do
  system('bundle exec asciidoctor -o doc-output/p4ws.html doc/p4ws.asc') ||
      fail('asciidoctor failed')
end
CLEAN.include('**/doc-output')

namespace :all do
  desc 'Rebuild documentation across system'
  task :doc => [:asciidoc] do
    system('cd helix_web_services_client && bundle exec rake yard') ||
        fail('rake yard failed for helix_web_services_client')
    system('cd helix_web_services && bundle exec rake yard') ||
        fail('rake yard failed for helix_web_services')
  end
end

# "Raymond" is an internal server API used in Helix Cloud, that Helix Web
# Services integration uses for Helix Sync methods. This mock instance lets
# us run tests in our "cloud" configuration setup.
namespace :mock_raymond do
  desc 'start mock cloud server'
  task :start do
    start_mock_raymond
  end

  desc 'kill mock cloud server'
  task :stop do
    stop_mock_raymond
  end
end

namespace :p4d do
  namespace :basic do
    desc 'init p4d in basic mode'
    task :start do
      initialize_p4d('data/p4init')
    end

  end

  namespace :cloud do
    desc 'init p4d in cloud mode'
    task :start do
      initialize_p4d('data/cloudinit')
    end
  end

  desc 'halt running p4d'
  task :stop do
    stop_p4d
  end
end


# The 'basic' configuration does not include Helix Cloud or Git Fusion
#
# Note: Git Fusion only runs on Linux, so that's left out of the dev environment
# for now, until I decide to switch my dev environment to run on Linux. :)
namespace :basic do
  desc 'Start nginx, p4d, unicorn with basic configuration'
  task :start do |t|
    err = initialize_tmp_install
    err ||= initialize_p4d('data/p4init')
    err ||= hws_launch_tmp_install('start')

    fail('start failed') if err
  end

  desc 'Run helix_web_services and helix_web_services_client specs against the local basic config'
  task :spec do
    err = run_hws_server_tests(spec_output: 'basic_helix_web_services_specs.html')
    err ||= run_hws_client_specs(spec_output: 'basic_helix_web_services_client_specs.html',
                                 p4port: 'localhost:1666')

    fail('spec failed') if err
  end

  desc 'Stop and clean up the basic configuration'
  task :stop do
    err ||= hws_launch_tmp_install('stop')
    err ||= stop_p4d

    fail('stop failed') if err
  end
end

namespace :cloud do
  desc 'Start mock_raymond, nginx, unicorn, and p4d for Helix Cloud mock testing'
  task :start => 'mock_raymond:start' do
    err = initialize_tmp_install
    err ||= initialize_p4d('data/cloudinit')
    err ||= hws_launch_tmp_install('start',
                                   cloud_settings: 'helix_web_services/config/hws_cloud_settings.conf.example')
  end

  desc 'Run helix_web_services_client specs against the local basic config'
  task :spec do
    err = run_hws_server_tests(cloud_settings: 'helix_web_services/config/hws_cloud_settings.conf.example',
                               spec_output: 'cloud_helix_web_services_specs.html')
    err ||= run_hws_client_specs(spec_output: 'cloud_helix_web_services_client_specs.html',
                                 p4port: 'localhost:1666',
                                 cloud_test: true)

    fail('spec failed') if err
  end

  desc 'Shut down Helix Cloud setup'
  task :stop => 'mock_raymond:stop' do
    err ||= hws_launch_tmp_install('stop')
    err ||= stop_p4d

    fail('stop failed') if err
  end
end

namespace :remote do
  desc 'Exec specs against a remote HWS instance'
  task :spec, [:hws_url, :p4port] do |t, args|
    hws_url = args[:host]
    p4port = args[:p4port]

    err = run_hws_client_specs(spec_output: "remote_#{host}_helix_web_services_client_specs.html",
                               p4port: p4port,
                               hws_url: hws_url)

    fail('spec failed') if err
  end
end

#=============================================================================
# Helper Methods
#=============================================================================

# Execute helix_web_services_client specs, with different configurations:
#
# - cloud_test: if true, we assume the mock_raymond server is running
#
# - spec_output: specify different names for different configurations, output
#                will go under ./spec-output
#
# - p4port: Some tests require seeding test data directly, indicate the
#           p4d port, defaults to 'localhost:1666'
#
# - hws_url: The base URL to the HWS server, defaults "https://localhost:9000/"
def run_hws_client_specs(cloud_test: false,
                         spec_output: 'helix_web_services_client_specs.html',
                         p4port: 'localhost:1666',
                         hws_url: 'https://localhost:9000/')

  output_file = File.absolute_path("../spec-output/#{spec_output}", __FILE__)

  ok = system('cd helix_web_services_client && ' +
                  "CLOUD_TEST=#{cloud_test.to_s} " +
                  "SPEC_OUT=#{output_file} " +
                  "P4PORT=#{p4port} " +
                  "HWS_URL=#{hws_url} " +
                  'bundle exec rake spec')

  return true unless ok
end

# Execute helix_web_services specs, with different configurations.
#
# Note: This typically does *not* require unicorn and nginx to run, just p4d.
# It is a different configuration that *can* be easier for debugging purposes.
#
# - cloud_settings: Path to the cloud settings file if you want to validate
#                   Helix Cloud logic
#
# - spec_output: Test result output file name.
def run_hws_server_tests(cloud_settings: '', spec_output: '')

  output_file = File.absolute_path("../spec-output/#{spec_output}", __FILE__)

  settings_file = File.absolute_path("../#{cloud_settings}", __FILE__) if !cloud_settings.empty?

  ok = system('cd helix_web_services && ' +
                  "CLOUD_SETTINGS=#{settings_file} " +
                  "SPEC_OUT=#{output_file} " +
                  'bundle exec rake spec')

  return true unless ok
end


# Create the temporary install configuration file that points to files in
# a temporary directory, /tmp/hws.
#
# It is very annoying in development if this becomes a long-winded path.
def initialize_tmp_install
  unless Dir.exist?(INSTALL_DIR)
    FileUtils.mkdir_p(INSTALL_DIR)
  end
  unless Dir.exist?(data_dir)
    FileUtils.mkdir_p(data_dir)
  end
  unless Dir.exist?(log_dir)
    FileUtils.mkdir_p(log_dir)
  end
  unless Dir.exist?(run_dir)
    FileUtils.mkdir_p(run_dir)
  end
  create_dev_config_file
end

# Runs hws_launch in temp install directory.
def hws_launch_tmp_install(cmd, cloud_settings: nil)
  puts "hws_launch #{cmd}"

  if cloud_settings.nil?
    cloud_settings = ''
  else
    cloud_settings = "CLOUD_SETTINGS=#{File.absolute_path("../#{cloud_settings}", __FILE__)} "
  end

  launch_ok = system('cd helix_web_services && ' +
                         "HWS_CONFIG=#{hws_config_path} " +
                         cloud_settings +
                         "bundle exec #{hws_launch_path} #{cmd}")
  !launch_ok
end

# This generates /tmp/helix-web-services.conf that points to locations in the
# local directory... as appropriate.
def create_dev_config_file(enable_https: false)
  IO.write(hws_config_path, <<-END.gsub(/^[ ]{4}/, '')
    DATA_DIR: '#{data_dir}'
    ENABLE_HTTPS: #{enable_https}
    LOG_DIR: '#{log_dir}'
    NGINX_COMMAND: '#{nginx_command}'
    NGINX_CONFIG_PATH: '#{nginx_config_path}'
    NGINX_PORT: 9000
    P4TRUST: '#{p4trust_path}'
    RACKUP_CONFIG: '#{rackup_config_path}'
    RUN_DIR: '#{run_dir}'
    SSL_CERTIFICATE_PATH: '#{ssl_certificate_path}'
    SSL_CERTIFICATE_KEY_PATH: '#{ssl_certificate_key_path}'
    SYSTEM_GROUP: null
    SYSTEM_USER: '#{ENV['USER']}'
    WORKSPACE_DIR: '#{workspace_dir}'
    UNICORN_COMMAND: '#{unicorn_command}'
    UNICORN_CONFIG_PATH: '#{unicorn_config_path}'
    UNICORN_CONNECTION: '#{unicorn_socket_path}'
  END
  )
  nil
end

def initialize_p4d(data_dir)
  puts 'starting p4d from ' + data_dir

  ok = system('p4util kill')
  return true unless ok

  if Dir.exist?('/tmp/p4util/p4droot')
    require 'fileutils'
    FileUtils.rmtree('/tmp/p4util/p4droot')
  end

  ok = system('p4util start')
  return true unless ok

  ok = system("p4util init #{data_dir}")
  return true unless ok
end

def stop_p4d
  ok = system('p4util kill')
  return true unless ok

  if Dir.exist?('/tmp/p4util/p4droot')
    require 'fileutils'
    FileUtils.rmtree('/tmp/p4util/p4droot')
  end

  nil
end

def initialize_remote_p4d(host, data_dir)
  ok = system("p4util init -p #{host}:1666 -a #{data_dir}")
  return true unless ok
end

def start_mock_raymond(cloud_settings: '')
  # return
  puts 'starting mock_raymond'
  begin
    Bundler.with_clean_env do
      ok = system(
          'cd helix_web_services/mock_raymond && ' +
              'UNICORN_PID=/tmp/mock_raymond_unicorn.pid ' +
              'RAILS_ENV=test ' +
              'MOCKRAYMOND_STDOUT_PATH=/tmp/mock_raymond_unicorn.out ' +
              'MOCKRAYMOND_STDERR_PATH=/tmp/mock_raymond_unicorn.err ' +
              'P4PORT=localhost:1666 ' +
              'P4CHARSET=utf8 ' +
              'bundle exec unicorn -c config/unicorn.rb -D'
      )
      return true unless ok

      while connect_to_server(3000) == false
        sleep(0.1)
      end
    end

    return false
  rescue Exception => e
    puts "Error: #{e.message}"
    return true
  end
end

def stop_mock_raymond
  if File.exist?('/tmp/mock_raymond_unicorn.pid')
    rails_pid = IO.read('/tmp/mock_raymond_unicorn.pid').to_i
    puts "killing pid: #{rails_pid}"
    Process.kill('TERM', rails_pid)
    File.unlink('/tmp/mock_raymond_unicorn.pid')
  end
end

def hws_config_path
  "#{INSTALL_DIR}/helix-web-services.conf"
end

# In development mode, we use the rackup configuration directly in the tree
def rackup_config_path
  File.absolute_path('../helix_web_services/config.ru', __FILE__)
end

# Note: if you're not running within bundler, or RVM with fancy bundler
# shell integration, this is possibly going to fail
def hws_launch_path
  File.absolute_path('../helix_web_services/bin/hws_launch', __FILE__)
end

# In general, unicorn should be installed already, and in most dev environments
# is in the path via RVM.
def unicorn_command
  unicorn_path = `which unicorn`.strip
  fail 'unicorn not found' if unicorn_path.empty?
  unicorn_path
end

def nginx_command
  nginx_path = `which nginx`.strip
  fail 'nginx not found' if nginx_path.empty?
  nginx_path
end

def nginx_config_path
  "#{INSTALL_DIR}/nginx.conf"
end

def unicorn_config_path
  "#{INSTALL_DIR}/unicorn.conf"
end

def data_dir
  "#{INSTALL_DIR}/data"
end

def log_dir
  "#{INSTALL_DIR}/logs"
end

def run_dir
  "#{INSTALL_DIR}/run"
end

def unicorn_socket_path
  "unix:#{run_dir}/unicorn.sock"
end

def workspace_dir
  "#{data_dir}/workspaces"
end

def ssl_certificate_path
  File.absolute_path('../data/certs/nginx.crt', __FILE__)
end

def ssl_certificate_key_path
  File.absolute_path('../data/certs/nginx.key', __FILE__)
end

def p4trust_path
  "#{INSTALL_DIR}/p4trust"
end

def connect_to_server(port)
  require 'socket'
  begin
    s = TCPSocket.new 'localhost', port
    s.close
    return true
  rescue Exception => e
    return false
  end
end
# Change User Description Committed
#15 16318 Doug Scheirer merge from main
#14 16289 Doug Scheirer merge from main
#13 16275 Doug Scheirer Merge from main
#12 16148 Doug Scheirer Merge from main
#11 16047 Doug Scheirer Update the other config setting for cloud
#10 16041 Doug Scheirer Make CI use a conf file that exists for cloud testing
#9 16040 Doug Scheirer I think the pending tests is at a minimum for cloud enabled, so readyto integrate up?
#8 16026 Doug Scheirer Marked last few cloud tests pending, enabled test:cloud by default
#7 16025 Doug Scheirer require bundler?
#6 16024 Doug Scheirer Some cloud spec forking, got the mock_raymond to spin up in cloud testing, split normal vs cloud spec output
#5 16014 Doug Scheirer Merge down from main
#4 15845 Doug Scheirer Integ from main
#3 15726 Doug Scheirer merge from main
#2 15715 Doug Scheirer merge changes from main
#1 15688 Doug Scheirer Populate -o //guest/perforce_software/helix-web-services/...
//guest/doug_scheirer/helix-web-services/....
//guest/perforce_software/helix-web-services/main/source/Rakefile
#2 15634 tjuricek Add rules for setting up and running Centos 6.

There's a strange problem coming back around with package tests again, not everything's 100%
#1 15622 tjuricek Move source code to 'source/' subdirectory of branch.

build/ will remain where it is.
//guest/perforce_software/helix-web-services/main/Rakefile
#61 15619 tjuricek Remove all doc-output and spec-output dirs on clean task
#60 15618 tjuricek By default, writing spec results to spec-output, docs to doc-output.

The archiving in a 'build' branch will be handled by the CD pipeline.
#59 15617 tjuricek Add P4PORT variable to 'remotetest' task, add 'debug' option to client.
#58 15614 tjuricek Add 'remotetest' task to run the client API remotely (after seeding p4d)
#57 15591 tjuricek Do not rebuild documentation automatically (yet).
#56 15588 tjuricek Write test output to build directory and correct reference to 'all:doc' task
#55 15587 tjuricek Add 'rake test' top level command to handle executing tests against the local source tree.

This may be embellished with some additional configuration to, say, run tests against a remote server.
#54 15513 tjuricek Add a product ID header for debugging purposes.

This will generally display INVALID unless the version file has been created during the build.
#53 15240 tjuricek Set api level via request path on all Helix Versioning Engine methods.

This will allow migration of applications to different P4D versions. Our internal methods (like project API) should attempt to handle backward compatibility similarly.

P4WEBAPI-118
#52 15090 tjuricek Update _proposed_ API for project services.

This is *very likely* to change, and will not be implemented until reviewed.
#51 15038 tjuricek Document 'login' auth method and client programming overview.
#50 15032 tjuricek Starting config and doc revisions.
System is now broken while revisions underway.

Configuration of the p4d connection is now done via a single HWSSettings middleware object injected into the Rack env.

The HWSP4Cleanup middleware now cleans up any p4 injected into the Rack env.

The Auth::App class now mostly just contains one method to generate a p4 ticket. /auth/v1/login.

Added yard documentation for the main project.

Yard docs have been reconfigured to dump into build/ directories. This should probably be done with each release. Hm...

The top level rake file contains a task, 'all:doc', to update our documentation. This should probably be run for each checkin. Hm...

Specs are now using Rack::Test on top of a 'live' p4d. I'd suggest you still use the p4util mechanism, which now dumps to a /tmp folder, so we can safely add P4IGNORE rules back into your local .p4config file.

Old 'perforce' application now called 'helix_versioning_engine'.

Removing cache data. Helix Sync may be slow. It may also get axed. We'll see.
#49 14891 tjuricek Add packaging directory to source tarball.
#48 14192 tjuricek Starting work on running tests via the command line again.

The current system seems to run into problems with local .p4config settings. I'm investigating workarounds. We may need to move "working folders" into a location outside of this tree by default.
#47 14054 tjuricek Allowing the Qt client to select 'all' vs 'my' projects.


Right now, it should default to using "my" projects as a rule.
#46 13974 tjuricek Moving 'ui/static' to 'helix_web_components' project, and altering some notes.

Also, removed obsolete top-level Rake tasks.

The "Helix Web Components" project will likely get moved elsewhere in the future.
#45 13960 tjuricek Setup a development config for nginx

/hws points to the new monolithic helix_web_serivces instance
/ points to a static directory

This static directory may end up getting moved around into other projects, I'm not sure where that location should be.
#44 13759 tjuricek Fix the 'source' declaration that broke the installer build process.

The 'perforce.rb' file.
#43 13707 tjuricek Infrastructure for including a "project management" React application.

This attempts to create a fairly simple installer that creates a 'static' folder based on ui/static that gets hosted by the nginx front end. Right now, it's the only app, so the default page is this application. It was called "pws2" during a prototyping phase.

Another prototype, "pws" and the related "project" module, is removed since that was a Sinatra-based approach that will be much more difficult to integrate into anything else.

I'm running into a couple of issues with notifications setup, it's still not 100%, so I'm disabling this for now from the default 'god' configuration. (The service isn't 100% functional yet, anyway.)
#42 13551 tjuricek Don't use a temp 'dist' folder and include the file extensions in the package manifests.
#41 13545 tjuricek Allow the environment to set the changelist, which is generally true in CI systems.
#40 13544 tjuricek Revise package and gem versioning.

Packages will use [gem]-[changelist] as their versions. Gems will use a standard Ruby MAJOR.MINOR.REVISION format.

P4WEBAPI-64
#39 13531 tjuricek Remove commented out rake tasks that have been superceded by Salt.
#38 13530 tjuricek Add p4_phoenix_services package and Salt configuration for deployment.

This uncovered a couple of issues from the C++ API during it's conversion to C++03.

So, in a nutshell, most operations, except for notifications, appear to be working (well, using Vagrant machines).
#37 13527 tjuricek Added a basic p4-project-services .deb package

There is some kind of configuration issue with the production config that causes tests to fail. The service is running, however, so this is likely related to having a few things not managed via salt.
#36 13520 tjuricek Created a 'cluster' build procedure that creates an installer on build, and executes the install on a test instance.

The main change is to package all gem dependencies via 'vendor/cache' (using the 'bundle package' command).

Right now, there appears to be an issue with test data initialization, which may need a revised approach.
#35 13519 tjuricek Added a 'buildmaster' environment.

The 'buildmaster' sets up Ruby locally for doing some work via Rake.

Additional steps are now being figured out in the README.md, which may end up being a bash script that executes on the master.
#34 13513 tjuricek Update several files that were missing from the last commit regarding a basic 'test' environment
#33 13504 tjuricek The 'build-ubuntu12' seems to generate the appropriate debian packages for the distribution.

I had permissions issues (probably related to shared folder usage) with the dpkg tools. So I've removed them. If we happen to need them, we'll have to figure out a build process.

This environment probably shouldn't be used to test the packages, since omnibus likes to dirty everything up, leave files in the /opt/perforce directory owned by vagrant, etc.
#32 13500 tjuricek Reorganizing Vagrant definitions.

Each platform should allow developers to launch environments for development, builds, or 'production', so the entire CD process can be evaluated by anyone wiht access to the source tree.

This may eventually bring up a transient vSphere machine up and down, which may be necessary for sandboxing Omnibus related builds.
#31 13489 tjuricek Add zookeeper service to cluster for development evaluation.

It's a little unclear exactly what values need to be distributed via zk, since a lot of the configuration may end up being handled via ports. I wanted to at least provide a way to evaluate this.

P4WEBAPI-60
#30 13488 tjuricek Added hsm:startworld and hsm:stopworld tasks to do global starts and stops.

This is not without apparent issues. It appears bundler or ruby is pausing before the nginx launch task happens. I'm not sure if there's some kind of resource issue first.

P4WEBAPI-49
#29 13485 tjuricek Wrapping issues with setting up :test namespace and ignoring for now.
#28 13484 tjuricek Adding back the :build task as :publish, ignoring gems for the moment.

gems may eventually be archived again, but right now that's not needed for basic integration.
#27 13481 tjuricek Tests for the p4 web api and p4 project services now pass against a development setup both in and out of the docker cluster.

Note that configuration *has not* been finalized, so conventions to dealing with development vs production need to be organized a bit.
#26 13480 tjuricek Creating several Rake tasks for our "hsm" configuration that are based on a Ruby API config file.

The config file points to machines and services in the system which then takes care of setting up the docker-machine environment and docker-compose configuration.
#25 13477 tjuricek More docker-compose configuration for projects in research for HSM.

Added a geminabox host for the cluster, which allows for quick rebuilds. Each cluster will cache the gems it needs, and publish as well. We may want to put the overwrite commands for all publish steps by default.

Note: referencing "external links" can only be done 'at runtime', so "bundle install" really needs to be run in the context of 'docker-compose up' not 'docker-compose build'. This was edited in all configured libraries so far.

Finally, added the p4_project_services projects to configuration, which is running under it's own puma instance.

The postgres instance is a little tricky to figure out the exact workflow. Right now I'm using the host rake db:migrate task and calling createdb manually, since we need to pass the password along.
#24 13474 tjuricek Corrected regressions that broke the API and Project services specs.
#23 13473 tjuricek Change the name of our ':pg' rake tasks to just ':db' for some consistency.

Fixed a few initial schemas to normalize on using integers for primary keys. I may need to come up with some constraints for project IDs, we'll see.
#22 13472 tjuricek Implementation of the phoenix services side of notification handling.

This is just implementation and work-in-progress.

Phoenix projects will now have paths cached in the phoenix services process, which we'll use to "guess" what file changes affect which Phoenix project. We basically see a changed path, then see that it might be relevant to one of the Phoenix project stream views, and then issue a "p4 changes -m1 //stream..." to see what the last change number is. If the change number goes up, we trigger an update.

Note that how this all gets configured is with an account from notification services to phoenix services, which ideally is some kind of system account that sees all relevant files. Otherwise, you'll likely get changes filtered by protections, and thus, updates may not get sent out.
#21 13470 tjuricek Phoenix notification services, client API, including new phoenix_updater

This is an interim commit containing a first pass implementation of the phoenix_updater. Notably missing parts:

- The Qt API doesn't yet actually interact with the phoenix_updater
- The phoenix_services web service doesn't filter out notifications

I *may* end up creating another web application *just* to filter out notifications, since this may end up taking up a lot of background workers.
#20 13469 tjuricek Initial implementation of change-commit notification services.

Set up a new database just for storing webhook configuration for the notification services.

It uses the stable version of Resque, which needs to be evaluated in more detail. This should be easier for an admin to monitor than something like Sidekiq, but performance evaluation needs to happen before production release.

No automated tests yet, that will rely upon a Phoenix notification mechanism existing first.
#19 13468 tjuricek Set up resque worker that will trigger web hooks in the background.
#18 13467 tjuricek Add a basic notification_services endpoint that can setup a trigger entry and accept basic POST requests.
#17 13463 tjuricek Replace crappy indexing mechanism with Postgres queries.
#16 13462 tjuricek Created a preliminary caching schema and basic database models for the p4 project services.

This may break some tests momentarily until I implement caching.
#15 13458 tjuricek Revising P4 Web API docbook documentation to become the Perforce Web Services guide.

Right now this is just focused on the Qt SDK. The remaining protocol documentation, etc, will happen eventually.
#14 13443 tjuricek Reorganized the Qt libraries into a separate part of the tree, to make it easier for CMake configuration.

Added 'qt_build' and 'qt_test' tasks to at least execute tests and fail the build if they don't pass.

Started the implementation of the project library interaction.
Change: 1018651

Date: 3/4/15 11:43 AM

Client: tjuricek_dhcp-141-n100_5959

User: tjuricek

Status: pending

Type: public

Description:
Reorganized the Qt libraries into a separate part of the tree, to make it easier for CMake configuration.

Added 'qt_build' and 'qt_test' tasks to at least execute tests and fail the build if they don't pass.

Started the implementation of the project library interaction.


JobStatus:

Jobs:


Files:
//web-services/p4ws-main/Rakefile
//web-services/p4ws-main/p4_phoenix_services/clients/qt/p4_phoenix_services_client/CMakeLists.txt
//web-services/p4ws-main/p4_phoenix_services/clients/qt/p4_phoenix_services_client/PhoenixIntegrationTests.cpp
//web-services/p4ws-main/p4_phoenix_services/clients/qt/p4_phoenix_services_client/README
//web-services/p4ws-main/p4_phoenix_services/clients/qt/p4_phoenix_services_client/phoenix.h
//web-services/p4ws-main/p4_phoenix_services/clients/qt/p4_phoenix_services_client/phoenix/PhoenixProject.cpp
//web-services/p4ws-main/p4_phoenix_services/clients/qt/p4_phoenix_services_client/phoenix/PhoenixProject.h
//web-services/p4ws-main/p4_phoenix_services/clients/qt/p4_phoenix_services_client/phoenix/PhoenixServicesClient.cpp
//web-services/p4ws-main/p4_phoenix_services/clients/qt/p4_phoenix_services_client/phoenix/PhoenixServicesClient.h
//web-services/p4ws-main/p4_phoenix_services/clients/qt/p4_phoenix_services_client/phoenix/RequestError.cpp
//web-services/p4ws-main/p4_phoenix_services/clients/qt/p4_phoenix_services_client/phoenix/RequestError.h
//web-services/p4ws-main/p4_phoenix_services/clients/qt/p4_phoenix_services_client/phoenix/Session.cpp
//web-services/p4ws-main/p4_phoenix_services/clients/qt/p4_phoenix_services_client/phoenix/Session.h
//web-services/p4ws-main/p4_phoenix_services/clients/qt/p4_phoenix_services_client/test/PhoenixServicesClientTests.cpp
//web-services/p4ws-main/p4_phoenix_services/clients/qt/p4_phoenix_services_client/test/PhoenixServicesClientTests.h
//web-services/p4ws-main/p4_phoenix_services/clients/qt/p4_phoenix_services_client/test/SessionTests.cpp
//web-services/p4ws-main/p4_phoenix_services/clients/qt/p4_phoenix_services_client/test/SessionTests.h
//web-services/p4ws-main/p4_project_services/clients/qt/p4_project_services_client/CMakeLists.txt
//web-services/p4ws-main/p4_project_services/clients/qt/p4_project_services_client/p4_project_services.h
//web-services/p4ws-main/p4_project_services/clients/qt/p4_project_services_client/p4_project_services/Branch.cpp
//web-services/p4ws-main/p4_project_services/clients/qt/p4_project_services_client/p4_project_services/Branch.h
//web-services/p4ws-main/p4_project_services/clients/qt/p4_project_services_client/p4_project_services/Project.cpp
//web-services/p4ws-main/p4_project_services/clients/qt/p4_project_services_client/p4_project_services/Project.h
//web-services/p4ws-main/p4_project_services/clients/qt/p4_project_services_client/p4_project_services/View.cpp
//web-services/p4ws-main/p4_project_services/clients/qt/p4_project_services_client/p4_project_services/View.h
//web-services/p4ws-main/qt/CMakeLists.txt
//web-services/p4ws-main/qt/p4_phoenix_services_client/CMakeLists.txt
//web-services/p4ws-main/qt/p4_phoenix_services_client/PhoenixIntegrationTests.cpp
//web-services/p4ws-main/qt/p4_phoenix_services_client/README
//web-services/p4ws-main/qt/p4_phoenix_services_client/phoenix.h
//web-services/p4ws-main/qt/p4_phoenix_services_client/phoenix/PhoenixProject.cpp
//web-services/p4ws-main/qt/p4_phoenix_services_client/phoenix/PhoenixProject.h
//web-services/p4ws-main/qt/p4_phoenix_services_client/phoenix/PhoenixServicesClient.cpp
//web-services/p4ws-main/qt/p4_phoenix_services_client/phoenix/PhoenixServicesClient.h
//web-services/p4ws-main/qt/p4_phoenix_services_client/phoenix/RequestError.cpp
//web-services/p4ws-main/qt/p4_phoenix_services_client/phoenix/RequestError.h
//web-services/p4ws-main/qt/p4_phoenix_services_client/phoenix/Session.cpp
//web-services/p4ws-main/qt/p4_phoenix_services_client/phoenix/Session.h
//web-services/p4ws-main/qt/p4_phoenix_services_client/test/PhoenixServicesClientTests.cpp
//web-services/p4ws-main/qt/p4_phoenix_services_client/test/PhoenixServicesClientTests.h
//web-services/p4ws-main/qt/p4_phoenix_services_client/test/SessionTests.cpp
//web-services/p4ws-main/qt/p4_phoenix_services_client/test/SessionTests.h
//web-services/p4ws-main/qt/p4_project_services_client/CMakeLists.txt
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeCache.txt
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeFiles/2.8.12/CMakeCCompiler.cmake
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeFiles/2.8.12/CMakeCXXCompiler.cmake
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeFiles/2.8.12/CMakeDetermineCompilerABI_C.bin
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeFiles/2.8.12/CMakeDetermineCompilerABI_CXX.bin
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeFiles/2.8.12/CMakeSystem.cmake
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeFiles/2.8.12/CompilerIdC/CMakeCCompilerId.c
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeFiles/2.8.12/CompilerIdC/a.out
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeFiles/2.8.12/CompilerIdCXX/CMakeCXXCompilerId.cpp
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeFiles/2.8.12/CompilerIdCXX/a.out
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeFiles/CMakeDirectoryInformation.cmake
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeFiles/CMakeOutput.log
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeFiles/Makefile.cmake
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeFiles/Makefile2
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeFiles/TargetDirectories.txt
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeFiles/cmake.check_cache
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeFiles/p4_project_services_client.dir/DependInfo.cmake
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeFiles/p4_project_services_client.dir/build.make
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeFiles/p4_project_services_client.dir/cmake_clean.cmake
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeFiles/p4_project_services_client.dir/cmake_clean_target.cmake
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeFiles/p4_project_services_client.dir/depend.make
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeFiles/p4_project_services_client.dir/flags.make
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeFiles/p4_project_services_client.dir/link.txt
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeFiles/p4_project_services_client.dir/progress.make
//web-services/p4ws-main/qt/p4_project_services_client/build/CMakeFiles/progress.marks
//web-services/p4ws-main/qt/p4_project_services_client/build/Makefile
//web-services/p4ws-main/qt/p4_project_services_client/build/cmake_install.cmake
//web-services/p4ws-main/qt/p4_project_services_client/p4_project_services.h
//web-services/p4ws-main/qt/p4_project_services_client/p4_project_services/Branch.cpp
//web-services/p4ws-main/qt/p4_project_services_client/p4_project_services/Branch.h
//web-services/p4ws-main/qt/p4_project_services_client/p4_project_services/Project.cpp
//web-services/p4ws-main/qt/p4_project_services_client/p4_project_services/Project.h
//web-services/p4ws-main/qt/p4_project_services_client/p4_project_services/View.cpp
//web-services/p4ws-main/qt/p4_project_services_client/p4_project_services/View.h
#13 13439 tjuricek Added a *very trivial* logIn implementation.

This just makes the *current* POST request to /p4_phoenix_services/v1/sessions, which *does not* include the ability to create a host locked P4 ticket for the user. So it's not quite usable yet. But, I've made several tweaks to the API which should be stablizing.
#12 13433 tjuricek Restructure 'builds' to be blessed versions of things to be used by clients.

The gems/ folder contains all the ruby distributables. Eventually, these will likely be published to Rubygems.

The other folders are source projects that can be included into dependent streams. These are 'versioned' against the last build that we ideally run some integration tests against.
#11 13431 tjuricek Try out chmod before updating the build.
#10 13429 tjuricek See if I can read directly from the source file.
#9 13428 tjuricek Add steps to create 'build/' output directory for automated builds.

This does require a 'p4' command line client in order to grab the latest changelist number, which may/may not be easily setup.
#8 13427 tjuricek Put retry logic for service start that depends upon curl.
#7 13426 tjuricek Added top level rake build task for automated builds.
#6 13420 tjuricek Setup the main directory to launch specs in subprojects and a unicorn-based daemon via rake.

See rake -T for details, but this should allow for CI builds to collect output.
#5 13419 tjuricek The p4_project_services specs now run that provide basic create-read ability.
#4 13418 tjuricek Added p4_project_services to development config.ru, and reconfigured p4 web api client tests to use the new paths.
#3 13417 tjuricek Added a 'rake work/config.ru' task, that creates a local rack configuration.

This now includes the project services, which is not yet mounted. The p4 web api tests still pass though.
#2 13416 tjuricek Set up the p4_web_api related projects to be loaded by the parent Gemfile to make it a little easier to launch a test p4d with different seed data.

Also fixed a couple of minor issues related to the client api.

You'll notice that the 'rake api_reset api_init' task sets up a p4d for the p4_web_api tests, where the 'rake proj_reset proj_init' tasks set up p4d for project services testing.

An example p4_web_api.ru that can be used for launching just the p4_web_api:

require 'p4_web_api'

# Do *not* let your development environment variables pollute how the p4 web api runs!
ENV.keys.select { |k| k =~ /^P4/ }.each { |k| ENV.delete(k) }

api = P4WebAPI::App.new
puts 'changing paths'
api.settings.token_path = '/Users/tjuricek/dev/p4ws/work/tokens'
api.settings.workspace_folder = '/Users/tjuricek/dev/p4ws/work/workspaces'
api.settings.p4 = {'port' => 'localhost:1666', 'charset' => 'auto'}

run api
#1 13415 tjuricek Add some basic utility methods to the top level.