killbill-catalog-ruby-plugin 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +33 -0
- data/.travis.yml +41 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +78 -0
- data/Jarfile +11 -0
- data/Jarfile.lock +61 -0
- data/README.md +6 -0
- data/Rakefile +17 -0
- data/VERSION +1 -0
- data/killbill-catalog-ruby-plugin.gemspec +30 -0
- data/killbill.properties +3 -0
- data/lib/killbill-catalog-ruby-plugin.rb +2 -0
- data/lib/killbill-catalog-ruby-plugin/api.rb +145 -0
- data/pom.xml +37 -0
- data/release.sh +61 -0
- data/spec/killbill-catalog-ruby-plugin/base_plugin_spec.rb +22 -0
- data/spec/spec_helper.rb +9 -0
- metadata +118 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d285835070603d8b81b53d6b0d8c9da694d234bb
|
4
|
+
data.tar.gz: 57e5550dea43effdb5e40dcecb3949e2c18b4f05
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 72ff7f416d62919831953317a23e6bde17a6278b62e9e06c17d23a5f5f6b18db9e7141c125f6154e0f5f61ea2cb58f06aafef5ea8dac013c82e0975abee262ee
|
7
|
+
data.tar.gz: ca253872a50dd10c9f9a9ec0707aab59ff7263a339c4c251339ae2754fe9b7fffaf4c7c0d0a164e47ba025725b3a3ace9c5d499397988142b37a00defde0aae8
|
data/.gitignore
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
*.swp
|
4
|
+
.bundle
|
5
|
+
.config
|
6
|
+
coverage
|
7
|
+
InstalledFiles
|
8
|
+
lib/bundler/man
|
9
|
+
pkg
|
10
|
+
rdoc
|
11
|
+
spec/reports
|
12
|
+
test/tmp
|
13
|
+
test/version_tmp
|
14
|
+
tmp
|
15
|
+
|
16
|
+
# YARD artifacts
|
17
|
+
.yardoc
|
18
|
+
_yardoc
|
19
|
+
doc/
|
20
|
+
|
21
|
+
.jbundler
|
22
|
+
|
23
|
+
.DS_Store
|
24
|
+
|
25
|
+
# Testing database
|
26
|
+
test.db
|
27
|
+
|
28
|
+
target
|
29
|
+
pom.xml.asc
|
30
|
+
|
31
|
+
.idea/
|
32
|
+
|
33
|
+
Gemfile.head.lock
|
data/.travis.yml
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
language: ruby
|
2
|
+
|
3
|
+
sudo: false
|
4
|
+
cache: bundler
|
5
|
+
|
6
|
+
before_script:
|
7
|
+
- bundle exec jbundle install
|
8
|
+
|
9
|
+
script: 'bundle exec rake spec'
|
10
|
+
|
11
|
+
notifications:
|
12
|
+
email:
|
13
|
+
- kill-bill-commits@googlegroups.com
|
14
|
+
|
15
|
+
env:
|
16
|
+
global:
|
17
|
+
- JRUBY_OPTS='-J-Xmx1024M'
|
18
|
+
|
19
|
+
rvm:
|
20
|
+
- jruby-1.7.20
|
21
|
+
- jruby-20mode # latest 1.7.x
|
22
|
+
- jruby-head
|
23
|
+
|
24
|
+
gemfile:
|
25
|
+
- Gemfile
|
26
|
+
- Gemfile.head
|
27
|
+
|
28
|
+
jdk:
|
29
|
+
- openjdk7
|
30
|
+
- oraclejdk7
|
31
|
+
- oraclejdk8
|
32
|
+
|
33
|
+
matrix:
|
34
|
+
allow_failures:
|
35
|
+
- rvm: jruby-head
|
36
|
+
- jdk: oraclejdk8
|
37
|
+
- gemfile: Gemfile.head
|
38
|
+
fast_finish: true
|
39
|
+
|
40
|
+
after_success:
|
41
|
+
- '[ "${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
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
killbill-catalog-ruby-plugin (0.1.0)
|
5
|
+
killbill (~> 7.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
axiom-types (0.1.1)
|
11
|
+
descendants_tracker (~> 0.0.4)
|
12
|
+
ice_nine (~> 0.11.0)
|
13
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
14
|
+
coercible (1.0.0)
|
15
|
+
descendants_tracker (~> 0.0.1)
|
16
|
+
descendants_tracker (0.0.4)
|
17
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
18
|
+
diff-lcs (1.1.3)
|
19
|
+
equalizer (0.0.11)
|
20
|
+
ethon (0.8.0)
|
21
|
+
ffi (>= 1.3.0)
|
22
|
+
ffi (1.9.10-java)
|
23
|
+
ice_nine (0.11.1)
|
24
|
+
jar-dependencies (0.3.1)
|
25
|
+
jbundler (0.9.2)
|
26
|
+
bundler (~> 1.5)
|
27
|
+
jar-dependencies (~> 0.2)
|
28
|
+
maven-tools (~> 1.0.10)
|
29
|
+
ruby-maven (~> 3.3, >= 3.3.3)
|
30
|
+
killbill (7.0.0)
|
31
|
+
rack (>= 1.5.2)
|
32
|
+
sinatra (~> 1.3.4)
|
33
|
+
typhoeus (~> 0.6.9)
|
34
|
+
tzinfo (~> 1.2.0)
|
35
|
+
maven-tools (1.0.13)
|
36
|
+
virtus (~> 1.0)
|
37
|
+
rack (1.6.4)
|
38
|
+
rack-protection (1.5.3)
|
39
|
+
rack
|
40
|
+
rake (10.4.2)
|
41
|
+
rspec (2.12.0)
|
42
|
+
rspec-core (~> 2.12.0)
|
43
|
+
rspec-expectations (~> 2.12.0)
|
44
|
+
rspec-mocks (~> 2.12.0)
|
45
|
+
rspec-core (2.12.2)
|
46
|
+
rspec-expectations (2.12.1)
|
47
|
+
diff-lcs (~> 1.1.3)
|
48
|
+
rspec-mocks (2.12.2)
|
49
|
+
ruby-maven (3.3.8)
|
50
|
+
ruby-maven-libs (~> 3.3.1)
|
51
|
+
ruby-maven-libs (3.3.3)
|
52
|
+
sinatra (1.3.6)
|
53
|
+
rack (~> 1.4)
|
54
|
+
rack-protection (~> 1.3)
|
55
|
+
tilt (~> 1.3, >= 1.3.3)
|
56
|
+
thread_safe (0.3.5-java)
|
57
|
+
tilt (1.4.1)
|
58
|
+
typhoeus (0.6.9)
|
59
|
+
ethon (>= 0.7.1)
|
60
|
+
tzinfo (1.2.2)
|
61
|
+
thread_safe (~> 0.1)
|
62
|
+
virtus (1.0.5)
|
63
|
+
axiom-types (~> 0.1)
|
64
|
+
coercible (~> 1.0)
|
65
|
+
descendants_tracker (~> 0.0, >= 0.0.3)
|
66
|
+
equalizer (~> 0.0, >= 0.0.9)
|
67
|
+
|
68
|
+
PLATFORMS
|
69
|
+
java
|
70
|
+
|
71
|
+
DEPENDENCIES
|
72
|
+
jbundler (~> 0.9.2)
|
73
|
+
killbill-catalog-ruby-plugin!
|
74
|
+
rake (>= 10.0.0)
|
75
|
+
rspec (~> 2.12.0)
|
76
|
+
|
77
|
+
BUNDLED WITH
|
78
|
+
1.10.6
|
data/Jarfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
jar 'org.kill-bill.billing:killbill-api', '0.32'
|
2
|
+
jar 'org.kill-bill.billing.plugin:killbill-plugin-api-currency', '0.18'
|
3
|
+
jar 'org.kill-bill.billing.plugin:killbill-plugin-api-invoice', '0.18'
|
4
|
+
jar 'org.kill-bill.billing.plugin:killbill-plugin-api-notification', '0.18'
|
5
|
+
jar 'org.kill-bill.billing.plugin:killbill-plugin-api-payment', '0.18'
|
6
|
+
jar 'org.kill-bill.billing.plugin:killbill-plugin-api-control', '0.18'
|
7
|
+
jar 'org.kill-bill.billing.plugin:killbill-plugin-api-catalog', '0.18'
|
8
|
+
jar 'org.kill-bill.billing.plugin:killbill-plugin-api-entitlement', '0.18'
|
9
|
+
jar 'org.kill-bill.billing:killbill-util:tests', '0.15.10'
|
10
|
+
jar 'org.mockito:mockito-all', '1.10.19'
|
11
|
+
jar 'javax.servlet:javax.servlet-api', '3.1.0'
|
data/Jarfile.lock
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
---
|
2
|
+
:runtime:
|
3
|
+
- io.dropwizard.metrics:metrics-core:jar:3.1.1
|
4
|
+
- org.kill-bill.billing.plugin:killbill-plugin-api-catalog:jar:0.18
|
5
|
+
- com.fasterxml.jackson.core:jackson-core:jar:2.4.3
|
6
|
+
- joda-time:joda-time:jar:2.3
|
7
|
+
- org.weakref:jmxutils:jar:1.18
|
8
|
+
- org.kill-bill.billing.plugin:killbill-plugin-api-notification:jar:0.18
|
9
|
+
- commons-beanutils:commons-beanutils:jar:1.8.3
|
10
|
+
- org.kill-bill.billing:killbill-internal-api:jar:0.15.10
|
11
|
+
- org.kill-bill.commons:killbill-xmlloader:jar:0.11
|
12
|
+
- org.kill-bill.billing.plugin:killbill-plugin-api-entitlement:jar:0.18
|
13
|
+
- com.google.inject:guice:jar:3.0
|
14
|
+
- org.osgi:org.osgi.core:jar:5.0.0
|
15
|
+
- org.slf4j:slf4j-api:jar:1.7.12
|
16
|
+
- com.samskivert:jmustache:jar:1.5
|
17
|
+
- org.kill-bill.billing:killbill-util:jar:tests:0.15.10
|
18
|
+
- org.kill-bill.billing.plugin:killbill-plugin-api-currency:jar:0.18
|
19
|
+
- org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4:jar:1.16
|
20
|
+
- com.h2database:h2:jar:1.4.186
|
21
|
+
- javax.activation:activation:jar:1.1
|
22
|
+
- org.skife.config:config-magic:jar:0.14
|
23
|
+
- com.fasterxml.jackson.dataformat:jackson-dataformat-csv:jar:2.4.3
|
24
|
+
- org.kill-bill.billing.plugin:killbill-plugin-api-control:jar:0.18
|
25
|
+
- org.apache.commons:commons-email:jar:1.2
|
26
|
+
- org.mockito:mockito-all:jar:1.10.19
|
27
|
+
- antlr:antlr:jar:2.7.7
|
28
|
+
- aopalliance:aopalliance:jar:1.0
|
29
|
+
- com.fasterxml.jackson.core:jackson-annotations:jar:2.4.3
|
30
|
+
- org.antlr:stringtemplate:jar:3.2.1
|
31
|
+
- org.kill-bill.commons:killbill-clock:jar:0.11
|
32
|
+
- javax.mail:mail:jar:1.4.1
|
33
|
+
- org.kill-bill.billing:killbill-platform-base:jar:0.15
|
34
|
+
- io.dropwizard.metrics:metrics-ehcache:jar:3.1.1
|
35
|
+
- org.slf4j:jcl-over-slf4j:jar:1.7.12
|
36
|
+
- org.jdbi:jdbi:jar:2.62
|
37
|
+
- org.kill-bill.billing:killbill-platform-api:jar:0.15
|
38
|
+
- org.kill-bill.billing:killbill-platform-osgi:jar:0.15
|
39
|
+
- org.apache.felix:org.apache.felix.framework:jar:4.4.1
|
40
|
+
- org.joda:joda-money:jar:0.9
|
41
|
+
- org.kill-bill.commons:killbill-jdbi:jar:0.11
|
42
|
+
- org.kill-bill.commons:killbill-embeddeddb-common:jar:0.11
|
43
|
+
- org.apache.shiro:shiro-core:jar:1.2.3
|
44
|
+
- org.kill-bill.billing:killbill-platform-osgi-api:jar:0.15
|
45
|
+
- org.kill-bill.billing.plugin:killbill-plugin-api-payment:jar:0.18
|
46
|
+
- com.fasterxml.jackson.core:jackson-databind:jar:2.4.3
|
47
|
+
- com.google.guava:guava:jar:r09
|
48
|
+
- org.kill-bill.commons:killbill-locker:jar:0.11
|
49
|
+
- org.osgi:org.osgi.compendium:jar:5.0.0
|
50
|
+
- org.kill-bill.commons:killbill-queue:jar:0.11
|
51
|
+
- org.kill-bill.commons:killbill-concurrent:jar:0.11
|
52
|
+
- javax.servlet:javax.servlet-api:jar:3.1.0
|
53
|
+
- org.apache.shiro:shiro-ehcache:jar:1.2.3
|
54
|
+
- javax.inject:javax.inject:jar:1
|
55
|
+
- com.fasterxml.jackson.datatype:jackson-datatype-joda:jar:2.4.3
|
56
|
+
- com.google.inject.extensions:guice-multibindings:jar:3.0
|
57
|
+
- net.sf.ehcache:ehcache:jar:2.9.1
|
58
|
+
- org.kill-bill.billing.plugin:killbill-plugin-api-invoice:jar:0.18
|
59
|
+
- org.kill-bill.billing:killbill-api:jar:0.32
|
60
|
+
- org.apache.shiro:shiro-guice:jar:1.2.3
|
61
|
+
- com.google.code.findbugs:annotations:jar:3.0.0
|
data/README.md
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
killbill-catalog-ruby-plugin
|
2
|
+
============================
|
3
|
+
|
4
|
+
Plugin to highlight the use of the CatalogPluginApi from a ruby plugin.
|
5
|
+
|
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%22killbill-catalog-ruby-plugin%22) with coordinates `org.kill-bill.billing.plugin.ruby:killbill-catalog-ruby-plugin`.
|
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
|
3
|
+
# Install tasks to build and release the plugin
|
4
|
+
require 'bundler/setup'
|
5
|
+
Bundler::GemHelper.install_tasks
|
6
|
+
|
7
|
+
# Install test tasks
|
8
|
+
require 'rspec/core/rake_task'
|
9
|
+
desc "Run RSpec"
|
10
|
+
RSpec::Core::RakeTask.new
|
11
|
+
|
12
|
+
# Install tasks to package the plugin for Killbill
|
13
|
+
require 'killbill/rake_task'
|
14
|
+
Killbill::PluginHelper.install_tasks
|
15
|
+
|
16
|
+
# Run tests by default
|
17
|
+
task :default => :spec
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,30 @@
|
|
1
|
+
version = File.read(File.expand_path('../VERSION', __FILE__)).strip
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'killbill-catalog-ruby-plugin'
|
5
|
+
s.version = version
|
6
|
+
s.summary = 'Catalog Plugin'
|
7
|
+
s.description = 'Kill Bill Plugin to illustrate the use of the Catalog Plugin api.'
|
8
|
+
|
9
|
+
s.required_ruby_version = '>= 1.9.3'
|
10
|
+
|
11
|
+
s.license = 'Apache License (2.0)'
|
12
|
+
|
13
|
+
s.author = 'Kill Bill core team'
|
14
|
+
s.email = 'killbilling-users@googlegroups.com'
|
15
|
+
s.homepage = 'http://killbill.io'
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.bindir = 'bin'
|
20
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
|
23
|
+
s.rdoc_options << '--exclude' << '.'
|
24
|
+
|
25
|
+
s.add_dependency 'killbill', '~> 7.0'
|
26
|
+
|
27
|
+
s.add_development_dependency 'jbundler', '~> 0.9.2'
|
28
|
+
s.add_development_dependency 'rake', '>= 10.0.0'
|
29
|
+
s.add_development_dependency 'rspec', '~> 2.12.0'
|
30
|
+
end
|
data/killbill.properties
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module CatalogControlPluginModule
|
4
|
+
|
5
|
+
class CatalogControlPlugin < Killbill::Plugin::CatalogPluginApi
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
#
|
12
|
+
# Will build a dummy plugin catalog with one version, and one plan
|
13
|
+
# (The goal is to verify all the plumbing is working and Kill Bill can create a subscription based on that plugin catalog)
|
14
|
+
#
|
15
|
+
def get_versioned_plugin_catalog(properties, context)
|
16
|
+
standalone_catalogs = create_standalone_catalogs
|
17
|
+
version_catalog = create_versioned_plugin_catalog(standalone_catalogs)
|
18
|
+
version_catalog
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def create_versioned_plugin_catalog(standalone_catalogs)
|
25
|
+
version_catalog = Killbill::Plugin::Model::VersionedPluginCatalog.new
|
26
|
+
version_catalog.catalog_name = 'demo'
|
27
|
+
version_catalog.recurring_billing_mode = :IN_ARREAR
|
28
|
+
version_catalog.standalone_plugin_catalogs = standalone_catalogs
|
29
|
+
version_catalog
|
30
|
+
end
|
31
|
+
|
32
|
+
def create_standalone_catalogs
|
33
|
+
standalone_catalogs = []
|
34
|
+
product = create_product
|
35
|
+
phase = create_phase
|
36
|
+
plan = create_plan(product, phase)
|
37
|
+
pricelist = create_price_list([plan])
|
38
|
+
|
39
|
+
catalog = Killbill::Plugin::Model::StandalonePluginCatalog.new
|
40
|
+
catalog.effective_date = DateTime.parse("2012-01-20T07:30:42.000Z").iso8601(3)
|
41
|
+
catalog.currencies = [:USD]
|
42
|
+
catalog.units = []
|
43
|
+
catalog.products = [product]
|
44
|
+
catalog.plans = [plan]
|
45
|
+
catalog.default_price_list = pricelist
|
46
|
+
catalog.children_price_list = []
|
47
|
+
catalog.plan_rules = Killbill::Plugin::Model::PlanRules.new
|
48
|
+
standalone_catalogs << catalog
|
49
|
+
standalone_catalogs
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
def create_rules
|
54
|
+
p = Killbill::Plugin::Model::PlanRules.new
|
55
|
+
p.case_change_plan_policy = []
|
56
|
+
p.case_change_plan_alignment = []
|
57
|
+
p.case_cancel_policy = []
|
58
|
+
p.case_create_alignment = []
|
59
|
+
p.case_billing_alignment = []
|
60
|
+
p.case_price_list = []
|
61
|
+
p
|
62
|
+
end
|
63
|
+
|
64
|
+
def create_price_list(plans)
|
65
|
+
p = Killbill::Plugin::Model::PriceList.new
|
66
|
+
p.name = 'DEFAULT'
|
67
|
+
p.is_retired = false
|
68
|
+
p.plans = plans
|
69
|
+
p
|
70
|
+
end
|
71
|
+
|
72
|
+
def create_product
|
73
|
+
p = Killbill::Plugin::Model::Product.new
|
74
|
+
p.name = 'Gold'
|
75
|
+
p.is_retired = false
|
76
|
+
p.available = []
|
77
|
+
p.included = []
|
78
|
+
p.category = :BASE
|
79
|
+
#p.catalog_name =
|
80
|
+
p.limits = []
|
81
|
+
p
|
82
|
+
end
|
83
|
+
|
84
|
+
def create_plan(product, phase)
|
85
|
+
p = Killbill::Plugin::Model::Plan.new
|
86
|
+
p.initial_phases = []
|
87
|
+
p.product = product
|
88
|
+
p.name = 'gold-monthly'
|
89
|
+
p.is_retired = false
|
90
|
+
p.final_phase = phase
|
91
|
+
p.all_phases = [phase]
|
92
|
+
p.recurring_billing_period = :MONTHLY
|
93
|
+
p.plans_allowed_in_bundle = -1
|
94
|
+
p
|
95
|
+
end
|
96
|
+
|
97
|
+
def create_phase
|
98
|
+
p = Killbill::Plugin::Model::PlanPhase.new
|
99
|
+
tmp_recurring = create_recurring
|
100
|
+
tmp_duration = create_duration
|
101
|
+
p.fixed = nil
|
102
|
+
p.recurring = tmp_recurring
|
103
|
+
p.usages = []
|
104
|
+
p.name = 'gold-monthly-evergreen'
|
105
|
+
p.duration = tmp_duration
|
106
|
+
p.phase_type = :EVERGREEN
|
107
|
+
p
|
108
|
+
end
|
109
|
+
|
110
|
+
def create_recurring
|
111
|
+
p = Killbill::Plugin::Model::Recurring.new
|
112
|
+
tmp_international_price = create_international_price
|
113
|
+
p.billing_period = :MONTHLY
|
114
|
+
p.recurring_price = tmp_international_price
|
115
|
+
p
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
def create_international_price
|
120
|
+
p = Killbill::Plugin::Model::InternationalPrice.new
|
121
|
+
tmp_prices = create_prices
|
122
|
+
p.prices = tmp_prices
|
123
|
+
p.is_zero = false
|
124
|
+
p
|
125
|
+
end
|
126
|
+
|
127
|
+
def create_prices
|
128
|
+
# :currency, :value
|
129
|
+
prices = []
|
130
|
+
p = Killbill::Plugin::Model::Price.new
|
131
|
+
p.currency = :USD
|
132
|
+
p.value = BigDecimal.new('13.6')
|
133
|
+
prices << p
|
134
|
+
prices
|
135
|
+
end
|
136
|
+
|
137
|
+
def create_duration
|
138
|
+
p = Killbill::Plugin::Model::Duration.new
|
139
|
+
p.number = 1
|
140
|
+
p.unit = :MONTHS
|
141
|
+
p
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
145
|
+
end
|
data/pom.xml
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!--
|
3
|
+
~ Copyright 2014-2015 Groupon, Inc
|
4
|
+
~ Copyright 2014-2015 The Billing Project, LLC
|
5
|
+
~
|
6
|
+
~ The Billing Project licenses this file to you under the Apache License, version 2.0
|
7
|
+
~ (the "License"); you may not use this file except in compliance with the
|
8
|
+
~ License. You may obtain a copy of the License at:
|
9
|
+
~
|
10
|
+
~ http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
~
|
12
|
+
~ Unless required by applicable law or agreed to in writing, software
|
13
|
+
~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
14
|
+
~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
15
|
+
~ License for the specific language governing permissions and limitations
|
16
|
+
~ under the License.
|
17
|
+
-->
|
18
|
+
|
19
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
20
|
+
<parent>
|
21
|
+
<groupId>org.sonatype.oss</groupId>
|
22
|
+
<artifactId>oss-parent</artifactId>
|
23
|
+
<version>5</version>
|
24
|
+
</parent>
|
25
|
+
<modelVersion>4.0.0</modelVersion>
|
26
|
+
<groupId>org.kill-bill.billing.plugin.ruby</groupId>
|
27
|
+
<artifactId>killbill-catalog-ruby-plugin</artifactId>
|
28
|
+
<packaging>pom</packaging>
|
29
|
+
<version>0.1.0</version>
|
30
|
+
<name>killbill-catalog-ruby-plugin</name>
|
31
|
+
<description></description>
|
32
|
+
<scm>
|
33
|
+
<connection>scm:git:git://github.com/killbill/killbill-catalog-ruby-plugin.git</connection>
|
34
|
+
<url>https://github.com/killbill/killbill-catalog-ruby-plugin/</url>
|
35
|
+
<developerConnection>scm:git:git@github.com:killbill/killbill-catalog-ruby-plugin.git</developerConnection>
|
36
|
+
</scm>
|
37
|
+
</project>
|
data/release.sh
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
set -e
|
2
|
+
|
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'
|
8
|
+
exit 1
|
9
|
+
fi
|
10
|
+
|
11
|
+
if $(ruby -e'require "java"'); then
|
12
|
+
# Good
|
13
|
+
echo 'Detected JRuby'
|
14
|
+
else
|
15
|
+
echo 'Unable to release: make sure to use JRuby'
|
16
|
+
exit 1
|
17
|
+
fi
|
18
|
+
|
19
|
+
VERSION=`grep -E '<version>([0-9]+\.[0-9]+\.[0-9]+)</version>' pom.xml | sed 's/[\t \n]*<version>\(.*\)<\/version>[\t \n]*/\1/'`
|
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'
|
22
|
+
exit 1
|
23
|
+
fi
|
24
|
+
|
25
|
+
echo 'Cleaning up'
|
26
|
+
$BUNDLE rake killbill:clean
|
27
|
+
|
28
|
+
echo 'Building gem'
|
29
|
+
$BUNDLE rake build
|
30
|
+
|
31
|
+
if [[ -z "$NO_RELEASE" ]]; then
|
32
|
+
echo 'Pushing the gem to Rubygems'
|
33
|
+
$BUNDLE rake release
|
34
|
+
fi
|
35
|
+
|
36
|
+
echo 'Building artifact'
|
37
|
+
$BUNDLE rake killbill:package
|
38
|
+
|
39
|
+
ARTIFACT="$PWD/pkg/killbill-catalog-ruby-$VERSION.tar.gz"
|
40
|
+
echo "Pushing $ARTIFACT to Maven Central"
|
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=killbill-catalog-ruby-plugin \
|
56
|
+
-Dversion=$VERSION \
|
57
|
+
-Dpackaging=tar.gz \
|
58
|
+
-DrepositoryId=$REPOSITORY_ID \
|
59
|
+
-Durl=$URL \
|
60
|
+
-Dfile=$ARTIFACT \
|
61
|
+
-DpomFile=pom.xml
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'logger'
|
3
|
+
|
4
|
+
require 'killbill-catalog-ruby-plugin'
|
5
|
+
|
6
|
+
describe CatalogControlPluginModule::CatalogControlPlugin do
|
7
|
+
before(:each) do
|
8
|
+
|
9
|
+
kb_apis = Killbill::Plugin::KillbillApi.new("killbill-catalog-ruby-plugin", {})
|
10
|
+
@plugin = CatalogControlPluginModule::CatalogControlPlugin.new
|
11
|
+
@plugin.logger = Logger.new(STDOUT)
|
12
|
+
@plugin.kb_apis = kb_apis
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should start and stop correctly" do
|
17
|
+
@plugin.start_plugin
|
18
|
+
@plugin.stop_plugin
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: killbill-catalog-ruby-plugin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kill Bill core team
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: killbill
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '7.0'
|
20
|
+
requirement: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ~>
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '7.0'
|
25
|
+
prerelease: false
|
26
|
+
type: :runtime
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: jbundler
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.9.2
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ~>
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: 0.9.2
|
39
|
+
prerelease: false
|
40
|
+
type: :development
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 10.0.0
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 10.0.0
|
53
|
+
prerelease: false
|
54
|
+
type: :development
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.12.0
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ~>
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 2.12.0
|
67
|
+
prerelease: false
|
68
|
+
type: :development
|
69
|
+
description: Kill Bill Plugin to illustrate the use of the Catalog Plugin api.
|
70
|
+
email: killbilling-users@googlegroups.com
|
71
|
+
executables: []
|
72
|
+
extensions: []
|
73
|
+
extra_rdoc_files: []
|
74
|
+
files:
|
75
|
+
- .gitignore
|
76
|
+
- .travis.yml
|
77
|
+
- Gemfile
|
78
|
+
- Gemfile.lock
|
79
|
+
- Jarfile
|
80
|
+
- Jarfile.lock
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- VERSION
|
84
|
+
- killbill-catalog-ruby-plugin.gemspec
|
85
|
+
- killbill.properties
|
86
|
+
- lib/killbill-catalog-ruby-plugin.rb
|
87
|
+
- lib/killbill-catalog-ruby-plugin/api.rb
|
88
|
+
- pom.xml
|
89
|
+
- release.sh
|
90
|
+
- spec/killbill-catalog-ruby-plugin/base_plugin_spec.rb
|
91
|
+
- spec/spec_helper.rb
|
92
|
+
homepage: http://killbill.io
|
93
|
+
licenses:
|
94
|
+
- Apache License (2.0)
|
95
|
+
metadata: {}
|
96
|
+
post_install_message:
|
97
|
+
rdoc_options:
|
98
|
+
- --exclude
|
99
|
+
- .
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: 1.9.3
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
requirements: []
|
113
|
+
rubyforge_project:
|
114
|
+
rubygems_version: 2.1.9
|
115
|
+
signing_key:
|
116
|
+
specification_version: 4
|
117
|
+
summary: Catalog Plugin
|
118
|
+
test_files: []
|