killbill-kpm 0.0.1 → 0.0.2

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.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +33 -0
  3. data/.travis.yml +38 -0
  4. data/Gemfile +3 -0
  5. data/Gemfile.head +5 -0
  6. data/Gemfile.lock +90 -0
  7. data/Jarfile +11 -0
  8. data/Jarfile.lock +56 -0
  9. data/LICENSE +201 -0
  10. data/README.md +2 -2
  11. data/Rakefile +16 -31
  12. data/VERSION +1 -0
  13. data/config.ru +4 -0
  14. data/killbill-kpm.gemspec +31 -0
  15. data/killbill.properties +3 -0
  16. data/lib/kpm/application.rb +91 -0
  17. data/lib/kpm/listener.rb +94 -0
  18. data/lib/kpm/plugins_installer.rb +113 -0
  19. data/lib/kpm_plugin.rb +13 -0
  20. data/pom.xml +44 -0
  21. data/release.sh +61 -0
  22. data/spec/kpm/base_plugin_spec.rb +25 -0
  23. data/spec/spec_helper.rb +14 -0
  24. metadata +49 -349
  25. data/MIT-LICENSE +0 -20
  26. data/app/assets/javascripts/application.js +0 -24
  27. data/app/assets/javascripts/kpm/kpm.js +0 -7
  28. data/app/assets/stylesheets/application.css +0 -19
  29. data/app/assets/stylesheets/bootstrap_and_overrides.css +0 -17
  30. data/app/assets/stylesheets/kpm/kpm.css +0 -6
  31. data/app/controllers/kpm/engine_controller.rb +0 -29
  32. data/app/controllers/kpm/nodes_info_controller.rb +0 -108
  33. data/app/controllers/kpm/plugins_controller.rb +0 -19
  34. data/app/helpers/kpm/application_helper.rb +0 -4
  35. data/app/views/kpm/layouts/kpm_application.html.erb +0 -31
  36. data/app/views/kpm/nodes_info/_logs_table.html.erb +0 -43
  37. data/app/views/kpm/nodes_info/_nodes_table.html.erb +0 -68
  38. data/app/views/kpm/nodes_info/index.html.erb +0 -68
  39. data/app/views/kpm/nodes_info/index.js.erb +0 -4
  40. data/app/views/kpm/plugins/_form.html.erb +0 -37
  41. data/app/views/kpm/plugins/_plugins_table.html.erb +0 -48
  42. data/app/views/kpm/plugins/index.html.erb +0 -18
  43. data/config/routes.rb +0 -17
  44. data/lib/kpm.rb +0 -24
  45. data/lib/kpm/client.rb +0 -31
  46. data/lib/kpm/engine.rb +0 -23
  47. data/lib/kpm/version.rb +0 -3
  48. data/lib/tasks/kpm_tasks.rake +0 -4
  49. data/test/dummy/README.rdoc +0 -28
  50. data/test/dummy/Rakefile +0 -6
  51. data/test/dummy/app/controllers/application_controller.rb +0 -5
  52. data/test/dummy/app/helpers/application_helper.rb +0 -2
  53. data/test/dummy/bin/bundle +0 -3
  54. data/test/dummy/bin/rails +0 -4
  55. data/test/dummy/bin/rake +0 -4
  56. data/test/dummy/bin/setup +0 -29
  57. data/test/dummy/config.ru +0 -4
  58. data/test/dummy/config/application.rb +0 -32
  59. data/test/dummy/config/boot.rb +0 -5
  60. data/test/dummy/config/database.yml +0 -23
  61. data/test/dummy/config/environment.rb +0 -5
  62. data/test/dummy/config/environments/development.rb +0 -41
  63. data/test/dummy/config/environments/production.rb +0 -79
  64. data/test/dummy/config/environments/test.rb +0 -42
  65. data/test/dummy/config/initializers/assets.rb +0 -11
  66. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  67. data/test/dummy/config/initializers/cookies_serializer.rb +0 -3
  68. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  69. data/test/dummy/config/initializers/inflections.rb +0 -16
  70. data/test/dummy/config/initializers/killbill_client.rb +0 -3
  71. data/test/dummy/config/initializers/mime_types.rb +0 -4
  72. data/test/dummy/config/initializers/session_store.rb +0 -3
  73. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  74. data/test/dummy/config/locales/en.yml +0 -23
  75. data/test/dummy/config/routes.rb +0 -4
  76. data/test/dummy/config/secrets.yml +0 -22
  77. data/test/integration/navigation_test.rb +0 -8
  78. data/test/kpm_test.rb +0 -7
  79. data/test/test_helper.rb +0 -21
@@ -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 :name, 'Name', :class => 'col-sm-2 control-label' %>
4
- <div class="col-sm-9">
5
- <%= text_field_tag :name, '', :class => 'form-control', :placeholder => 'Plugin name' %>
6
- </div>
7
- </div>
8
- <div class="form-group">
9
- <%= label_tag :name, '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_name => 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>
@@ -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.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
@@ -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(name, version, type, filename, plugin, options = {})
23
- path = "#{KILLBILL_KPM_PREFIX}/plugins"
24
- KillBillClient::API.post path, plugin, {:name => name, :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
@@ -1,23 +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 'bootstrap-datepicker-rails'
10
- require 'd3_rails'
11
- require 'momentjs-rails'
12
- require 'spinjs-rails'
13
- require 'killbill_client'
14
-
15
- module KPM
16
- class Engine < ::Rails::Engine
17
- isolate_namespace KPM
18
-
19
- ActiveSupport::Inflector.inflections do |inflect|
20
- inflect.acronym 'KPM'
21
- end
22
- end
23
- end
@@ -1,3 +0,0 @@
1
- module KPM
2
- VERSION = '0.0.1'
3
- end
@@ -1,4 +0,0 @@
1
- # desc "Explaining what the task does"
2
- # task :kpm do
3
- # # Task goes here
4
- # end
@@ -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>.
@@ -1,6 +0,0 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
- require File.expand_path('../config/application', __FILE__)
5
-
6
- Rails.application.load_tasks
@@ -1,5 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- # Prevent CSRF attacks by raising an exception.
3
- # For APIs, you may want to use :null_session instead.
4
- protect_from_forgery with: :exception
5
- end
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
- load Gem.bin_path('bundler', 'bundle')
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
3
- require_relative '../config/boot'
4
- require 'rails/commands'
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require_relative '../config/boot'
3
- require 'rake'
4
- Rake.application.run
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'pathname'
3
-
4
- # path to your application root.
5
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
-
7
- Dir.chdir APP_ROOT do
8
- # This script is a starting point to setup your application.
9
- # Add necessary setup steps to this file:
10
-
11
- puts "== Installing dependencies =="
12
- system "gem install bundler --conservative"
13
- system "bundle check || bundle install"
14
-
15
- # puts "\n== Copying sample files =="
16
- # unless File.exist?("config/database.yml")
17
- # system "cp config/database.yml.sample config/database.yml"
18
- # end
19
-
20
- puts "\n== Preparing database =="
21
- system "bin/rake db:setup"
22
-
23
- puts "\n== Removing old logs and tempfiles =="
24
- system "rm -f log/*"
25
- system "rm -rf tmp/cache"
26
-
27
- puts "\n== Restarting application server =="
28
- system "touch tmp/restart.txt"
29
- end
@@ -1,4 +0,0 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- run Rails.application
@@ -1,32 +0,0 @@
1
- require File.expand_path('../boot', __FILE__)
2
-
3
- require 'rails/all'
4
-
5
- Bundler.require(*Rails.groups)
6
- require "kpm"
7
-
8
- require "jquery-rails"
9
- require "twitter-bootstrap-rails"
10
- require "d3_rails"
11
-
12
- require "js-routes"
13
-
14
- module Dummy
15
- class Application < Rails::Application
16
- # Settings in config/environments/* take precedence over those specified here.
17
- # Application configuration should go into files in config/initializers
18
- # -- all .rb files in that directory are automatically loaded.
19
-
20
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
21
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
22
- # config.time_zone = 'Central Time (US & Canada)'
23
-
24
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
25
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
26
- # config.i18n.default_locale = :de
27
-
28
- # Do not swallow errors in after_commit/after_rollback callbacks.
29
- config.active_record.raise_in_transactional_callbacks = true
30
- end
31
- end
32
-
@@ -1,5 +0,0 @@
1
- # Set up gems listed in the Gemfile.
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
-
4
- require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
- $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -1,23 +0,0 @@
1
- # SQLite version 3.x
2
- # gem 'activerecord-jdbcsqlite3-adapter'
3
- #
4
- # Configure Using Gemfile
5
- # gem 'activerecord-jdbcsqlite3-adapter'
6
- #
7
- default: &default
8
- adapter: sqlite3
9
-
10
- development:
11
- <<: *default
12
- database: db/development.sqlite3
13
-
14
- # Warning: The database defined as "test" will be erased and
15
- # re-generated from your development database when you run "rake".
16
- # Do not set this db to the same as development or production.
17
- test:
18
- <<: *default
19
- database: db/test.sqlite3
20
-
21
- production:
22
- <<: *default
23
- database: db/production.sqlite3
@@ -1,5 +0,0 @@
1
- # Load the Rails application.
2
- require File.expand_path('../application', __FILE__)
3
-
4
- # Initialize the Rails application.
5
- Rails.application.initialize!
@@ -1,41 +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 and disable caching.
13
- config.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
15
-
16
- # Don't care if the mailer can't send.
17
- config.action_mailer.raise_delivery_errors = false
18
-
19
- # Print deprecation notices to the Rails logger.
20
- config.active_support.deprecation = :log
21
-
22
- # Raise an error on page load if there are pending migrations.
23
- config.active_record.migration_error = :page_load
24
-
25
- # Debug mode disables concatenation and preprocessing of assets.
26
- # This option may cause significant delays in view rendering with a large
27
- # number of complex assets.
28
- config.assets.debug = true
29
-
30
- # Asset digests allow you to set far-future HTTP expiration dates on all assets,
31
- # yet still be able to expire them through the digest params.
32
- config.assets.digest = true
33
-
34
- # Adds additional error checking when serving assets at runtime.
35
- # Checks for improperly declared sprockets dependencies.
36
- # Raises helpful error messages.
37
- config.assets.raise_runtime_errors = true
38
-
39
- # Raises error for missing translations
40
- # config.action_view.raise_on_missing_translations = true
41
- end
@@ -1,79 +0,0 @@
1
- Rails.application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # Code is not reloaded between requests.
5
- config.cache_classes = true
6
-
7
- # Eager load code on boot. This eager loads most of Rails and
8
- # your application in memory, allowing both threaded web servers
9
- # and those relying on copy on write to perform better.
10
- # Rake tasks automatically ignore this option for performance.
11
- config.eager_load = true
12
-
13
- # Full error reports are disabled and caching is turned on.
14
- config.consider_all_requests_local = false
15
- config.action_controller.perform_caching = true
16
-
17
- # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
- # Add `rack-cache` to your Gemfile before enabling this.
19
- # For large-scale production use, consider using a caching reverse proxy like
20
- # NGINX, varnish or squid.
21
- # config.action_dispatch.rack_cache = true
22
-
23
- # Disable serving static files from the `/public` folder by default since
24
- # Apache or NGINX already handles this.
25
- config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
26
-
27
- # Compress JavaScripts and CSS.
28
- config.assets.js_compressor = :uglifier
29
- # config.assets.css_compressor = :sass
30
-
31
- # Do not fallback to assets pipeline if a precompiled asset is missed.
32
- config.assets.compile = false
33
-
34
- # Asset digests allow you to set far-future HTTP expiration dates on all assets,
35
- # yet still be able to expire them through the digest params.
36
- config.assets.digest = true
37
-
38
- # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
39
-
40
- # Specifies the header that your server uses for sending files.
41
- # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
42
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
43
-
44
- # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
45
- # config.force_ssl = true
46
-
47
- # Use the lowest log level to ensure availability of diagnostic information
48
- # when problems arise.
49
- config.log_level = :debug
50
-
51
- # Prepend all log lines with the following tags.
52
- # config.log_tags = [ :subdomain, :uuid ]
53
-
54
- # Use a different logger for distributed setups.
55
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
56
-
57
- # Use a different cache store in production.
58
- # config.cache_store = :mem_cache_store
59
-
60
- # Enable serving of images, stylesheets, and JavaScripts from an asset server.
61
- # config.action_controller.asset_host = 'http://assets.example.com'
62
-
63
- # Ignore bad email addresses and do not raise email delivery errors.
64
- # Set this to true and configure the email server for immediate delivery to raise delivery errors.
65
- # config.action_mailer.raise_delivery_errors = false
66
-
67
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
68
- # the I18n.default_locale when a translation cannot be found).
69
- config.i18n.fallbacks = true
70
-
71
- # Send deprecation notices to registered listeners.
72
- config.active_support.deprecation = :notify
73
-
74
- # Use default logging formatter so that PID and timestamp are not suppressed.
75
- config.log_formatter = ::Logger::Formatter.new
76
-
77
- # Do not dump schema after migrations.
78
- config.active_record.dump_schema_after_migration = false
79
- end