paid_up 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +2 -0
  3. data/.travis.yml +3 -0
  4. data/Gemfile +46 -0
  5. data/LICENSE.txt +20 -0
  6. data/MIT-LICENSE +20 -0
  7. data/README.md +64 -0
  8. data/Rakefile +48 -0
  9. data/VERSION +1 -0
  10. data/app/controllers/paid_up/paid_up_controller.rb +12 -0
  11. data/app/controllers/paid_up/plans_controller.rb +7 -0
  12. data/app/controllers/paid_up/subscriptions_controller.rb +37 -0
  13. data/app/helpers/paid_up/features_helper.rb +65 -0
  14. data/app/helpers/paid_up/paid_up_helper.rb +14 -0
  15. data/app/helpers/paid_up/plans_helper.rb +53 -0
  16. data/app/helpers/paid_up/subscriptions_helper.rb +21 -0
  17. data/app/models/ability.rb +37 -0
  18. data/app/models/paid_up/feature.rb +19 -0
  19. data/app/models/paid_up/features_plan.rb +14 -0
  20. data/app/models/paid_up/plan.rb +99 -0
  21. data/app/views/devise/confirmations/new.html.haml +13 -0
  22. data/app/views/devise/passwords/edit.html.haml +19 -0
  23. data/app/views/devise/passwords/new.html.haml +14 -0
  24. data/app/views/devise/registrations/_new_form.html.haml +23 -0
  25. data/app/views/devise/registrations/edit.html.haml +39 -0
  26. data/app/views/devise/registrations/new.html.haml +11 -0
  27. data/app/views/devise/sessions/_new_form.html.haml +21 -0
  28. data/app/views/devise/sessions/new.html.haml +11 -0
  29. data/app/views/devise/shared/_links.html.haml +14 -0
  30. data/app/views/devise/unlocks/new.html.haml +14 -0
  31. data/app/views/paid_up/features/_abilities_table.html.haml +22 -0
  32. data/app/views/paid_up/features/_table.html.haml +16 -0
  33. data/app/views/paid_up/plans/index.html.haml +18 -0
  34. data/app/views/paid_up/subscriptions/index.html.haml +16 -0
  35. data/app/views/paid_up/subscriptions/new.html.haml +101 -0
  36. data/bin/rails +12 -0
  37. data/config/initializers/stripe.rb +6 -0
  38. data/config/locales/en.yml +85 -0
  39. data/config/routes.rb +7 -0
  40. data/coverage/.last_run.json +5 -0
  41. data/coverage/.resultset.json +1488 -0
  42. data/coverage/.resultset.json.lock +0 -0
  43. data/db/migrate/20150407105900_create_paid_up_features_plans_table.rb +9 -0
  44. data/db/migrate/20150407110100_create_paid_up_features_table.rb +11 -0
  45. data/db/migrate/20150407110101_create_paid_up_plans_table.rb +14 -0
  46. data/lib/generators/paid_up/install/install_generator.rb +59 -0
  47. data/lib/generators/paid_up/install/templates/initializer.rb.erb +5 -0
  48. data/lib/generators/paid_up/utils.rb +16 -0
  49. data/lib/paid_up/configuration.rb +22 -0
  50. data/lib/paid_up/engine.rb +17 -0
  51. data/lib/paid_up/integer.rb +9 -0
  52. data/lib/paid_up/localization.rb +31 -0
  53. data/lib/paid_up/mixins.rb +139 -0
  54. data/lib/paid_up/railtie.rb +4 -0
  55. data/lib/paid_up/stripe_extensions.rb +17 -0
  56. data/lib/paid_up/table_validator.rb +9 -0
  57. data/lib/paid_up/unlimited.rb +17 -0
  58. data/lib/paid_up/version.rb +7 -0
  59. data/lib/paid_up.rb +27 -0
  60. data/paid_up.gemspec +248 -0
  61. data/spec/controllers/paid_up/plans_spec.rb +26 -0
  62. data/spec/controllers/paid_up/subscriptions_spec.rb +187 -0
  63. data/spec/dummy/README.rdoc +28 -0
  64. data/spec/dummy/Rakefile +6 -0
  65. data/spec/dummy/app/assets/javascripts/application.js +16 -0
  66. data/spec/dummy/app/assets/stylesheets/application.css.scss +16 -0
  67. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  68. data/spec/dummy/app/models/group.rb +3 -0
  69. data/spec/dummy/app/models/user.rb +9 -0
  70. data/spec/dummy/app/views/layouts/application.html.haml +31 -0
  71. data/spec/dummy/app/views/pages/index.html.haml +1 -0
  72. data/spec/dummy/bin/bundle +3 -0
  73. data/spec/dummy/bin/rails +4 -0
  74. data/spec/dummy/bin/rake +4 -0
  75. data/spec/dummy/bin/setup +29 -0
  76. data/spec/dummy/config/application.rb +32 -0
  77. data/spec/dummy/config/boot.rb +5 -0
  78. data/spec/dummy/config/database.yml +25 -0
  79. data/spec/dummy/config/environment.rb +5 -0
  80. data/spec/dummy/config/environments/development.rb +46 -0
  81. data/spec/dummy/config/environments/production.rb +79 -0
  82. data/spec/dummy/config/environments/test.rb +45 -0
  83. data/spec/dummy/config/initializers/assets.rb +11 -0
  84. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  85. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  86. data/spec/dummy/config/initializers/devise.rb +259 -0
  87. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  88. data/spec/dummy/config/initializers/high_voltage.rb +3 -0
  89. data/spec/dummy/config/initializers/inflections.rb +16 -0
  90. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  91. data/spec/dummy/config/initializers/paid_up.rb +5 -0
  92. data/spec/dummy/config/initializers/session_store.rb +3 -0
  93. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  94. data/spec/dummy/config/locales/devise.en.yml +60 -0
  95. data/spec/dummy/config/locales/en.yml +23 -0
  96. data/spec/dummy/config/routes.rb +4 -0
  97. data/spec/dummy/config/secrets.yml +22 -0
  98. data/spec/dummy/config.ru +4 -0
  99. data/spec/dummy/db/development.sqlite3 +0 -0
  100. data/spec/dummy/db/migrate/20150406154440_create_users_table.rb +7 -0
  101. data/spec/dummy/db/migrate/20150517175135_create_groups_table.rb +11 -0
  102. data/spec/dummy/db/migrate/20150518000915_add_devise_to_users.rb +49 -0
  103. data/spec/dummy/db/migrate/20150518000917_create_paid_up_features_plans_table.paid_up.rb +10 -0
  104. data/spec/dummy/db/migrate/20150518000918_create_paid_up_features_table.paid_up.rb +12 -0
  105. data/spec/dummy/db/migrate/20150518000919_create_paid_up_plans_table.paid_up.rb +15 -0
  106. data/spec/dummy/db/migrate/20150518000920_add_stripe_id_column_to_user.rb +6 -0
  107. data/spec/dummy/db/schema.rb +75 -0
  108. data/spec/dummy/db/seeds/features.seeds.rb +19 -0
  109. data/spec/dummy/db/seeds/features_plans.seeds.rb +51 -0
  110. data/spec/dummy/db/seeds/plans.seeds.rb +91 -0
  111. data/spec/dummy/db/seeds.rb +0 -0
  112. data/spec/dummy/db/test.sqlite3 +0 -0
  113. data/spec/dummy/lib/assets/.keep +0 -0
  114. data/spec/dummy/log/.keep +0 -0
  115. data/spec/dummy/log/development.log +108393 -0
  116. data/spec/dummy/public/404.html +67 -0
  117. data/spec/dummy/public/422.html +67 -0
  118. data/spec/dummy/public/500.html +66 -0
  119. data/spec/dummy/public/assets/.sprockets-manifest-34b01376fc56586f4f4fd19e7b1c0e35.json +1 -0
  120. data/spec/dummy/public/assets/application-27f004bb902952dbbaad25f0f28c312f29ffee315c94fa51dea6b5ec6dc993e6.css +13 -0
  121. data/spec/dummy/public/assets/application-3a226fbacd7ba9a2b9f7972fafdd7b2486c34707d96a60c26f3bbe4579c29ca6.js +116 -0
  122. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-13634da87d9e23f8c3ed9108ce1724d183a39ad072e73e1b3d8cbf646d2d0407.eot +0 -0
  123. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-42f60659d265c1a3c30f9fa42abcbb56bd4a53af4d83d316d6dd7a36903c43e5.svg +288 -0
  124. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-a26394f7ede100ca118eff2eda08596275a9839b959c226e15439557a5a80742.woff +0 -0
  125. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-e395044093757d82afcb138957d06a1ea9361bdcf0b442d06a18a8051af57456.ttf +0 -0
  126. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-fe185d11a49676890d47bb783312a0cda5a44c4039214094e7957b4c040ef11c.woff2 +0 -0
  127. data/spec/dummy/public/favicon.ico +0 -0
  128. data/spec/dummy/test/controllers/plans_controller_controller_test.rb +7 -0
  129. data/spec/factories/feature.rb +7 -0
  130. data/spec/factories/features_plan.rb +7 -0
  131. data/spec/factories/plan.rb +7 -0
  132. data/spec/factories/user.rb +7 -0
  133. data/spec/models/paid_up/feature_spec.rb +21 -0
  134. data/spec/models/paid_up/features_plan_spec.rb +7 -0
  135. data/spec/models/paid_up/plan_spec.rb +156 -0
  136. data/spec/models/user_spec.rb +304 -0
  137. data/spec/paid_up_spec.rb +7 -0
  138. data/spec/rails_helper.rb +65 -0
  139. data/spec/routing/paid_up/plans_spec.rb +11 -0
  140. data/spec/routing/paid_up/subscription_spec.rb +23 -0
  141. data/spec/spec_helper.rb +87 -0
  142. data/spec/support/controller_macros.rb +12 -0
  143. data/spec/support/factory_girl.rb +3 -0
  144. data/spec/support/plans_and_features.rb +209 -0
  145. data/spec/support/stripe.rb +23 -0
  146. data/spec/support/subscribers.rb +44 -0
  147. data/spec/views/paid_up/plans_spec.rb +54 -0
  148. data/spec/views/paid_up/subscriptions_spec.rb +58 -0
  149. metadata +488 -0
File without changes
@@ -0,0 +1,9 @@
1
+ class CreatePaidUpFeaturesPlansTable < ActiveRecord::Migration
2
+ def change
3
+ create_table :paid_up_features_plans do |t|
4
+ t.references :feature, index: true, foreign_key: true
5
+ t.references :plan, index: true, foreign_key: true
6
+ t.integer :setting
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ class CreatePaidUpFeaturesTable < ActiveRecord::Migration
2
+ def change
3
+ create_table :paid_up_features do |t|
4
+ t.string :name
5
+ t.string :title
6
+ t.string :setting_type
7
+ t.text :description
8
+ end
9
+ add_index :paid_up_features, :name, :unique => true
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ class CreatePaidUpPlansTable < ActiveRecord::Migration
2
+ def change
3
+ create_table :paid_up_plans do |t|
4
+ t.string :stripe_id
5
+ t.string :name
6
+ t.text :description
7
+ t.integer :sort_order
8
+
9
+ t.timestamps
10
+ end
11
+ add_index :paid_up_plans, :name, :unique => true
12
+ add_index :paid_up_plans, :stripe_id, :unique => true
13
+ end
14
+ end
@@ -0,0 +1,59 @@
1
+ module PaidUp
2
+ class InstallGenerator < Rails::Generators::Base
3
+ argument :user_model_name, :type => :string, :default => "User"
4
+ source_root File.expand_path("../templates", __FILE__)
5
+ require File.expand_path('../../utils', __FILE__)
6
+ include Generators::Utils
7
+ include Rails::Generators::Migration
8
+
9
+ def hello
10
+ output "PaidUp Installer will now install itself", :magenta
11
+ end
12
+
13
+ # all public methods in here will be run in order
14
+
15
+ def install_devise
16
+ output "To start with, Devise is used to authenticate users. No need to install it separately, I'll do that now.", :magenta
17
+ generate("devise:install")
18
+ generate("devise User")
19
+ end
20
+
21
+ def add_initializer
22
+ output "Next, you'll need an initializer. This is where you put your configuration options.", :magenta
23
+ template "initializer.rb.erb", "config/initializers/paid_up.rb"
24
+ end
25
+
26
+ def add_migrations
27
+ output "Next come migrations.", :magenta
28
+ rake 'paid_up:install:migrations'
29
+ unless self.class.migration_exists?('db/migrate', 'add_customer_stripe_id.rb')
30
+ generate("migration AddStripeIdColumnToUser stripe_id:string:index")
31
+ end
32
+ end
33
+
34
+ def add_to_model
35
+ output "Adding PaidUp to your User model", :magenta
36
+ gsub_file "app/models/user.rb", /^\n subscriber$/, ''
37
+ inject_into_file "app/models/user.rb", "\n subscriber", after: "class User < ActiveRecord::Base"
38
+ end
39
+
40
+ def add_route
41
+ output "Adding PaidUp to your routes.rb file", :magenta
42
+ gsub_file "config/routes.rb", /mount PaidUp::Engine => '\/.*', :as => 'paid_up'/, ''
43
+ route("mount PaidUp::Engine => '/', :as => 'paid_up'")
44
+ end
45
+
46
+ def self.next_migration_number(dirname)
47
+ if ActiveRecord::Base.timestamped_migrations
48
+ unless @prev_migration_nr
49
+ @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
50
+ else
51
+ @prev_migration_nr += 1
52
+ end
53
+ @prev_migration_nr.to_s
54
+ else
55
+ "%.3d" % (current_migration_number(dirname) + 1)
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,5 @@
1
+ PaidUp.configure do |config|
2
+ config.anonymous_customer_stripe_id = 'anonymous-customer'
3
+ config.anonymous_plan_stripe_id = 'anonymous-plan'
4
+ config.free_plan_stripe_id = 'free-plan'
5
+ end
@@ -0,0 +1,16 @@
1
+ module PaidUp
2
+ module Generators
3
+ module Utils
4
+ def output(output, color = :green)
5
+ say(" - #{output}", color)
6
+ end
7
+
8
+ def ask_for(wording, default_value = nil, override_if_present_value = nil)
9
+ override_if_present_value.present? ?
10
+ display("Using [#{override_if_present_value}] for question '#{wording}'") && override_if_present_value :
11
+ ask(" ? #{wording} Press <enter> for [#{default_value}] >", :yellow).presence || default_value
12
+ end
13
+ end
14
+ end
15
+ end
16
+
@@ -0,0 +1,22 @@
1
+ module PaidUp
2
+ def self.configure(configuration = PaidUp::Configuration.new)
3
+ if block_given?
4
+ yield configuration
5
+ end
6
+ @@configuration = configuration
7
+ end
8
+
9
+ def self.configuration
10
+ @@configuration ||= PaidUp::Configuration.new
11
+ end
12
+
13
+ class Configuration
14
+ attr_accessor :anonymous_customer_stripe_id, :anonymous_plan_stripe_id, :free_plan_stripe_id
15
+
16
+ def initialize
17
+ self.anonymous_customer_stripe_id = "TODO"
18
+ self.anonymous_plan_stripe_id = "TODO"
19
+ self.free_plan_stripe_id = "TODO"
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,17 @@
1
+ module PaidUp
2
+ class Engine < Rails::Engine
3
+ isolate_namespace PaidUp
4
+ engine_name "paid_up"
5
+
6
+ config.generators do |g|
7
+ g.test_framework :rspec, :fixture => false
8
+ g.fixture_replacement :factory_girl, :dir => 'spec/factories'
9
+ g.assets false
10
+ g.helper false
11
+ end
12
+
13
+ def self.table_name_prefix
14
+ 'paid_up_'
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,9 @@
1
+ module PaidUp
2
+ module Integer
3
+ def to_date
4
+ Time.at(self).strftime("%m/%d/%Y")
5
+ end
6
+ end
7
+ end
8
+
9
+ Integer.send(:include, PaidUp::Integer)
@@ -0,0 +1,31 @@
1
+ module StringExtension
2
+ def localize(*args)
3
+ if args.first.is_a? Symbol
4
+ sym = args.shift
5
+ else
6
+ sym = underscore.tr(' ', '_').gsub(/[^a-z0-9_]+/i, '').to_sym
7
+ end
8
+ args << {:default => self}
9
+
10
+ I18n.t(sym, *args).html_safe
11
+ end
12
+ alias :l :localize
13
+ end
14
+ String.send :include, StringExtension
15
+
16
+
17
+ module SymbolExtensionCustom
18
+
19
+ def localize_with_debugging(*args)
20
+ localized_sym = I18n.translate(self, *args)
21
+ localized_sym.is_a?(String) ? localized_sym.html_safe : localized_sym
22
+ end
23
+ alias_method :l, :localize_with_debugging
24
+
25
+ def l_with_args(*args)
26
+ self.l(*args).html_safe
27
+ end
28
+
29
+ end
30
+
31
+ Symbol.send :include, SymbolExtensionCustom
@@ -0,0 +1,139 @@
1
+ module PaidUp
2
+ module Mixins
3
+ extend ActiveSupport::Concern
4
+ class_methods do
5
+ def subscriber
6
+ attr_reader :stripe_data
7
+
8
+ after_initialize :set_default_attributes, :load_stripe_data
9
+ before_save :remove_anonymous_association
10
+
11
+ self.send(:define_method, :reload) { |*args, &blk|
12
+ super *args, &blk
13
+ load_stripe_data
14
+ self
15
+ }
16
+ self.send(:define_method, :stripe_data) {
17
+ if stripe_id.present? || new_record?
18
+ @customer_stripe_data
19
+ end
20
+ }
21
+ self.send(:define_method, :cards) {
22
+ if stripe_data.present?
23
+ stripe_data.sources.all(:object => "card")
24
+ else
25
+ nil
26
+ end
27
+ }
28
+ self.send(:define_method, :subscribe_to_plan) { |plan_to_set, stripeToken = nil|
29
+ if stripe_id.present? && !subscription.nil? # There is an existing subscription
30
+ if stripeToken.present? # The customer has entered a new card
31
+ subscription.source = stripeToken
32
+ subscription.save
33
+ reload
34
+ end
35
+ subscription.plan = plan_to_set.stripe_id
36
+ result = subscription.save || ( raise(:could_not_update_subscription.l) && false )
37
+ else # Totally new subscription
38
+ customer = Stripe::Customer.create(
39
+ :source => stripeToken,
40
+ :plan => plan_to_set.stripe_id,
41
+ :email => email
42
+ ) || ( raise(:could_not_create_subscription.l) && false )
43
+
44
+ if stripe_id != customer.id # There is an update to be made, so we go ahead
45
+ result = update_attributes(stripe_id: customer.id) || ( raise(:could_not_associate_subscription.l) && false )
46
+ else
47
+ result = true
48
+ end
49
+ end
50
+ if result
51
+ reload
52
+ return true
53
+ else
54
+ return false
55
+ end
56
+ }
57
+ self.send(:define_method, :subscribe_to_free_plan) {
58
+ subscribe_to_plan PaidUp::Plan.free
59
+ }
60
+ self.send(:define_method, :plan) {
61
+ PaidUp::Plan.find_by_stripe_id(subscription.plan.id)
62
+ }
63
+ self.send(:define_method, :table_rows_unlimited?) { |table_name|
64
+ table_rows_allowed(table_name) == PaidUp::Unlimited.to_i
65
+ }
66
+ self.send(:define_method, :table_rows_remaining) { |table_name|
67
+ table_rows_allowed(table_name) - table_rows(table_name)
68
+ }
69
+ self.send(:define_method, :table_rows_allowed) { |table_name|
70
+ plan.feature_setting_by_name table_name
71
+ }
72
+ self.send(:define_method, :table_rows) { |table_name|
73
+ send(table_name).count
74
+ }
75
+ self.send(:define_method, :plan_stripe_id) {
76
+ if subscription.nil?
77
+ return nil
78
+ end
79
+ subscription.plan.id
80
+ }
81
+ self.send(:define_method, :subscription) {
82
+ if stripe_data.nil?
83
+ subscribe_to_free_plan
84
+ end
85
+ stripe_data.subscriptions.data.first
86
+ }
87
+ self.send(:define_method, :is_subscribed_to?) { |plan_to_check|
88
+ plan.id == plan_to_check.id
89
+ }
90
+ self.send(:define_method, :can_upgrade_to?) { |plan_to_check|
91
+ !is_subscribed_to?(plan_to_check) && (plan_to_check.sort_order.to_i > plan.sort_order.to_i)
92
+ }
93
+ self.send(:define_method, :can_downgrade_to?) { |plan_to_check|
94
+ !is_subscribed_to?(plan_to_check) && (plan_to_check.sort_order.to_i < plan.sort_order.to_i)
95
+ }
96
+ self.send(:define_method, :using_free_plan?) {
97
+ plan.stripe_id == PaidUp.configuration.free_plan_stripe_id || stripe_data.delinquent
98
+ }
99
+ self.send(:define_method, :load_stripe_data) {
100
+ if new_record?
101
+ working_stripe_id = PaidUp.configuration.anonymous_customer_stripe_id
102
+ else
103
+ unless stripe_id.present?
104
+ subscribe_to_free_plan
105
+ end
106
+ working_stripe_id = stripe_id
107
+ end
108
+ @customer_stripe_data = Stripe::Customer.retrieve working_stripe_id
109
+ if @customer_stripe_data.nil?
110
+ raise :could_not_load_subscription.l
111
+ end
112
+ }
113
+ self.send(:private, :load_stripe_data)
114
+ self.send(:define_method, :set_default_attributes) {
115
+ if new_record?
116
+ self.stripe_id = PaidUp.configuration.anonymous_customer_stripe_id
117
+ end
118
+ }
119
+ self.send(:private, :set_default_attributes)
120
+ self.send(:define_method, :remove_anonymous_association) {
121
+ if stripe_id == PaidUp.configuration.anonymous_customer_stripe_id
122
+ self.stripe_id = nil
123
+ end
124
+ }
125
+ self.send(:private, :remove_anonymous_association)
126
+
127
+ PaidUp::Plan.subscribed_to(self)
128
+ end
129
+
130
+ def subscribed_to(model)
131
+ has_many :subscribers, :through => :subscriptions, :source => :subscriber, :source_type => model.model_name
132
+ end
133
+ end
134
+ end
135
+ end
136
+
137
+
138
+
139
+ ActiveRecord::Base.send(:include, PaidUp::Mixins)
@@ -0,0 +1,4 @@
1
+ module PaidUp
2
+ class Railtie < Rails::Railtie
3
+ end
4
+ end
@@ -0,0 +1,17 @@
1
+ module PaidUp
2
+ module StripeExtensions
3
+ extend ActiveSupport::Concern
4
+ class_methods do
5
+ def find_or_create_by_id(id, item)
6
+ begin
7
+ self.retrieve(id)
8
+ rescue
9
+ self.create(item)
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+
16
+ Stripe::Customer.send(:include, PaidUp::StripeExtensions)
17
+ Stripe::Plan.send(:include, PaidUp::StripeExtensions)
@@ -0,0 +1,9 @@
1
+ module PaidUp
2
+ class TableValidator < ActiveModel::Validator
3
+ def validate(record)
4
+ if record.send(options[:field]) == options[:comparison] && !ActiveRecord::Base.connection.table_exists?(record.send(options[:found_in]))
5
+ record.errors[options[:found_in]] << :when_using_table_rows_table_must_exist.l
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,17 @@
1
+ module PaidUp
2
+ module Unlimited
3
+ def self.initialize
4
+ 999999999
5
+ end
6
+ def self.to_i(format = :default)
7
+ if format == :db
8
+ -1
9
+ else
10
+ 999999999
11
+ end
12
+ end
13
+ def self.to_s
14
+ :unlimited.l
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,7 @@
1
+ module PaidUp
2
+ VERSION = File.read(File.expand_path('../../../VERSION', __FILE__))
3
+
4
+ def self.version_string
5
+ "PaidUp version #{PaidUp::VERSION}"
6
+ end
7
+ end
data/lib/paid_up.rb ADDED
@@ -0,0 +1,27 @@
1
+ module PaidUp
2
+ require 'rails/all'
3
+ require 'rails-i18n'
4
+ require 'stripe' # Needs to be required before paid_up/stripe_extensions
5
+ require 'devise' # Needs to be required before paid_up/mixins
6
+
7
+ require 'paid_up/configuration'
8
+ require 'paid_up/railtie'
9
+ require 'paid_up/engine'
10
+ require 'paid_up/localization'
11
+ require 'paid_up/version'
12
+ require 'paid_up/stripe_extensions'
13
+ require 'paid_up/unlimited'
14
+ require 'paid_up/mixins'
15
+ require 'paid_up/integer'
16
+ require 'paid_up/table_validator'
17
+
18
+ require 'haml-rails'
19
+ require 'bootstrap_leather'
20
+ require 'high_voltage'
21
+ require 'cancan'
22
+
23
+ require 'money'
24
+
25
+ require 'seedbank'
26
+ require 'chronic'
27
+ end