core_merchant 0.2.2 → 0.5.1

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
  SHA256:
3
- metadata.gz: fa610ed10b80867ce31c0afb088b30fd3901d4ca8b348c3048ba08a259fd1a4f
4
- data.tar.gz: '0129e7925e06d0c652e5ed9d753f5c51fdbfd4485519db1845df9bf508a71b38'
3
+ metadata.gz: 465238229ff4e985efc17153d4d8efc1cca941745ded4a1e5dbe3a189499e6d0
4
+ data.tar.gz: 07ee307e66cbf913b89abbb41ec1eaa92a5ed5e981a577148cba3e8be0c02e95
5
5
  SHA512:
6
- metadata.gz: 8cc5f081f300dfb7db9882f6d7ccf33892bb5299a0b105958bfaaacac274edf56e5353e32853fcabf7273efa321da6459920eef6bf8f43090417bdfa0cbffedd
7
- data.tar.gz: cf8e3b3ee4750983097fac99615cde62b8ea736291e321a507eb090f48aade6584e1e4ff7d85054fcb099ca3c3f7a9e643758302b5dc9a77ab1390fde2f34949
6
+ metadata.gz: 6e85d2853136062219964072612ec3d82a8fa2296b3cf71f3400e1f68b01ff19c9ce7da09ef0acdcc9b681aecb487ae5680e9342df5428f7281d12569cad860c
7
+ data.tar.gz: 851db004b49a0ac7e0c737c6a53741b5d8747acfa052dedba8e78ac959ff532b02ff556a5a8a6a59cfe65b5aa0aec7cdb92d7500161904b37afdbd3ca1457607
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- core_merchant (0.2.1)
4
+ core_merchant (0.5.0)
5
5
  activesupport (~> 7.0)
6
6
  rails (~> 7.0)
7
7
 
@@ -18,7 +18,7 @@ module CoreMerchant
18
18
  #
19
19
  # Example:
20
20
  # ```
21
- # plan = CoreMerchant::SubscriptionPlan.new(name_key: "basic.monthly", price_cents: 7_99)
21
+ # plan = CoreMerchant::SubscriptionPlan.new(name_key: "basic_monthly", price_cents: 7_99)
22
22
  # plan.save
23
23
  # ```
24
24
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CoreMerchant
4
- VERSION = "0.2.2"
4
+ VERSION = "0.5.1"
5
5
  end
@@ -10,8 +10,16 @@ module CoreMerchant
10
10
 
11
11
  source_root File.expand_path("templates", __dir__)
12
12
 
13
+ class_option :customer_class, type: :string, required: true,
14
+ desc: "Name of your existing customer class, e.g. User"
15
+
13
16
  def copy_initializer
14
- template "core_merchant.rb", "config/initializers/core_merchant.rb"
17
+ @customer_class = options[:customer_class].classify
18
+ template "core_merchant.erb", "config/initializers/core_merchant.rb"
19
+ end
20
+
21
+ def copy_locales
22
+ template "core_merchant.en.yml", "config/locales/core_merchant.en.yml"
15
23
  end
16
24
 
17
25
  def self.next_migration_number(_dir)
@@ -22,6 +30,23 @@ module CoreMerchant
22
30
  migration_template "create_core_merchant_subscription_plans.erb",
23
31
  "db/migrate/create_core_merchant_subscription_plans.rb"
24
32
  end
33
+
34
+ def show_post_install
35
+ say "CoreMerchant has been successfully installed.", :green
36
+ say "Customer class: #{@customer_class}"
37
+ say "Please run `rails db:migrate` to create the subscription plans table."
38
+ end
39
+
40
+ def self.banner
41
+ "rails generate core_merchant:install --customer_class=User"
42
+ end
43
+
44
+ def self.description
45
+ <<~DESC
46
+ Installs CoreMerchant into your application with the specified customer class.
47
+ This could be User, Customer, or any other existing model in your application that represents a customer."
48
+ DESC
49
+ end
25
50
  end
26
51
  end
27
52
  end
@@ -0,0 +1,4 @@
1
+ en:
2
+ core_merchant:
3
+ subscription_plans:
4
+ example: "Super Awesome Example Plan" # Remove this and add your own subscription plans
@@ -0,0 +1,5 @@
1
+ # Created by: rails generate core_merchant:install --customer_class=<%= @customer_class %>
2
+
3
+ CoreMerchant.configure do |config|
4
+ config.customer_class = "<%= @customer_class %>"
5
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: core_merchant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seyithan Teymur
@@ -134,7 +134,8 @@ files:
134
134
  - lib/core_merchant/subscription_plan.rb
135
135
  - lib/core_merchant/version.rb
136
136
  - lib/generators/core_merchant/install_generator.rb
137
- - lib/generators/core_merchant/templates/core_merchant.rb
137
+ - lib/generators/core_merchant/templates/core_merchant.en.yml
138
+ - lib/generators/core_merchant/templates/core_merchant.erb
138
139
  - lib/generators/core_merchant/templates/create_core_merchant_subscription_plans.erb
139
140
  - sig/core_merchant.rbs
140
141
  homepage: https://github.com/theseyithan/core_merchant
@@ -1,4 +0,0 @@
1
- # Created by: rails generate core_merchant:install
2
- CoreMerchant.configure do |config|
3
- # config.customer_class = "User" # Uncomment and set to your class name that can represent a customer
4
- end