Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
iNecas committed Jul 16, 2015
1 parent 01d41bb commit 07b9de7
Show file tree
Hide file tree
Showing 12 changed files with 854 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/.bundle/
/.yardoc
/Gemfile.lock
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/
*.bundle
*.so
*.o
*.a
mkmf.log
.idea
bundler.d/Gemfile.local.rb
8 changes: 8 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source 'https://rubygems.org'

gemspec

group :development do
gem 'smart_proxy', :git => "https://github.com/theforeman/smart-proxy", :branch => "develop"
gem 'pry'
end
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Smart-proxy Dynflow plugin

This a plugin for foreman smart-proxy allowing using dynflow for the
[remote execution](http://theforeman.github.io/foreman_remote_execution/)

## Installation

Add this line to your smart proxy bundler.d/dynflow.rb gemfile:

```ruby
gem 'smart_proxy_dynflow
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install smart_proxy_dynflow
## Usage
To configure this plugin you can use template from settings.d/dynflow.yml.example.
You must place dynflow.yml config file (based on this template) to your
smart-proxy config/settings.d/ directory.
15 changes: 15 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'rake'
require 'rake/testtask'
require "bundler/gem_tasks"

desc 'Default: run unit tests.'
task :default => :test

desc 'Test Dynflow plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << '.'
t.libs << 'lib'
t.libs << 'test'
t.test_files = FileList['test/**/*_test.rb']
t.verbose = true
end
1 change: 1 addition & 0 deletions bundler.d/dynflow.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gem 'smart_proxy_dynflow'
59 changes: 59 additions & 0 deletions lib/smart_proxy_dynflow.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
require 'dynflow'

require 'smart_proxy_dynflow/version'
require 'smart_proxy_dynflow/plugin'

class Proxy::Dynflow

attr_reader :world

def initialize
@world = create_world
end

def create_world(options = {})
options = default_world_options.merge(options)
::Dynflow::SimpleWorld.new(options)
end

def persistence_conn_string
ENV['DYNFLOW_DB_CONN_STRING'] || 'sqlite:/'
end

def persistence_adapter
::Dynflow::PersistenceAdapters::Sequel.new persistence_conn_string
end

def default_world_options
{ logger_adapter: logger_adapter,
persistence_adapter: persistence_adapter }
end

def logger_adapter
::Dynflow::LoggerAdapters::Simple.new $stderr, 1
end

def web_console
require 'dynflow/web_console'
world = @world
dynflow_console = ::Dynflow::WebConsole.setup do
set :world, world
end
dynflow_console
end

class << self
attr_reader :instance

def initialize
@instance = Proxy::Dynflow.new
end

def world
instance.world
end
end
end


Proxy::Dynflow.initialize
3 changes: 3 additions & 0 deletions lib/smart_proxy_dynflow/http_config.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
map "/dynflow" do
run Proxy::Dynflow.instance.web_console
end
11 changes: 11 additions & 0 deletions lib/smart_proxy_dynflow/plugin.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Proxy::Dynflow
class Plugin < Proxy::Plugin
http_rackup_path File.expand_path("http_config.ru", File.expand_path("../", __FILE__))
https_rackup_path File.expand_path("http_config.ru", File.expand_path("../", __FILE__))

settings_file "dynflow.yml"
default_settings :dynflow_identity_key => '~/.vagrant.d/insecure_private_key',
:dynflow_user => 'root'
plugin :dynflow, Proxy::Dynflow::VERSION
end
end
5 changes: 5 additions & 0 deletions lib/smart_proxy_dynflow/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Proxy
class Dynflow
VERSION = '0.0.1'
end
end
2 changes: 2 additions & 0 deletions settings.d/dynflow.yml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
:enabled: false
34 changes: 34 additions & 0 deletions smart_proxy_dynflow.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'smart_proxy_dynflow/version'

Gem::Specification.new do |gem|
gem.name = "smart_proxy_dynflow"
gem.version = Proxy::Dynflow::VERSION
gem.authors = ['Ivan Nečas']
gem.email = ['[email protected]']
gem.homepage = "https://github.com/theforeman/smart_proxy_dynflow"
gem.summary = %q{Dynflow runtime for Foreman smart proxy}
gem.description = <<-EOS
Use the Dynflow in side Foreman smart proxy
EOS

gem.files = Dir['{bundler.d,lib,settings.d}/**/*', 'LICENSE', 'Gemfile']
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ["lib"]
gem.license = 'GPLv3'

gem.add_development_dependency "bundler", "~> 1.7"
gem.add_development_dependency "rake", "~> 10.0"
gem.add_development_dependency('test-unit', '~> 2')
gem.add_development_dependency('mocha', '~> 1')
gem.add_development_dependency('webmock', '~> 1')
gem.add_development_dependency('rack-test', '~> 0')
gem.add_development_dependency('rake', '~> 10')

gem.add_runtime_dependency('dynflow')
gem.add_runtime_dependency('sequel')
gem.add_runtime_dependency('sqlite3')
end

0 comments on commit 07b9de7

Please sign in to comment.