killbill-kpm 0.3.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +33 -0
- data/.travis.yml +41 -0
- data/Gemfile +5 -0
- data/Gemfile.head +5 -0
- data/Gemfile.lock +109 -0
- data/Jarfile +12 -0
- data/Jarfile.lock +64 -0
- data/LICENSE +201 -0
- data/README.md +58 -15
- data/Rakefile +19 -34
- data/VERSION +1 -0
- data/config.ru +4 -0
- data/killbill-kpm.gemspec +31 -0
- data/killbill.properties +3 -0
- data/lib/kpm/application.rb +92 -0
- data/lib/kpm/listener.rb +95 -0
- data/lib/kpm/plugins_installer.rb +112 -0
- data/lib/kpm_plugin.rb +13 -0
- data/pom.xml +44 -0
- data/release.sh +61 -0
- data/spec/kpm/base_plugin_spec.rb +25 -0
- data/spec/spec_helper.rb +14 -0
- metadata +66 -190
- data/MIT-LICENSE +0 -20
- data/app/assets/javascripts/application.js +0 -18
- data/app/assets/javascripts/kpm/kpm.js +0 -7
- data/app/assets/stylesheets/application.css +0 -19
- data/app/assets/stylesheets/bootstrap_and_overrides.css +0 -13
- data/app/assets/stylesheets/kpm/kpm.css +0 -6
- data/app/controllers/kpm/engine_controller.rb +0 -29
- data/app/controllers/kpm/nodes_info_controller.rb +0 -109
- data/app/controllers/kpm/plugins_controller.rb +0 -19
- data/app/helpers/kpm/application_helper.rb +0 -4
- data/app/views/kpm/layouts/kpm_application.html.erb +0 -31
- data/app/views/kpm/nodes_info/_logs_table.html.erb +0 -43
- data/app/views/kpm/nodes_info/_nodes_table.html.erb +0 -68
- data/app/views/kpm/nodes_info/index.html.erb +0 -68
- data/app/views/kpm/nodes_info/index.js.erb +0 -4
- data/app/views/kpm/plugins/_form.html.erb +0 -37
- data/app/views/kpm/plugins/_plugins_table.html.erb +0 -48
- data/app/views/kpm/plugins/index.html.erb +0 -18
- data/config/routes.rb +0 -17
- data/lib/kpm/client.rb +0 -31
- data/lib/kpm/engine.rb +0 -21
- data/lib/kpm/version.rb +0 -3
- data/lib/kpm.rb +0 -24
- data/lib/tasks/kpm_tasks.rake +0 -4
- data/test/dummy/README.rdoc +0 -28
- data/test/dummy/Rakefile +0 -6
- data/test/dummy/app/controllers/application_controller.rb +0 -5
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/bin/bundle +0 -3
- data/test/dummy/bin/rails +0 -4
- data/test/dummy/bin/rake +0 -4
- data/test/dummy/bin/setup +0 -38
- data/test/dummy/bin/update +0 -29
- data/test/dummy/bin/yarn +0 -11
- data/test/dummy/config/application.rb +0 -26
- data/test/dummy/config/boot.rb +0 -3
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -54
- data/test/dummy/config/environments/production.rb +0 -91
- data/test/dummy/config/environments/test.rb +0 -42
- data/test/dummy/config/initializers/application_controller_renderer.rb +0 -6
- data/test/dummy/config/initializers/assets.rb +0 -14
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/cookies_serializer.rb +0 -5
- data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/test/dummy/config/initializers/inflections.rb +0 -16
- data/test/dummy/config/initializers/killbill_client.rb +0 -3
- data/test/dummy/config/initializers/mime_types.rb +0 -4
- data/test/dummy/config/initializers/new_framework_defaults_5_1.rb +0 -14
- data/test/dummy/config/initializers/session_store.rb +0 -3
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -33
- data/test/dummy/config/routes.rb +0 -4
- data/test/dummy/config/secrets.yml +0 -32
- data/test/dummy/config.ru +0 -4
- data/test/integration/navigation_test.rb +0 -17
- data/test/kpm_test.rb +0 -8
- data/test/test_helper.rb +0 -19
@@ -1,4 +0,0 @@
|
|
1
|
-
$('#nodes-table-wrapper').html("<%= escape_javascript(render :partial => 'kpm/nodes_info/nodes_table', :locals => {:nodes_info => @nodes_info}) %>");
|
2
|
-
$('#logs-table-wrapper').html("<%= escape_javascript(render :partial => 'kpm/nodes_info/logs_table', :locals => {:logs => @logs}) %>");
|
3
|
-
|
4
|
-
scheduleRefresh();
|
@@ -1,37 +0,0 @@
|
|
1
|
-
<%= form_tag plugin_install_from_fs_path, :multipart => true, :class => 'form-horizontal' do %>
|
2
|
-
<div class="form-group">
|
3
|
-
<%= label_tag :key, 'Plugin key', :class => 'col-sm-2 control-label' %>
|
4
|
-
<div class="col-sm-9">
|
5
|
-
<%= text_field_tag :key, '', :class => 'form-control', :placeholder => 'Plugin key' %>
|
6
|
-
</div>
|
7
|
-
</div>
|
8
|
-
<div class="form-group">
|
9
|
-
<%= label_tag :version, 'Version', :class => 'col-sm-2 control-label' %>
|
10
|
-
<div class="col-sm-9">
|
11
|
-
<%= text_field_tag :version, '', :class => 'form-control', :placeholder => 'Plugin version' %>
|
12
|
-
</div>
|
13
|
-
</div>
|
14
|
-
<div class='form-group'>
|
15
|
-
<div class="col-sm-offset-2 col-sm-10">
|
16
|
-
<% %w(java ruby).each do |type| %>
|
17
|
-
<div class="checkbox">
|
18
|
-
<%= label_tag :type do %>
|
19
|
-
<%= radio_button_tag :type, type, (type == 'java') %>
|
20
|
-
<%= type %>
|
21
|
-
<% end %>
|
22
|
-
</div>
|
23
|
-
<% end %>
|
24
|
-
</div>
|
25
|
-
</div>
|
26
|
-
<div class="form-group">
|
27
|
-
<%= label_tag :plugin, 'Plugin', :class => 'col-sm-2 control-label' %>
|
28
|
-
<div class="col-sm-10">
|
29
|
-
<%= file_field_tag 'plugin', :class => 'form-control' %>
|
30
|
-
</div>
|
31
|
-
</div>
|
32
|
-
<div class="form-group">
|
33
|
-
<div class="col-sm-offset-2 col-sm-10">
|
34
|
-
<%= submit_tag 'Install', :class => 'btn btn-default' %>
|
35
|
-
</div>
|
36
|
-
</div>
|
37
|
-
<% end %>
|
@@ -1,48 +0,0 @@
|
|
1
|
-
<table id="plugins-table" class="table table-condensed table-striped mobile-data">
|
2
|
-
<thead>
|
3
|
-
<tr>
|
4
|
-
<th>Name</th>
|
5
|
-
<th>Type</th>
|
6
|
-
<th>Versions</th>
|
7
|
-
<th>Required configuration</th>
|
8
|
-
<th></th>
|
9
|
-
</tr>
|
10
|
-
</thead>
|
11
|
-
<tbody>
|
12
|
-
<% plugins.each do |name, details| %>
|
13
|
-
<tr>
|
14
|
-
<td><%= name %></td>
|
15
|
-
<td><%= details['type'] %></td>
|
16
|
-
<td>
|
17
|
-
<% unless details['versions'].nil? %>
|
18
|
-
<ul>
|
19
|
-
<% details['versions'].each do |kb_version, plugin_version| %>
|
20
|
-
<li><%= kb_version %>: <%= plugin_version %></li>
|
21
|
-
<% end %>
|
22
|
-
</ul>
|
23
|
-
<% end %>
|
24
|
-
</td>
|
25
|
-
<td>
|
26
|
-
<% unless (details['require'] || []).empty? %>
|
27
|
-
<ul>
|
28
|
-
<% details['require'].each do |property| %>
|
29
|
-
<li><%= property %></li>
|
30
|
-
<% end %>
|
31
|
-
</ul>
|
32
|
-
<% end %>
|
33
|
-
</td>
|
34
|
-
<td><%= link_to '<i class="fa fa-cloud-download"></i>'.html_safe, plugin_install_path(:plugin_key => name), :method => :post, :title => 'Install' %></td>
|
35
|
-
</tr>
|
36
|
-
<% end %>
|
37
|
-
</tbody>
|
38
|
-
</table>
|
39
|
-
|
40
|
-
<%= javascript_tag do %>
|
41
|
-
$(document).ready(function() {
|
42
|
-
$('#plugins-table').dataTable({
|
43
|
-
"dom": "t",
|
44
|
-
"paging": false,
|
45
|
-
"ordering": false
|
46
|
-
});
|
47
|
-
});
|
48
|
-
<% end %>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<div class="search">
|
2
|
-
|
3
|
-
<div class="column-block">
|
4
|
-
|
5
|
-
<h1>Available plugins</h1>
|
6
|
-
|
7
|
-
<%= render :partial => 'kpm/plugins/plugins_table', :locals => {:plugins => @plugins} %>
|
8
|
-
|
9
|
-
</div>
|
10
|
-
|
11
|
-
<div class="column-block">
|
12
|
-
|
13
|
-
<h1>Upload plugin</h1>
|
14
|
-
<%= render 'form' %>
|
15
|
-
|
16
|
-
</div>
|
17
|
-
|
18
|
-
</div>
|
data/config/routes.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
KPM::Engine.routes.draw do
|
2
|
-
|
3
|
-
root to: 'nodes_info#index'
|
4
|
-
|
5
|
-
resources :nodes_info, :only => [:index]
|
6
|
-
resources :plugins, :only => [:index]
|
7
|
-
|
8
|
-
scope '/nodes_info' do
|
9
|
-
match '/plugin/install' => 'nodes_info#install_plugin', :via => :post, :as => 'plugin_install'
|
10
|
-
match '/plugin/install_from_fs' => 'nodes_info#install_plugin_from_fs', :via => :post, :as => 'plugin_install_from_fs'
|
11
|
-
match '/plugin/uninstall' => 'nodes_info#uninstall_plugin', :via => :post, :as => 'plugin_uninstall'
|
12
|
-
match '/plugin/start' => 'nodes_info#start_plugin', :via => :post, :as => 'plugin_start'
|
13
|
-
match '/plugin/stop' => 'nodes_info#stop_plugin', :via => :post, :as => 'plugin_stop'
|
14
|
-
match '/plugin/restart' => 'nodes_info#restart_plugin', :via => :post, :as => 'plugin_restart'
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
data/lib/kpm/client.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
module Killbill
|
2
|
-
module KPM
|
3
|
-
|
4
|
-
class KPMClient < KillBillClient::Model::Resource
|
5
|
-
|
6
|
-
KILLBILL_KPM_PREFIX = '/plugins/killbill-kpm'
|
7
|
-
KILLBILL_OSGI_LOGGER_PREFIX = '/plugins/killbill-osgi-logger'
|
8
|
-
|
9
|
-
class << self
|
10
|
-
|
11
|
-
def get_available_plugins(latest=true, options = {})
|
12
|
-
path = "#{KILLBILL_KPM_PREFIX}/plugins"
|
13
|
-
response = KillBillClient::API.get path, { :latest => latest }, options
|
14
|
-
JSON.parse(response.body)
|
15
|
-
end
|
16
|
-
|
17
|
-
def get_osgi_logs(options = {})
|
18
|
-
response = KillBillClient::API.get KILLBILL_OSGI_LOGGER_PREFIX, {}, options
|
19
|
-
JSON.parse(response.body)
|
20
|
-
end
|
21
|
-
|
22
|
-
def install_plugin(key, version, type, filename, plugin, options = {})
|
23
|
-
path = "#{KILLBILL_KPM_PREFIX}/plugins"
|
24
|
-
KillBillClient::API.post path, plugin, {:key => key, :version => version, :type => type, :filename => filename}, options.merge(:content_type => 'application/octet-stream')
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|
data/lib/kpm/engine.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# Dependencies
|
2
|
-
#
|
3
|
-
# Sigh. Rails autoloads the gems specified in the Gemfile and nothing else.
|
4
|
-
# We need to explicitly require all of our dependencies listed in kpm.gemspec
|
5
|
-
#
|
6
|
-
# See also https://github.com/carlhuda/bundler/issues/49
|
7
|
-
require 'jquery-rails'
|
8
|
-
require 'jquery-datatables-rails'
|
9
|
-
require 'font-awesome-rails'
|
10
|
-
require 'twitter-bootstrap-rails'
|
11
|
-
require 'killbill_client'
|
12
|
-
|
13
|
-
module KPM
|
14
|
-
class Engine < ::Rails::Engine
|
15
|
-
isolate_namespace KPM
|
16
|
-
|
17
|
-
ActiveSupport::Inflector.inflections do |inflect|
|
18
|
-
inflect.acronym 'KPM'
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/lib/kpm/version.rb
DELETED
data/lib/kpm.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'kpm/engine'
|
2
|
-
|
3
|
-
module KPM
|
4
|
-
|
5
|
-
mattr_accessor :current_tenant_user
|
6
|
-
mattr_accessor :layout
|
7
|
-
|
8
|
-
self.current_tenant_user = lambda { |session, user|
|
9
|
-
{
|
10
|
-
:username => 'admin',
|
11
|
-
:password => 'password',
|
12
|
-
:session_id => nil,
|
13
|
-
:api_key => KillBillClient.api_key,
|
14
|
-
:api_secret => KillBillClient.api_secret
|
15
|
-
}
|
16
|
-
}
|
17
|
-
|
18
|
-
def self.config(&block)
|
19
|
-
{
|
20
|
-
:layout => layout || 'kpm/layouts/kpm_application',
|
21
|
-
}
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
data/lib/tasks/kpm_tasks.rake
DELETED
data/test/dummy/README.rdoc
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
== README
|
2
|
-
|
3
|
-
This README would normally document whatever steps are necessary to get the
|
4
|
-
application up and running.
|
5
|
-
|
6
|
-
Things you may want to cover:
|
7
|
-
|
8
|
-
* Ruby version
|
9
|
-
|
10
|
-
* System dependencies
|
11
|
-
|
12
|
-
* Configuration
|
13
|
-
|
14
|
-
* Database creation
|
15
|
-
|
16
|
-
* Database initialization
|
17
|
-
|
18
|
-
* How to run the test suite
|
19
|
-
|
20
|
-
* Services (job queues, cache servers, search engines, etc.)
|
21
|
-
|
22
|
-
* Deployment instructions
|
23
|
-
|
24
|
-
* ...
|
25
|
-
|
26
|
-
|
27
|
-
Please feel free to use a different markup language if you do not plan to run
|
28
|
-
<tt>rake doc:app</tt>.
|
data/test/dummy/Rakefile
DELETED
data/test/dummy/bin/bundle
DELETED
data/test/dummy/bin/rails
DELETED
data/test/dummy/bin/rake
DELETED
data/test/dummy/bin/setup
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'pathname'
|
3
|
-
require 'fileutils'
|
4
|
-
include FileUtils
|
5
|
-
|
6
|
-
# path to your application root.
|
7
|
-
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
8
|
-
|
9
|
-
def system!(*args)
|
10
|
-
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
-
end
|
12
|
-
|
13
|
-
chdir APP_ROOT do
|
14
|
-
# This script is a starting point to setup your application.
|
15
|
-
# Add necessary setup steps to this file.
|
16
|
-
|
17
|
-
puts '== Installing dependencies =='
|
18
|
-
system! 'gem install bundler --conservative'
|
19
|
-
system('bundle check') || system!('bundle install')
|
20
|
-
|
21
|
-
# Install JavaScript dependencies if using Yarn
|
22
|
-
# system('bin/yarn')
|
23
|
-
|
24
|
-
|
25
|
-
# puts "\n== Copying sample files =="
|
26
|
-
# unless File.exist?('config/database.yml')
|
27
|
-
# cp 'config/database.yml.sample', 'config/database.yml'
|
28
|
-
# end
|
29
|
-
|
30
|
-
puts "\n== Preparing database =="
|
31
|
-
system! 'bin/rails db:setup'
|
32
|
-
|
33
|
-
puts "\n== Removing old logs and tempfiles =="
|
34
|
-
system! 'bin/rails log:clear tmp:clear'
|
35
|
-
|
36
|
-
puts "\n== Restarting application server =="
|
37
|
-
system! 'bin/rails restart'
|
38
|
-
end
|
data/test/dummy/bin/update
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'pathname'
|
3
|
-
require 'fileutils'
|
4
|
-
include FileUtils
|
5
|
-
|
6
|
-
# path to your application root.
|
7
|
-
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
8
|
-
|
9
|
-
def system!(*args)
|
10
|
-
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
-
end
|
12
|
-
|
13
|
-
chdir APP_ROOT do
|
14
|
-
# This script is a way to update your development environment automatically.
|
15
|
-
# Add necessary update steps to this file.
|
16
|
-
|
17
|
-
puts '== Installing dependencies =='
|
18
|
-
system! 'gem install bundler --conservative'
|
19
|
-
system('bundle check') || system!('bundle install')
|
20
|
-
|
21
|
-
puts "\n== Updating database =="
|
22
|
-
system! 'bin/rails db:migrate'
|
23
|
-
|
24
|
-
puts "\n== Removing old logs and tempfiles =="
|
25
|
-
system! 'bin/rails log:clear tmp:clear'
|
26
|
-
|
27
|
-
puts "\n== Restarting application server =="
|
28
|
-
system! 'bin/rails restart'
|
29
|
-
end
|
data/test/dummy/bin/yarn
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
VENDOR_PATH = File.expand_path('..', __dir__)
|
3
|
-
Dir.chdir(VENDOR_PATH) do
|
4
|
-
begin
|
5
|
-
exec "yarnpkg #{ARGV.join(" ")}"
|
6
|
-
rescue Errno::ENOENT
|
7
|
-
$stderr.puts "Yarn executable was not detected in the system."
|
8
|
-
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
9
|
-
exit 1
|
10
|
-
end
|
11
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require_relative 'boot'
|
2
|
-
|
3
|
-
require 'action_controller/railtie'
|
4
|
-
require 'action_view/railtie'
|
5
|
-
require 'rails/test_unit/railtie'
|
6
|
-
require 'sprockets/railtie'
|
7
|
-
|
8
|
-
# Require the gems listed in Gemfile, including any gems
|
9
|
-
# you've limited to :test, :development, or :production.
|
10
|
-
Bundler.require(*Rails.groups)
|
11
|
-
|
12
|
-
#
|
13
|
-
# Required to load the KPM UI engine into the dummy app
|
14
|
-
#
|
15
|
-
require File.expand_path('../../../../lib/kpm.rb', __FILE__)
|
16
|
-
|
17
|
-
module Dummy
|
18
|
-
class Application < Rails::Application
|
19
|
-
# Initialize configuration defaults for originally generated Rails version.
|
20
|
-
config.load_defaults 5.1
|
21
|
-
|
22
|
-
# Settings in config/environments/* take precedence over those specified here.
|
23
|
-
# Application configuration should go into files in config/initializers
|
24
|
-
# -- all .rb files in that directory are automatically loaded.
|
25
|
-
end
|
26
|
-
end
|
data/test/dummy/config/boot.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
Rails.application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
-
|
4
|
-
# In the development environment your application's code is reloaded on
|
5
|
-
# every request. This slows down response time but is perfect for development
|
6
|
-
# since you don't have to restart the web server when you make code changes.
|
7
|
-
config.cache_classes = false
|
8
|
-
|
9
|
-
# Do not eager load code on boot.
|
10
|
-
config.eager_load = false
|
11
|
-
|
12
|
-
# Show full error reports.
|
13
|
-
config.consider_all_requests_local = true
|
14
|
-
|
15
|
-
# Enable/disable caching. By default caching is disabled.
|
16
|
-
if Rails.root.join('tmp/caching-dev.txt').exist?
|
17
|
-
config.action_controller.perform_caching = true
|
18
|
-
|
19
|
-
config.cache_store = :memory_store
|
20
|
-
config.public_file_server.headers = {
|
21
|
-
'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}"
|
22
|
-
}
|
23
|
-
else
|
24
|
-
config.action_controller.perform_caching = false
|
25
|
-
|
26
|
-
config.cache_store = :null_store
|
27
|
-
end
|
28
|
-
|
29
|
-
# Don't care if the mailer can't send.
|
30
|
-
# config.action_mailer.raise_delivery_errors = false
|
31
|
-
|
32
|
-
# config.action_mailer.perform_caching = false
|
33
|
-
|
34
|
-
# Print deprecation notices to the Rails logger.
|
35
|
-
# config.active_support.deprecation = :log
|
36
|
-
|
37
|
-
# Raise an error on page load if there are pending migrations.
|
38
|
-
# config.active_record.migration_error = :page_load
|
39
|
-
|
40
|
-
# Debug mode disables concatenation and preprocessing of assets.
|
41
|
-
# This option may cause significant delays in view rendering with a large
|
42
|
-
# number of complex assets.
|
43
|
-
config.assets.debug = true
|
44
|
-
|
45
|
-
# Suppress logger output for asset requests.
|
46
|
-
config.assets.quiet = true
|
47
|
-
|
48
|
-
# Raises error for missing translations
|
49
|
-
# config.action_view.raise_on_missing_translations = true
|
50
|
-
|
51
|
-
# Use an evented file watcher to asynchronously detect changes in source code,
|
52
|
-
# routes, locales, etc. This feature depends on the listen gem.
|
53
|
-
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
54
|
-
end
|