boring_generators 0.8.0 → 0.9.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/Gemfile.lock +61 -63
- data/README.md +13 -7
- data/lib/boring_generators/version.rb +1 -1
- data/lib/generators/boring/ahoy/install/install_generator.rb +31 -0
- data/lib/generators/boring/ahoy/install/templates/README +10 -0
- data/lib/generators/boring/oauth/base_generator.rb +1 -1
- data/lib/generators/boring/oauth/facebook/install/templates/README +3 -0
- data/lib/generators/boring/oauth/github/install/templates/README +3 -0
- data/lib/generators/boring/oauth/google/install/templates/README +3 -0
- data/lib/generators/boring/oauth/twitter/install/templates/README +3 -0
- data/lib/generators/boring/payments/stripe/install/install_generator.rb +44 -0
- data/lib/generators/boring/payments/stripe/install/templates/README +14 -0
- data/lib/generators/boring/payments/stripe/install/templates/controllers/charges_controller.rb +38 -0
- data/lib/generators/boring/payments/stripe/install/templates/stripe.rb +6 -0
- data/lib/generators/boring/payments/stripe/install/templates/views/charges.html.erb +7 -0
- data/lib/generators/boring/payments/stripe/install/templates/views/create.html.erb +1 -0
- data/lib/generators/boring/payments/stripe/install/templates/views/new.html.erb +19 -0
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efa9742fe8c8f08258770d145e6c0e67d595020941d5f56d0be739ccda24cc94
|
4
|
+
data.tar.gz: 5c65a514369b0bf0c4d45ab02f32a585aadd551d65e6f9bbadef124dbaaef140
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01e2ed167544c93df8ef0be34c03766b51c4c9720869a6ac18bcf94785394c2afe7802837f456127e78350ad443cf4378b2e974f19e33f61f1dbfdb569cd2792
|
7
|
+
data.tar.gz: 5f8e9ae3aaf80bfb651392ba7436577325b16e38b54fe45bab0186daeff9f2abc44d3bd0178a602b931b76fc1ca1b6bf061e9ede4814c4fbdf3054f783103aa4
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,62 +1,62 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
boring_generators (0.
|
4
|
+
boring_generators (0.9.0)
|
5
5
|
railties
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actioncable (6.0.3.
|
11
|
-
actionpack (= 6.0.3.
|
10
|
+
actioncable (6.0.3.6)
|
11
|
+
actionpack (= 6.0.3.6)
|
12
12
|
nio4r (~> 2.0)
|
13
13
|
websocket-driver (>= 0.6.1)
|
14
|
-
actionmailbox (6.0.3.
|
15
|
-
actionpack (= 6.0.3.
|
16
|
-
activejob (= 6.0.3.
|
17
|
-
activerecord (= 6.0.3.
|
18
|
-
activestorage (= 6.0.3.
|
19
|
-
activesupport (= 6.0.3.
|
14
|
+
actionmailbox (6.0.3.6)
|
15
|
+
actionpack (= 6.0.3.6)
|
16
|
+
activejob (= 6.0.3.6)
|
17
|
+
activerecord (= 6.0.3.6)
|
18
|
+
activestorage (= 6.0.3.6)
|
19
|
+
activesupport (= 6.0.3.6)
|
20
20
|
mail (>= 2.7.1)
|
21
|
-
actionmailer (6.0.3.
|
22
|
-
actionpack (= 6.0.3.
|
23
|
-
actionview (= 6.0.3.
|
24
|
-
activejob (= 6.0.3.
|
21
|
+
actionmailer (6.0.3.6)
|
22
|
+
actionpack (= 6.0.3.6)
|
23
|
+
actionview (= 6.0.3.6)
|
24
|
+
activejob (= 6.0.3.6)
|
25
25
|
mail (~> 2.5, >= 2.5.4)
|
26
26
|
rails-dom-testing (~> 2.0)
|
27
|
-
actionpack (6.0.3.
|
28
|
-
actionview (= 6.0.3.
|
29
|
-
activesupport (= 6.0.3.
|
27
|
+
actionpack (6.0.3.6)
|
28
|
+
actionview (= 6.0.3.6)
|
29
|
+
activesupport (= 6.0.3.6)
|
30
30
|
rack (~> 2.0, >= 2.0.8)
|
31
31
|
rack-test (>= 0.6.3)
|
32
32
|
rails-dom-testing (~> 2.0)
|
33
33
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
34
|
-
actiontext (6.0.3.
|
35
|
-
actionpack (= 6.0.3.
|
36
|
-
activerecord (= 6.0.3.
|
37
|
-
activestorage (= 6.0.3.
|
38
|
-
activesupport (= 6.0.3.
|
34
|
+
actiontext (6.0.3.6)
|
35
|
+
actionpack (= 6.0.3.6)
|
36
|
+
activerecord (= 6.0.3.6)
|
37
|
+
activestorage (= 6.0.3.6)
|
38
|
+
activesupport (= 6.0.3.6)
|
39
39
|
nokogiri (>= 1.8.5)
|
40
|
-
actionview (6.0.3.
|
41
|
-
activesupport (= 6.0.3.
|
40
|
+
actionview (6.0.3.6)
|
41
|
+
activesupport (= 6.0.3.6)
|
42
42
|
builder (~> 3.1)
|
43
43
|
erubi (~> 1.4)
|
44
44
|
rails-dom-testing (~> 2.0)
|
45
45
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
46
|
-
activejob (6.0.3.
|
47
|
-
activesupport (= 6.0.3.
|
46
|
+
activejob (6.0.3.6)
|
47
|
+
activesupport (= 6.0.3.6)
|
48
48
|
globalid (>= 0.3.6)
|
49
|
-
activemodel (6.0.3.
|
50
|
-
activesupport (= 6.0.3.
|
51
|
-
activerecord (6.0.3.
|
52
|
-
activemodel (= 6.0.3.
|
53
|
-
activesupport (= 6.0.3.
|
54
|
-
activestorage (6.0.3.
|
55
|
-
actionpack (= 6.0.3.
|
56
|
-
activejob (= 6.0.3.
|
57
|
-
activerecord (= 6.0.3.
|
58
|
-
marcel (~> 0.
|
59
|
-
activesupport (6.0.3.
|
49
|
+
activemodel (6.0.3.6)
|
50
|
+
activesupport (= 6.0.3.6)
|
51
|
+
activerecord (6.0.3.6)
|
52
|
+
activemodel (= 6.0.3.6)
|
53
|
+
activesupport (= 6.0.3.6)
|
54
|
+
activestorage (6.0.3.6)
|
55
|
+
actionpack (= 6.0.3.6)
|
56
|
+
activejob (= 6.0.3.6)
|
57
|
+
activerecord (= 6.0.3.6)
|
58
|
+
marcel (~> 1.0.0)
|
59
|
+
activesupport (6.0.3.6)
|
60
60
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
61
61
|
i18n (>= 0.7, < 2)
|
62
62
|
minitest (~> 5.1)
|
@@ -64,56 +64,54 @@ GEM
|
|
64
64
|
zeitwerk (~> 2.2, >= 2.2.2)
|
65
65
|
builder (3.2.4)
|
66
66
|
byebug (11.1.3)
|
67
|
-
concurrent-ruby (1.1.
|
67
|
+
concurrent-ruby (1.1.8)
|
68
68
|
crass (1.0.6)
|
69
69
|
erubi (1.10.0)
|
70
70
|
globalid (0.4.2)
|
71
71
|
activesupport (>= 4.2.0)
|
72
|
-
i18n (1.8.
|
72
|
+
i18n (1.8.10)
|
73
73
|
concurrent-ruby (~> 1.0)
|
74
|
-
loofah (2.
|
74
|
+
loofah (2.9.1)
|
75
75
|
crass (~> 1.0.2)
|
76
76
|
nokogiri (>= 1.5.9)
|
77
77
|
mail (2.7.1)
|
78
78
|
mini_mime (>= 0.1.1)
|
79
|
-
marcel (0.
|
80
|
-
mimemagic (~> 0.3.2)
|
79
|
+
marcel (1.0.1)
|
81
80
|
method_source (1.0.0)
|
82
|
-
|
83
|
-
mini_mime (1.0.2)
|
81
|
+
mini_mime (1.1.0)
|
84
82
|
mini_portile2 (2.5.0)
|
85
|
-
minitest (5.14.
|
86
|
-
nio4r (2.5.
|
87
|
-
nokogiri (1.11.
|
83
|
+
minitest (5.14.4)
|
84
|
+
nio4r (2.5.7)
|
85
|
+
nokogiri (1.11.3)
|
88
86
|
mini_portile2 (~> 2.5.0)
|
89
87
|
racc (~> 1.4)
|
90
88
|
racc (1.5.2)
|
91
89
|
rack (2.2.3)
|
92
90
|
rack-test (1.1.0)
|
93
91
|
rack (>= 1.0, < 3)
|
94
|
-
rails (6.0.3.
|
95
|
-
actioncable (= 6.0.3.
|
96
|
-
actionmailbox (= 6.0.3.
|
97
|
-
actionmailer (= 6.0.3.
|
98
|
-
actionpack (= 6.0.3.
|
99
|
-
actiontext (= 6.0.3.
|
100
|
-
actionview (= 6.0.3.
|
101
|
-
activejob (= 6.0.3.
|
102
|
-
activemodel (= 6.0.3.
|
103
|
-
activerecord (= 6.0.3.
|
104
|
-
activestorage (= 6.0.3.
|
105
|
-
activesupport (= 6.0.3.
|
92
|
+
rails (6.0.3.6)
|
93
|
+
actioncable (= 6.0.3.6)
|
94
|
+
actionmailbox (= 6.0.3.6)
|
95
|
+
actionmailer (= 6.0.3.6)
|
96
|
+
actionpack (= 6.0.3.6)
|
97
|
+
actiontext (= 6.0.3.6)
|
98
|
+
actionview (= 6.0.3.6)
|
99
|
+
activejob (= 6.0.3.6)
|
100
|
+
activemodel (= 6.0.3.6)
|
101
|
+
activerecord (= 6.0.3.6)
|
102
|
+
activestorage (= 6.0.3.6)
|
103
|
+
activesupport (= 6.0.3.6)
|
106
104
|
bundler (>= 1.3.0)
|
107
|
-
railties (= 6.0.3.
|
105
|
+
railties (= 6.0.3.6)
|
108
106
|
sprockets-rails (>= 2.0.0)
|
109
107
|
rails-dom-testing (2.0.3)
|
110
108
|
activesupport (>= 4.2.0)
|
111
109
|
nokogiri (>= 1.6)
|
112
110
|
rails-html-sanitizer (1.3.0)
|
113
111
|
loofah (~> 2.3)
|
114
|
-
railties (6.0.3.
|
115
|
-
actionpack (= 6.0.3.
|
116
|
-
activesupport (= 6.0.3.
|
112
|
+
railties (6.0.3.6)
|
113
|
+
actionpack (= 6.0.3.6)
|
114
|
+
activesupport (= 6.0.3.6)
|
117
115
|
method_source
|
118
116
|
rake (>= 0.8.7)
|
119
117
|
thor (>= 0.20.3, < 2.0)
|
@@ -126,7 +124,7 @@ GEM
|
|
126
124
|
activesupport (>= 4.0)
|
127
125
|
sprockets (>= 3.0.0)
|
128
126
|
sqlite3 (1.4.2)
|
129
|
-
thor (1.0
|
127
|
+
thor (1.1.0)
|
130
128
|
thread_safe (0.3.6)
|
131
129
|
tzinfo (1.2.9)
|
132
130
|
thread_safe (~> 0.1)
|
data/README.md
CHANGED
@@ -40,19 +40,19 @@ And then you can use it this way:
|
|
40
40
|
## Usage
|
41
41
|
|
42
42
|
The boring generator introduces following generators:
|
43
|
-
- [Install Tailwind CSS
|
44
|
-
- [Install Bootstrap
|
43
|
+
- [Install Tailwind CSS](https://www.boringgenerators.com/blog/2020-10-18-install-tailwind/): `rails generate boring:tailwind:install`
|
44
|
+
- [Install Bootstrap](https://www.boringgenerators.com/blog/2020-11-15-install-bootstrap/): `rails generate boring:bootstrap:install`
|
45
45
|
- Install JQuery: `rails generate boring:jquery:install`
|
46
|
-
- [Install FontAwesome via Yarn
|
47
|
-
- [Install FontAwesome via RubyGems
|
46
|
+
- [Install FontAwesome via Yarn](https://www.boringgenerators.com/blog/2021-02-28-install-fontawesome-yarn/): `rails generate boring:font_awesome:yarn:install`
|
47
|
+
- [Install FontAwesome via RubyGems](https://www.boringgenerators.com/blog/2021-02-23-install-fontawesome/): `rails generate boring:font_awesome:ruby_gem:install`
|
48
48
|
- Install Bullet: `rails generate boring:bullet:install`
|
49
49
|
- Install Audit gems(bundler-audit, ruby_audit): `rails generate boring:audit:install`
|
50
50
|
- Install Pry gems for easy debugging: `rails generate boring:pry:install`
|
51
51
|
- Install Active Storage for Google Cloud Service: `rails generate boring:active_storage:google:install`
|
52
52
|
- Install Active Storage for AWS: `rails generate boring:active_storage:aws:install`
|
53
53
|
- Install Active Storage for Azure: `rails generate boring:active_storage:azure:install`
|
54
|
-
- [Install CircleCI: `rails generate boring:ci:circleci:install --repository_name=<name> --ruby_version=<version>`
|
55
|
-
- [Install GitHub Actions: `rails generate boring:ci:github_action:install --repository_name=<name> --ruby_version=<version>`
|
54
|
+
- [Install CircleCI](https://www.boringgenerators.com/blog/2021-01-02-configure-circleci/): `rails generate boring:ci:circleci:install --repository_name=<name> --ruby_version=<version>`
|
55
|
+
- [Install GitHub Actions](https://www.boringgenerators.com/blog/2020-12-17-configure-github-actions/): `rails generate boring:ci:github_action:install --repository_name=<name> --ruby_version=<version>`
|
56
56
|
- Install Travis CI: `rails generate boring:ci:travisci:install --ruby_version=<version>`
|
57
57
|
- Install Rubocop: `rails generate boring:rubocop:install --ruby_version=<version>`
|
58
58
|
- Build Favicon: `rails generate boring:favicon:build --application_name=<application_name> --favico_letter=<favico_letter> --primary_color=<color>`
|
@@ -60,11 +60,17 @@ The boring generator introduces following generators:
|
|
60
60
|
- Install GraphQL: `rails generate boring:graphql:install`
|
61
61
|
- Install SimpleForm: `rails generate boring:simple_form:install --css_framework=<css_framework>`
|
62
62
|
- Install Devise: `rails generate boring:devise:install`
|
63
|
-
- [Install Devise Facebook Omniauth
|
63
|
+
- [Install Devise Facebook Omniauth](https://www.boringgenerators.com/blog/2021-02-07-install-oauth-facbook/): `rails generate boring:oauth:facebook:install`
|
64
64
|
- Install Devise GitHub Omniauth: `rails generate boring:oauth:github:install`
|
65
65
|
- Install Devise Google Omniauth: `rails generate boring:oauth:google:install`
|
66
66
|
- Install Devise Twitter Omniauth: `rails generate boring:oauth:twitter:install`
|
67
67
|
- Install Twilio: `rails generate boring:twilio:install`
|
68
|
+
- Install Ahoy: `rails generate boring:ahoy:install`
|
69
|
+
- Install Stripe: `rails generate boring:payments:stripe:install`
|
70
|
+
|
71
|
+
## Screencasts
|
72
|
+
|
73
|
+
- [How to use Boring Generators](https://www.youtube.com/watch?v=9vaK9nDMbU8) by [Yaroslav Shmarov](https://twitter.com/yarotheslav)
|
68
74
|
|
69
75
|
## Development
|
70
76
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler'
|
4
|
+
|
5
|
+
module Boring
|
6
|
+
module Ahoy
|
7
|
+
class InstallGenerator < Rails::Generators::Base
|
8
|
+
desc "Adds Ahoy to the application"
|
9
|
+
source_root File.expand_path("templates", __dir__)
|
10
|
+
|
11
|
+
def add_twitter_omniauth_gem
|
12
|
+
say "Adding Ahoy gem", :green
|
13
|
+
Bundler.with_unbundled_env do
|
14
|
+
run "bundle add ahoy_matey"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def run_ahoy_generator
|
19
|
+
say "Running Ahoy generator", :green
|
20
|
+
Bundler.with_unbundled_env do
|
21
|
+
run "bundle exec rails generate ahoy:install"
|
22
|
+
run "bundle exec rails db:migrate"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def show_readme
|
27
|
+
readme "README"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
===============================================================================
|
2
|
+
|
3
|
+
Some setup you must do manually based on your project requirement:
|
4
|
+
|
5
|
+
1. To prevent Rails actions from tracking visits: `skip_before_action :track_ahoy_visit`
|
6
|
+
2. To associate and add association in the model with ahoy. Add `visitable :ahoy_visit` in the model.
|
7
|
+
|
8
|
+
You could find more configuration options on Ahoy documentation: https://github.com/ankane/ahoy
|
9
|
+
|
10
|
+
===============================================================================
|
@@ -45,7 +45,7 @@ module Boring
|
|
45
45
|
\twhere(provider: auth.provider, uid: auth.uid).first_or_create do |user|
|
46
46
|
\tuser.email = auth.info.email
|
47
47
|
\tuser.password = Devise.friendly_token[0, 20]
|
48
|
-
\
|
48
|
+
\t# user.name = auth.info.name # assuming the user model has a name
|
49
49
|
\t# user.image = auth.info.image # assuming the user model has an image
|
50
50
|
\t# If you are using confirmable and the provider(s) you use validate emails,
|
51
51
|
\t# uncomment the line below to skip the confirmation emails.
|
@@ -17,4 +17,7 @@ Some setup you must do manually if you haven't yet:
|
|
17
17
|
|
18
18
|
config.omniauth :facebook, "APP_ID", "APP_SECRET"
|
19
19
|
|
20
|
+
3. Your omniauth callback URL will be: `<host>/users/auth/facebook/callback`. Please update
|
21
|
+
callback URL in Facebook after registering your omniauth application.
|
22
|
+
|
20
23
|
===============================================================================
|
@@ -17,4 +17,7 @@ Some setup you must do manually if you haven't yet:
|
|
17
17
|
|
18
18
|
config.omniauth :github, "APP_ID", "APP_SECRET"
|
19
19
|
|
20
|
+
3. Your omniauth callback URL will be: `<host>/users/auth/github/callback`. Please update
|
21
|
+
callback URL in Github after registering your omniauth application.
|
22
|
+
|
20
23
|
===============================================================================
|
@@ -17,4 +17,7 @@ Some setup you must do manually if you haven't yet:
|
|
17
17
|
|
18
18
|
config.omniauth :google_auth, "APP_ID", "APP_SECRET"
|
19
19
|
|
20
|
+
3. Your omniauth callback URL will be: `<host>/users/auth/google_oauth2/callback`. Please update
|
21
|
+
callback URL in Google after registering your omniauth application.
|
22
|
+
|
20
23
|
===============================================================================
|
@@ -17,4 +17,7 @@ Some setup you must do manually if you haven't yet:
|
|
17
17
|
|
18
18
|
config.omniauth :twitter, "APP_ID", "APP_SECRET"
|
19
19
|
|
20
|
+
3. Your omniauth callback URL will be: `<host>/users/auth/twitter/callback`. Please update
|
21
|
+
callback URL in Twitter after registering your omniauth application.
|
22
|
+
|
20
23
|
===============================================================================
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Boring
|
4
|
+
module Payments
|
5
|
+
module Stripe
|
6
|
+
class InstallGenerator < Rails::Generators::Base
|
7
|
+
desc "Adds stripe payment method to the application"
|
8
|
+
source_root File.expand_path("templates", __dir__)
|
9
|
+
|
10
|
+
def add_stripe_gem
|
11
|
+
say "Adding stripe gem", :green
|
12
|
+
Bundler.with_unbundled_env do
|
13
|
+
run "bundle add stripe"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def add_charges_controller
|
18
|
+
say "Adding stripe charge resources"
|
19
|
+
copy_file("controllers/charges_controller.rb", "app/controllers/charges_controller.rb")
|
20
|
+
end
|
21
|
+
|
22
|
+
def add_stripe_routes
|
23
|
+
route "resources :charges"
|
24
|
+
end
|
25
|
+
|
26
|
+
def add_stripe_initializer
|
27
|
+
say "Adding stripe initalizers"
|
28
|
+
copy_file("stripe.rb", "config/initializers/stripe.rb")
|
29
|
+
end
|
30
|
+
|
31
|
+
def add_stripe_views
|
32
|
+
say "Adding stripe views and layout"
|
33
|
+
copy_file("views/charges.html.erb", "app/views/layouts/charges.html.erb")
|
34
|
+
copy_file("views/new.html.erb", "app/views/charges/new.html.erb")
|
35
|
+
copy_file("views/create.html.erb", "app/views/charges/create.html.erb")
|
36
|
+
end
|
37
|
+
|
38
|
+
def show_readme
|
39
|
+
readme "README"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
===============================================================================
|
2
|
+
|
3
|
+
Some setup you must do manually if you haven't yet:
|
4
|
+
|
5
|
+
Update the stripe PUBLISHABLE_KEY and SECRET_KEY in "config/initializers/stripe.rb"
|
6
|
+
after registering the Rails application on: https://dashboard.stripe.com/register
|
7
|
+
For example:
|
8
|
+
|
9
|
+
Rails.configuration.stripe = {
|
10
|
+
:publishable_key => ENV['PUBLISHABLE_KEY'],
|
11
|
+
:secret_key => ENV['SECRET_KEY']
|
12
|
+
}
|
13
|
+
|
14
|
+
===============================================================================
|
data/lib/generators/boring/payments/stripe/install/templates/controllers/charges_controller.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ChargesController < ApplicationController
|
4
|
+
def new
|
5
|
+
render
|
6
|
+
end
|
7
|
+
|
8
|
+
def create
|
9
|
+
if create_stripe_customer && create_stripe_charge
|
10
|
+
redirect_to root_path, flash: { success: "Boring stripe setup is successful" }
|
11
|
+
else
|
12
|
+
redirect_to new_charge_path, flash: { error: "Ugh. Something went wrong in setup." }
|
13
|
+
end
|
14
|
+
rescue Stripe::CardError => e
|
15
|
+
flash[:error] = e.message
|
16
|
+
redirect_to new_charge_path
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
def create_stripe_customer
|
21
|
+
@customer = Stripe::Customer.create({
|
22
|
+
email: params[:stripeEmail],
|
23
|
+
source: params[:stripeToken],
|
24
|
+
})
|
25
|
+
end
|
26
|
+
|
27
|
+
def create_stripe_charge
|
28
|
+
# Amount in cents
|
29
|
+
@amount = 500
|
30
|
+
|
31
|
+
Stripe::Charge.create({
|
32
|
+
customer: customer.id,
|
33
|
+
amount: @amount,
|
34
|
+
description: 'Rails Stripe customer',
|
35
|
+
currency: 'usd',
|
36
|
+
})
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<h2>Thanks, you paid <strong>$5.00</strong>!</h2>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%= form_tag charges_path do %>
|
2
|
+
<article>
|
3
|
+
<% if flash[:error].present? %>
|
4
|
+
<div id="error_explanation">
|
5
|
+
<p><%= flash[:error] %></p>
|
6
|
+
</div>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<label class="amount">
|
10
|
+
<span>Amount: $5.00</span>
|
11
|
+
</label>
|
12
|
+
</article>
|
13
|
+
|
14
|
+
<script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
|
15
|
+
data-key="<%= Rails.configuration.stripe[:publishable_key] %>"
|
16
|
+
data-description="A month's subscription"
|
17
|
+
data-amount="500"
|
18
|
+
data-locale="auto"></script>
|
19
|
+
<% end %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boring_generators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abhay Nikam
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -56,6 +56,8 @@ files:
|
|
56
56
|
- lib/generators/boring/active_storage/aws/install/install_generator.rb
|
57
57
|
- lib/generators/boring/active_storage/azure/install/install_generator.rb
|
58
58
|
- lib/generators/boring/active_storage/google/install/install_generator.rb
|
59
|
+
- lib/generators/boring/ahoy/install/install_generator.rb
|
60
|
+
- lib/generators/boring/ahoy/install/templates/README
|
59
61
|
- lib/generators/boring/audit/install/install_generator.rb
|
60
62
|
- lib/generators/boring/bootstrap/install/install_generator.rb
|
61
63
|
- lib/generators/boring/bootstrap/install/templates/application.scss
|
@@ -93,6 +95,13 @@ files:
|
|
93
95
|
- lib/generators/boring/oauth/twitter/install/install_generator.rb
|
94
96
|
- lib/generators/boring/oauth/twitter/install/templates/README
|
95
97
|
- lib/generators/boring/oauth/twitter/install/templates/omniauth_callbacks_controller.rb
|
98
|
+
- lib/generators/boring/payments/stripe/install/install_generator.rb
|
99
|
+
- lib/generators/boring/payments/stripe/install/templates/README
|
100
|
+
- lib/generators/boring/payments/stripe/install/templates/controllers/charges_controller.rb
|
101
|
+
- lib/generators/boring/payments/stripe/install/templates/stripe.rb
|
102
|
+
- lib/generators/boring/payments/stripe/install/templates/views/charges.html.erb
|
103
|
+
- lib/generators/boring/payments/stripe/install/templates/views/create.html.erb
|
104
|
+
- lib/generators/boring/payments/stripe/install/templates/views/new.html.erb
|
96
105
|
- lib/generators/boring/pry/install/install_generator.rb
|
97
106
|
- lib/generators/boring/pry/install/templates/pryrc
|
98
107
|
- lib/generators/boring/pundit/install/install_generator.rb
|