killbill-helloworld 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5f9ebf5dc4161d1a2d2356669a85a0226020f0f5
4
- data.tar.gz: b31447aa80ec52f79b06c8eb786adbc457571e24
3
+ metadata.gz: 0b9915f1a87d61638cb5d8950bc0191d853d9728
4
+ data.tar.gz: 9fe583f41e1bfc27f0b87f9a2184d41bb755f4ed
5
5
  SHA512:
6
- metadata.gz: 4563da694eb8d1a26c8801c56ac6acf545d141ae135f4098163f820a1c95e2cfbf9b1735ffdbe9e5ea7f44544fe118f56e7a2914b8fe7a14877227df8904e14d
7
- data.tar.gz: 0b035451d5a26282d2c1cac289ef021d4eb3744d6988ac12f5a310ef0b8782928d8b560b7ed4d5387e135ba7c4039cc11c049565179d8946e883ac625cd768f3
6
+ metadata.gz: 7c66041a7945ec93e874bd3962542c8a88002480ecad20e80de433c86468df237c14c684cee083c69da2db0e53d3e765ad0aca24807ff152573d0a200c1ea779
7
+ data.tar.gz: ff8666f2ba3e163ae1fb916cd8c3c1767829c8289c4d43502d72274e980acd4b32a61c152506a2dda6d8ca076af408db5ce2851db52ff60a078557ab7ba19e9c
data/.gitignore CHANGED
@@ -19,17 +19,15 @@ _yardoc
19
19
  doc/
20
20
 
21
21
  .jbundler
22
- Jarfile.lock
23
- Gemfile.lock
24
22
 
25
23
  .DS_Store
26
24
 
27
- # Build directory
28
- killbill-helloworld/
25
+ # Testing database
26
+ test.db
29
27
 
30
28
  target
31
29
  pom.xml.asc
32
30
 
33
31
  .idea/
34
32
 
35
- test.db
33
+ Gemfile.head.lock
data/.travis.yml CHANGED
@@ -1,19 +1,38 @@
1
1
  language: ruby
2
2
 
3
+ sudo: false
4
+ cache: bundler
5
+
6
+ script: 'bundle exec rake test:spec'
7
+
3
8
  notifications:
4
9
  email:
5
10
  - kill-bill-commits@googlegroups.com
6
11
 
12
+ env:
13
+ global:
14
+ - JRUBY_OPTS='-J-Xmx1024M'
15
+
7
16
  rvm:
8
- - jruby-19mode
9
- - jruby-20mode
17
+ - jruby-1.7.20
18
+ - jruby-20mode # latest 1.7.x
10
19
  - jruby-head
11
20
 
21
+ gemfile:
22
+ - Gemfile
23
+ - Gemfile.head
24
+
12
25
  jdk:
13
- - openjdk6
14
26
  - openjdk7
15
27
  - oraclejdk7
28
+ - oraclejdk8
16
29
 
17
30
  matrix:
18
31
  allow_failures:
19
32
  - rvm: jruby-head
33
+ - jdk: oraclejdk8
34
+ - gemfile: Gemfile.head
35
+ fast_finish: true
36
+
37
+ after_success:
38
+ - '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && echo "<settings><servers><server><id>sonatype-nexus-snapshots</id><username>\${env.OSSRH_USER}</username><password>\${env.OSSRH_PASS}</password></server></servers></settings>" > ~/settings.xml && MVN="mvn --settings $HOME/settings.xml" NO_RELEASE=1 travis_retry travis_wait bash release.sh | egrep -v "Download|Install|Upload" ; rm -f ~/settings.xml'
data/Gemfile.head ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'killbill', :github => 'killbill/killbill-plugin-framework-ruby', :ref => 'HEAD'
data/Gemfile.lock ADDED
@@ -0,0 +1,87 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ killbill-helloworld (1.0.0)
5
+ activerecord (~> 4.1.0)
6
+ activerecord-bogacs (~> 0.3)
7
+ activerecord-jdbc-adapter (~> 1.3)
8
+ killbill (~> 4.0.0)
9
+ sinatra (~> 1.3.4)
10
+
11
+ GEM
12
+ remote: http://rubygems.org/
13
+ specs:
14
+ activemodel (4.1.10)
15
+ activesupport (= 4.1.10)
16
+ builder (~> 3.1)
17
+ activerecord (4.1.10)
18
+ activemodel (= 4.1.10)
19
+ activesupport (= 4.1.10)
20
+ arel (~> 5.0.0)
21
+ activerecord-bogacs (0.3.0)
22
+ thread_safe (~> 0.3)
23
+ activerecord-jdbc-adapter (1.3.16)
24
+ activerecord (>= 2.2)
25
+ activesupport (4.1.10)
26
+ i18n (~> 0.6, >= 0.6.9)
27
+ json (~> 1.7, >= 1.7.7)
28
+ minitest (~> 5.1)
29
+ thread_safe (~> 0.1)
30
+ tzinfo (~> 1.1)
31
+ arel (5.0.1.20140414130214)
32
+ builder (3.2.2)
33
+ diff-lcs (1.1.3)
34
+ ethon (0.7.3)
35
+ ffi (>= 1.3.0)
36
+ ffi (1.9.8-java)
37
+ i18n (0.7.0)
38
+ jbundler (0.4.3)
39
+ maven-tools (~> 0.32.1)
40
+ ruby-maven (~> 3.0.4)
41
+ jdbc-mariadb (1.1.8)
42
+ jdbc-sqlite3 (3.8.7)
43
+ json (1.8.2-java)
44
+ killbill (4.0.0)
45
+ rack (>= 1.5.2)
46
+ sinatra (~> 1.3.4)
47
+ typhoeus (~> 0.6.9)
48
+ tzinfo (~> 1.2.0)
49
+ maven-tools (0.32.5)
50
+ minitest (5.6.1)
51
+ rack (1.6.1)
52
+ rack-protection (1.5.3)
53
+ rack
54
+ rake (10.4.2)
55
+ rspec (2.12.0)
56
+ rspec-core (~> 2.12.0)
57
+ rspec-expectations (~> 2.12.0)
58
+ rspec-mocks (~> 2.12.0)
59
+ rspec-core (2.12.2)
60
+ rspec-expectations (2.12.1)
61
+ diff-lcs (~> 1.1.3)
62
+ rspec-mocks (2.12.2)
63
+ ruby-maven (3.0.4.1.4)
64
+ maven-tools (~> 0.32.3)
65
+ thor (>= 0.14.6, < 2.0)
66
+ sinatra (1.3.6)
67
+ rack (~> 1.4)
68
+ rack-protection (~> 1.3)
69
+ tilt (~> 1.3, >= 1.3.3)
70
+ thor (0.19.1)
71
+ thread_safe (0.3.5-java)
72
+ tilt (1.4.1)
73
+ typhoeus (0.6.9)
74
+ ethon (>= 0.7.1)
75
+ tzinfo (1.2.2)
76
+ thread_safe (~> 0.1)
77
+
78
+ PLATFORMS
79
+ java
80
+
81
+ DEPENDENCIES
82
+ jbundler (~> 0.4.3)
83
+ jdbc-mariadb (~> 1.1)
84
+ jdbc-sqlite3 (~> 3.7)
85
+ killbill-helloworld!
86
+ rake (>= 10.0.0)
87
+ rspec (~> 2.12.0)
data/Jarfile CHANGED
@@ -1,6 +1,9 @@
1
- jar 'org.kill-bill.billing:killbill-api', '0.8.2'
2
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-notification', '0.6.4'
3
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-payment', '0.6.4'
4
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-currency', '0.6.4'
5
- jar 'org.kill-bill.billing:killbill-util:tests', '0.9.1'
6
- jar 'javax.servlet:javax.servlet-api', '3.0.1'
1
+ jar 'org.kill-bill.billing:killbill-api', '0.14'
2
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-currency', '0.9'
3
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-invoice', '0.9'
4
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-notification', '0.9'
5
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-payment', '0.9'
6
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-routing', '0.9'
7
+ jar 'org.kill-bill.billing:killbill-util:tests', '0.13.7'
8
+ jar 'org.mockito:mockito-all', '1.10.19'
9
+ jar 'javax.servlet:javax.servlet-api', '3.1.0'
data/Jarfile.lock ADDED
@@ -0,0 +1,56 @@
1
+ org.kill-bill.billing:killbill-api:jar:0.14
2
+ com.fasterxml.jackson.core:jackson-annotations:jar:2.4.3
3
+ joda-time:joda-time:jar:2.3
4
+ org.kill-bill.billing.plugin:killbill-plugin-api-currency:jar:0.9
5
+ org.kill-bill.billing.plugin:killbill-plugin-api-invoice:jar:0.9
6
+ org.kill-bill.billing.plugin:killbill-plugin-api-notification:jar:0.9
7
+ org.kill-bill.billing.plugin:killbill-plugin-api-payment:jar:0.9
8
+ org.kill-bill.billing.plugin:killbill-plugin-api-routing:jar:0.9
9
+ org.kill-bill.billing:killbill-util:jar:tests:0.13.7
10
+ com.fasterxml.jackson.core:jackson-databind:jar:2.4.3
11
+ com.fasterxml.jackson.core:jackson-core:jar:2.4.3
12
+ com.fasterxml.jackson.dataformat:jackson-dataformat-csv:jar:2.4.3
13
+ com.fasterxml.jackson.datatype:jackson-datatype-joda:jar:2.4.3
14
+ com.samskivert:jmustache:jar:1.5
15
+ io.dropwizard.metrics:metrics-core:jar:3.1.1
16
+ io.dropwizard.metrics:metrics-ehcache:jar:3.1.1
17
+ net.sf.ehcache:ehcache:jar:2.9.1
18
+ org.antlr:stringtemplate:jar:3.2.1
19
+ antlr:antlr:jar:2.7.7
20
+ org.apache.commons:commons-email:jar:1.2
21
+ javax.mail:mail:jar:1.4.1
22
+ javax.activation:activation:jar:1.1
23
+ org.apache.shiro:shiro-core:jar:1.2.3
24
+ commons-beanutils:commons-beanutils:jar:1.8.3
25
+ commons-logging:commons-logging:jar:1.1.1
26
+ org.apache.shiro:shiro-ehcache:jar:1.2.3
27
+ net.sf.ehcache:ehcache-core:jar:2.5.0
28
+ org.apache.shiro:shiro-guice:jar:1.2.3
29
+ com.google.guava:guava:jar:r09
30
+ com.google.inject:guice:jar:3.0
31
+ aopalliance:aopalliance:jar:1.0
32
+ com.google.inject.extensions:guice-multibindings:jar:3.0
33
+ org.jdbi:jdbi:jar:2.62
34
+ org.joda:joda-money:jar:0.9
35
+ org.kill-bill.billing:killbill-internal-api:jar:0.13.7
36
+ org.kill-bill.billing:killbill-platform-api:jar:0.2
37
+ org.kill-bill.billing:killbill-platform-base:jar:0.2
38
+ com.google.code.findbugs:annotations:jar:3.0.0
39
+ org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4:jar:1.16
40
+ org.kill-bill.billing:killbill-platform-osgi-api:jar:0.2
41
+ org.osgi:org.osgi.core:jar:5.0.0
42
+ org.kill-bill.commons:killbill-clock:jar:0.3
43
+ org.kill-bill.commons:killbill-concurrent:jar:0.3
44
+ org.kill-bill.commons:killbill-embeddeddb-common:jar:0.3
45
+ org.kill-bill.commons:killbill-jdbi:jar:0.3
46
+ com.h2database:h2:jar:1.4.186
47
+ javax.inject:javax.inject:jar:1
48
+ org.kill-bill.commons:killbill-locker:jar:0.3
49
+ org.kill-bill.commons:killbill-queue:jar:0.3
50
+ org.kill-bill.commons:killbill-xmlloader:jar:0.3
51
+ org.skife.config:config-magic:jar:0.14
52
+ org.slf4j:jcl-over-slf4j:jar:1.7.12
53
+ org.slf4j:slf4j-api:jar:1.7.12
54
+ org.weakref:jmxutils:jar:1.12
55
+ org.mockito:mockito-all:jar:1.10.19
56
+ javax.servlet:javax.servlet-api:jar:3.1.0
data/NEWS CHANGED
@@ -1,2 +1,5 @@
1
+ 1.0.0
2
+ Initial release for Kill Bill 0.14.x
3
+
1
4
  0.1.0
2
5
  Initial version
data/README.md CHANGED
@@ -3,28 +3,16 @@ killbill-hello-world-ruby-plugin
3
3
 
4
4
  Hello World Kill Bill plugin in Ruby.
5
5
 
6
- To package your app for Kill Bill, run:
6
+ Release builds are available on [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.kill-bill.billing.plugin.ruby%22%20AND%20a%3A%22helloworld-plugin%22) with coordinates `org.kill-bill.billing.plugin.ruby:helloworld-plugin`.
7
7
 
8
- ```
9
- # Use JRuby to avoid building native extensions
10
- rvm use jruby
11
- bundle install
12
- jbundle install
13
- rake killbill:clean
14
- rake build
15
- rake killbill:package
16
- ```
8
+ Kill Bill compatibility
9
+ -----------------------
17
10
 
18
- The artifact is available under the pkg/ directory.
11
+ | Plugin version | Kill Bill version |
12
+ | -------------: | ----------------: |
13
+ | 1.0.y | 0.14.z |
19
14
 
20
- Tests
21
- -----
15
+ Requirements
16
+ ------------
22
17
 
23
- You need JRuby to run the test suite.
24
-
25
- ```
26
- rvm use jruby
27
- bundle install
28
- jbundle install
29
- rake
30
- ```
18
+ The plugin needs a database. The latest version of the schema can be found [here](https://github.com/killbill/killbill-hello-world-ruby-plugin/blob/master/db/ddl.sql).
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 1.0.0
data/db/ddl.sql CHANGED
@@ -1,8 +1,8 @@
1
- CREATE TABLE `users` (
1
+ CREATE TABLE `hello_world_users` (
2
2
  `id` int(11) NOT NULL AUTO_INCREMENT,
3
3
  `kb_account_id` varchar(255) NOT NULL,
4
4
  `created_at` datetime NOT NULL,
5
5
  `updated_at` datetime NOT NULL,
6
6
  PRIMARY KEY (`id`),
7
- UNIQUE KEY `index_users_on_kb_account_id` (`kb_account_id`),
7
+ UNIQUE KEY `index_users_on_kb_account_id` (`kb_account_id`)
8
8
  ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
data/db/schema.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  require 'active_record'
2
2
 
3
3
  ActiveRecord::Schema.define(:version => 20130606153635) do
4
- create_table 'users', :force => true do |t|
4
+ create_table 'hello_world_users', :force => true do |t|
5
5
  t.string 'kb_account_id', :null => false
6
6
  t.datetime 'created_at', :null => false
7
7
  t.datetime 'updated_at', :null => false
8
8
  end
9
9
 
10
- add_index(:users, :kb_account_id, :unique => true)
10
+ add_index(:hello_world_users, :kb_account_id, :unique => true)
11
11
  end
data/helloworld.yml CHANGED
@@ -1,3 +1,24 @@
1
1
  :database:
2
- :adapter: 'sqlite3'
3
- :database: 'test.db'
2
+ # SQLite (development)
3
+ :adapter: sqlite3
4
+ :database: test.db
5
+ # For MySQL
6
+ # :adapter: mysql
7
+ # :username: 'killbill'
8
+ # :password: 'killbill'
9
+ # :database: 'killbill' # or set the URL :
10
+ # #:url: jdbc:mysql://127.0.0.1:3306/killbill
11
+ # :driver: org.mariadb.jdbc.Driver # as in KB
12
+ # :pool: 30 # AR's default is max 5 connections
13
+ # In Kill Bill
14
+ # :adapter: mysql
15
+ # :jndi: 'killbill/osgi/jdbc'
16
+ # :pool: false # false-pool (JNDI pool's max)
17
+ # # uncomment if pool does not support JDBC4 :
18
+ # #:connection_alive_sql: 'select 1'
19
+ # # MySQL adapter #configure_connection defaults :
20
+ # # @@SESSION.sql_auto_is_null = 0,
21
+ # # @@SESSION.wait_timeout = 2147483,
22
+ # # @@SESSION.sql_mode = 'STRICT_ALL_TABLES'
23
+ # # ... can be disabled (on AR-JDBC 1.4) using :
24
+ # :configure_connection: false
@@ -12,28 +12,31 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.author = 'Kill Bill core team'
14
14
  s.email = 'killbilling-users@googlegroups.com'
15
- s.homepage = 'http://kill-bill.org'
15
+ s.homepage = 'http://killbill.io'
16
16
 
17
17
  s.files = `git ls-files`.split("\n")
18
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
19
  s.bindir = 'bin'
20
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
- s.require_paths = ["lib"]
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
21
+ s.require_paths = ['lib']
22
22
 
23
23
  s.rdoc_options << '--exclude' << '.'
24
24
 
25
- s.add_dependency 'killbill', '~> 3.0.0'
25
+ s.add_dependency 'killbill', '~> 4.0.0'
26
+
26
27
  s.add_dependency 'sinatra', '~> 1.3.4'
27
- s.add_dependency 'activerecord', '~> 3.2.1'
28
+ s.add_dependency 'activerecord', '~> 4.1.0'
28
29
  if defined?(JRUBY_VERSION)
29
- s.add_dependency 'activerecord-jdbcmysql-adapter', '~> 1.2.9'
30
+ s.add_dependency 'activerecord-bogacs', '~> 0.3'
31
+ s.add_dependency 'activerecord-jdbc-adapter', '~> 1.3'
30
32
  end
31
33
 
32
- s.add_development_dependency 'jbundler', '~> 0.4.1'
34
+ s.add_development_dependency 'jbundler', '~> 0.4.3'
33
35
  s.add_development_dependency 'rake', '>= 10.0.0'
34
36
  s.add_development_dependency 'rspec', '~> 2.12.0'
35
37
  if defined?(JRUBY_VERSION)
36
- s.add_development_dependency 'activerecord-jdbcsqlite3-adapter', '~> 1.2.6'
38
+ s.add_development_dependency 'jdbc-sqlite3', '~> 3.7'
39
+ s.add_development_dependency 'jdbc-mariadb', '~> 1.1'
37
40
  else
38
41
  s.add_development_dependency 'sqlite3', '~> 1.3.7'
39
42
  end
data/killbill.properties CHANGED
@@ -1,3 +1,3 @@
1
- mainClass=Killbill::Hello::HelloWorldPlugin
1
+ mainClass=Killbill::HelloWorld::HelloWorldPlugin
2
2
  require=helloworld
3
3
  pluginType=NOTIFICATION
data/lib/helloworld.rb CHANGED
@@ -21,7 +21,11 @@ module Killbill::HelloWorld
21
21
  end
22
22
 
23
23
  def on_event(event)
24
- @listener.update(event.account_id) if [:ACCOUNT_CREATION, :ACCOUNT_CHANGE].include?(event.event_type)
24
+ if @listener.nil?
25
+ logger.warn "HelloWorldPlugin wasn't started properly - check logs"
26
+ return
27
+ end
28
+ @listener.update(event.account_id, event.tenant_id) if [:ACCOUNT_CREATION, :ACCOUNT_CHANGE].include?(event.event_type)
25
29
  end
26
30
  end
27
31
  end
@@ -7,7 +7,7 @@ module Killbill::HelloWorld
7
7
  def initialize!(conf_dir, kb_apis, logger)
8
8
  # Parse the config file
9
9
  begin
10
- @config = YAML.load_file("#{conf_dir}/helloworld.yml")
10
+ @config = YAML.load_file("#{conf_dir}/helloworld.yml") || {}
11
11
  rescue Errno::ENOENT
12
12
  logger.warn "Unable to find the config file #{conf_dir}/helloworld.yml"
13
13
  return
@@ -15,14 +15,7 @@ module Killbill::HelloWorld
15
15
 
16
16
  logger.log_level = Logger::DEBUG if (@config[:logger] || {})[:debug]
17
17
 
18
- if defined?(JRUBY_VERSION)
19
- # See https://github.com/jruby/activerecord-jdbc-adapter/issues/302
20
- require 'jdbc/mysql'
21
- Jdbc::MySQL.load_driver(:require) if Jdbc::MySQL.respond_to?(:load_driver)
22
- end
23
-
24
- ActiveRecord::Base.establish_connection(@config[:database])
25
- ActiveRecord::Base.logger = logger
18
+ initialize_active_record(@config[:database], logger)
26
19
 
27
20
  @listener = UserListener.new(kb_apis, logger)
28
21
  end
@@ -30,5 +23,56 @@ module Killbill::HelloWorld
30
23
  def initialized?
31
24
  !@listener.nil?
32
25
  end
26
+
27
+ private
28
+
29
+ def initialize_active_record(db_config, logger)
30
+ begin
31
+ require 'active_record'
32
+ require 'arjdbc' if defined?(JRUBY_VERSION)
33
+
34
+ if db_config.nil?
35
+ # Sane defaults for running as a Kill Bill plugin
36
+ db_config = {
37
+ :adapter => :mysql,
38
+ # See KillbillActivator#KILLBILL_OSGI_JDBC_JNDI_NAME
39
+ :jndi => 'killbill/osgi/jdbc',
40
+ # See https://github.com/kares/activerecord-bogacs
41
+ :pool => false,
42
+ # Since AR-JDBC 1.4, to disable session configuration
43
+ :configure_connection => false
44
+ }
45
+ end
46
+
47
+ if defined?(JRUBY_VERSION) && db_config.is_a?(Hash)
48
+ if db_config[:jndi]
49
+ # Lookup the DataSource object once, for performance reasons
50
+ begin
51
+ db_config[:data_source] = Java::JavaxNaming::InitialContext.new.lookup(db_config[:jndi].to_s)
52
+ db_config.delete(:jndi)
53
+ rescue Java::javax.naming.NamingException => e
54
+ # See https://github.com/killbill/killbill-plugin-framework-ruby/issues/39
55
+ logger.warn "Unable to lookup JNDI DataSource (yet?): #{e}" unless defined?(JBUNDLER_CLASSPATH)
56
+ end
57
+ end
58
+
59
+ # we accept a **pool: false** configuration in which case we
60
+ # the built-in pool is replaced with a false one (under JNDI) :
61
+ if db_config[:pool] == false && ( db_config[:jndi] || db_config[:data_source] )
62
+ begin; require 'active_record/bogacs'
63
+ pool_class = ::ActiveRecord::Bogacs::FalsePool
64
+ ::ActiveRecord::ConnectionAdapters::ConnectionHandler.connection_pool_class = pool_class
65
+ rescue LoadError
66
+ db_config.delete(:pool) # do not confuse AR's built-in pool
67
+ logger.warn "ActiveRecord-Bogacs missing, will use default (built-in) AR pool."
68
+ end
69
+ end
70
+ end
71
+ ::ActiveRecord::Base.establish_connection(db_config)
72
+ ::ActiveRecord::Base.logger = logger
73
+ rescue => e
74
+ logger.warn "Unable to establish a database connection: #{e}"
75
+ end
76
+ end
33
77
  end
34
78
  end
@@ -1,5 +1,5 @@
1
1
  module Killbill::HelloWorld
2
2
  class User < ActiveRecord::Base
3
- attr_accessible :kb_account_id
3
+ self.table_name = 'hello_world_users'
4
4
  end
5
5
  end
@@ -5,11 +5,11 @@ module Killbill::HelloWorld
5
5
  @logger = logger
6
6
  end
7
7
 
8
- def update(account_id)
8
+ def update(account_id, tenant_id)
9
9
  user = User.where(:kb_account_id => account_id).first_or_create!
10
10
 
11
11
  # Find the Kill Bill account associated with that account id
12
- kb_account = @kb_apis.account_user_api.get_account_by_id(account_id, @kb_apis.create_context)
12
+ kb_account = @kb_apis.account_user_api.get_account_by_id(account_id, @kb_apis.create_context(tenant_id))
13
13
 
14
14
  @logger.info "Successfully saved #{kb_account.name} (#{kb_account.email})"
15
15
  end
data/pom.xml CHANGED
@@ -25,7 +25,7 @@
25
25
  <groupId>org.kill-bill.billing.plugin.ruby</groupId>
26
26
  <artifactId>helloworld-plugin</artifactId>
27
27
  <packaging>pom</packaging>
28
- <version>0.1.0</version>
28
+ <version>1.0.0</version>
29
29
  <name>helloworld-plugin</name>
30
30
  <url>http://github.com/killbill/killbill-hello-world-plugin</url>
31
31
  <description>Hello World Kill Bill plugin in Ruby </description>
data/release.sh CHANGED
@@ -1,41 +1,61 @@
1
1
  set -e
2
2
 
3
- if [ "GNU" != "$(tar --help | grep GNU | head -1 | awk '{print $1}')" ]; then
4
- echo "Unable to release: make sure to use GNU tar"
3
+ BUNDLE=${BUNDLE-"bundle exec"}
4
+ MVN=${MVN-"mvn"}
5
+
6
+ if [ 'GNU' != "$(tar --help | grep GNU | head -1 | awk '{print $1}')" ]; then
7
+ echo 'Unable to release: make sure to use GNU tar'
5
8
  exit 1
6
9
  fi
7
10
 
8
11
  if $(ruby -e'require "java"'); then
9
12
  # Good
10
- echo "Detected JRuby"
13
+ echo 'Detected JRuby'
11
14
  else
12
- echo "Unable to release: make sure to use JRuby"
15
+ echo 'Unable to release: make sure to use JRuby'
13
16
  exit 1
14
17
  fi
15
18
 
16
19
  VERSION=`grep -E '<version>([0-9]+\.[0-9]+\.[0-9]+)</version>' pom.xml | sed 's/[\t \n]*<version>\(.*\)<\/version>[\t \n]*/\1/'`
17
- if [ "$VERSION" != "$(cat $PWD/VERSION)" ]; then
18
- echo "Unable to release: make sure the versions in pom.xml and VERSION match"
20
+ if [[ -z "$NO_RELEASE" && "$VERSION" != "$(cat $PWD/VERSION)" ]]; then
21
+ echo 'Unable to release: make sure the versions in pom.xml and VERSION match'
19
22
  exit 1
20
23
  fi
21
24
 
22
- echo "Cleaning up"
23
- rake killbill:clean ; rake build
25
+ echo 'Cleaning up'
26
+ $BUNDLE rake killbill:clean
27
+
28
+ echo 'Building gem'
29
+ $BUNDLE rake build
24
30
 
25
- echo "Pushing the gem to Rubygems"
26
- rake release
31
+ if [[ -z "$NO_RELEASE" ]]; then
32
+ echo 'Pushing the gem to Rubygems'
33
+ $BUNDLE rake release
34
+ fi
27
35
 
28
- echo "Building artifact"
29
- rake killbill:package
36
+ echo 'Building artifact'
37
+ $BUNDLE rake killbill:package
30
38
 
31
39
  ARTIFACT="$PWD/pkg/killbill-helloworld-$VERSION.tar.gz"
32
40
  echo "Pushing $ARTIFACT to Maven Central"
33
- mvn gpg:sign-and-deploy-file \
34
- -DgroupId=org.kill-bill.billing.plugin.ruby \
35
- -DartifactId=helloworld-plugin \
36
- -Dversion=$VERSION \
37
- -Dpackaging=tar.gz \
38
- -DrepositoryId=ossrh-releases \
39
- -Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ \
40
- -Dfile=$ARTIFACT \
41
- -DpomFile=pom.xml
41
+
42
+ if [[ -z "$NO_RELEASE" ]]; then
43
+ GOAL=gpg:sign-and-deploy-file
44
+ REPOSITORY_ID=ossrh-releases
45
+ URL=https://oss.sonatype.org/service/local/staging/deploy/maven2/
46
+ else
47
+ GOAL=deploy:deploy-file
48
+ REPOSITORY_ID=sonatype-nexus-snapshots
49
+ URL=https://oss.sonatype.org/content/repositories/snapshots/
50
+ VERSION="$VERSION-SNAPSHOT"
51
+ fi
52
+
53
+ $MVN $GOAL \
54
+ -DgroupId=org.kill-bill.billing.plugin.ruby \
55
+ -DartifactId=helloworld-plugin \
56
+ -Dversion=$VERSION \
57
+ -Dpackaging=tar.gz \
58
+ -DrepositoryId=$REPOSITORY_ID \
59
+ -Durl=$URL \
60
+ -Dfile=$ARTIFACT \
61
+ -DpomFile=pom.xml
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill-helloworld
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kill Bill core team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-13 00:00:00.000000000 Z
11
+ date: 2015-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: killbill
@@ -16,12 +16,12 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 3.0.0
19
+ version: 4.0.0
20
20
  requirement: !ruby/object:Gem::Requirement
21
21
  requirements:
22
22
  - - ~>
23
23
  - !ruby/object:Gem::Version
24
- version: 3.0.0
24
+ version: 4.0.0
25
25
  prerelease: false
26
26
  type: :runtime
27
27
  - !ruby/object:Gem::Dependency
@@ -44,26 +44,40 @@ dependencies:
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: 3.2.1
47
+ version: 4.1.0
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  requirements:
50
50
  - - ~>
51
51
  - !ruby/object:Gem::Version
52
- version: 3.2.1
52
+ version: 4.1.0
53
53
  prerelease: false
54
54
  type: :runtime
55
55
  - !ruby/object:Gem::Dependency
56
- name: activerecord-jdbcmysql-adapter
56
+ name: activerecord-bogacs
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: 1.2.9
61
+ version: '0.3'
62
62
  requirement: !ruby/object:Gem::Requirement
63
63
  requirements:
64
64
  - - ~>
65
65
  - !ruby/object:Gem::Version
66
- version: 1.2.9
66
+ version: '0.3'
67
+ prerelease: false
68
+ type: :runtime
69
+ - !ruby/object:Gem::Dependency
70
+ name: activerecord-jdbc-adapter
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '1.3'
76
+ requirement: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ~>
79
+ - !ruby/object:Gem::Version
80
+ version: '1.3'
67
81
  prerelease: false
68
82
  type: :runtime
69
83
  - !ruby/object:Gem::Dependency
@@ -72,12 +86,12 @@ dependencies:
72
86
  requirements:
73
87
  - - ~>
74
88
  - !ruby/object:Gem::Version
75
- version: 0.4.1
89
+ version: 0.4.3
76
90
  requirement: !ruby/object:Gem::Requirement
77
91
  requirements:
78
92
  - - ~>
79
93
  - !ruby/object:Gem::Version
80
- version: 0.4.1
94
+ version: 0.4.3
81
95
  prerelease: false
82
96
  type: :development
83
97
  - !ruby/object:Gem::Dependency
@@ -109,17 +123,31 @@ dependencies:
109
123
  prerelease: false
110
124
  type: :development
111
125
  - !ruby/object:Gem::Dependency
112
- name: activerecord-jdbcsqlite3-adapter
126
+ name: jdbc-sqlite3
127
+ version_requirements: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ~>
130
+ - !ruby/object:Gem::Version
131
+ version: '3.7'
132
+ requirement: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ~>
135
+ - !ruby/object:Gem::Version
136
+ version: '3.7'
137
+ prerelease: false
138
+ type: :development
139
+ - !ruby/object:Gem::Dependency
140
+ name: jdbc-mariadb
113
141
  version_requirements: !ruby/object:Gem::Requirement
114
142
  requirements:
115
143
  - - ~>
116
144
  - !ruby/object:Gem::Version
117
- version: 1.2.6
145
+ version: '1.1'
118
146
  requirement: !ruby/object:Gem::Requirement
119
147
  requirements:
120
148
  - - ~>
121
149
  - !ruby/object:Gem::Version
122
- version: 1.2.6
150
+ version: '1.1'
123
151
  prerelease: false
124
152
  type: :development
125
153
  description: Hello World Kill Bill plugin in Ruby
@@ -131,7 +159,10 @@ files:
131
159
  - .gitignore
132
160
  - .travis.yml
133
161
  - Gemfile
162
+ - Gemfile.head
163
+ - Gemfile.lock
134
164
  - Jarfile
165
+ - Jarfile.lock
135
166
  - LICENSE
136
167
  - NEWS
137
168
  - README.md
@@ -152,7 +183,7 @@ files:
152
183
  - release.sh
153
184
  - spec/helloworld/user_listener_spec.rb
154
185
  - spec/spec_helper.rb
155
- homepage: http://kill-bill.org
186
+ homepage: http://killbill.io
156
187
  licenses:
157
188
  - Apache License (2.0)
158
189
  metadata: {}
@@ -178,6 +209,4 @@ rubygems_version: 2.1.9
178
209
  signing_key:
179
210
  specification_version: 4
180
211
  summary: Hello World Kill Bill plugin in Ruby
181
- test_files:
182
- - spec/helloworld/user_listener_spec.rb
183
- - spec/spec_helper.rb
212
+ test_files: []