class Origen::Client
Constants
- DEV_PORT
- USE_DEV_SERVER
-
include HTTParty
Public Instance Methods
Source
# File lib/origen/client.rb, line 21 def get(path, options = {}) self.class.get("#{url}/#{path}", options) end
Source
# File lib/origen/client.rb, line 95 def latest_development Origen::VersionString.new(origen[:latest_version_dev]) end
Returns the latest developmen Origen
version
Source
# File lib/origen/client.rb, line 90 def latest_production Origen::VersionString.new(origen[:latest_version_prod]) end
Returns the latest production Origen
version
Source
# File lib/origen/client.rb, line 68 def origen @origen ||= begin response = get('plugins/origen_core') JSON.parse(response.body, symbolize_names: true)[:plugin] end end
Returns a data packet for Origen
core
Also aliased as: origen_core
Source
# File lib/origen/client.rb, line 62 def plugin(name) response = get("plugins/#{name}") JSON.parse(response.body, symbolize_names: true)[:plugin] end
Source
# File lib/origen/client.rb, line 55 def plugins return @plugins if @plugins response = get('plugins') @plugins = JSON.parse(response.body, symbolize_names: true)[:plugins] end
Returns an array of data packets for all plugins
Source
# File lib/origen/client.rb, line 14 def post(path, options = {}) options[:port] = port invocation_url = URI.parse("#{url}/#{path}") http = Net::HTTP.new(invocation_url.host, invocation_url.port) http.post(invocation_url, JSON.dump(options[:body]), 'Content-type' => 'application/vnd.api+json', 'Accept' => 'text/json, application/vnd.api+json') end
Source
# File lib/origen/client.rb, line 37 def record_invocation(command) content = { data: { type: 'applications', attributes: { user: Origen.current_user.core_id, application: Origen.app.config.initials, "app-version": Origen.app.version, "origen-version": Origen.version, command: command, platform: Origen.running_on_windows? ? 'windows' : 'linux' } } } post('applications', body: content) end
Source
# File lib/origen/client.rb, line 78 def release! version = Origen.app.version body = { version: version.to_s } if version.production? body[:type] = :production else body[:type] = :development end post("plugins/#{Origen.app.name}/release", body: body) end
This will be called by the Origen
release process to post the latest app version information to the server
Source
# File lib/origen/client.rb, line 25 def url if Origen.site_config.invocation_url.nil? 'http://localhost:3000' else Origen.site_config.invocation_url end end