boring_generators 0.4.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +12 -0
- data/.github/workflows/ci.yml +8 -2
- data/CHANGELOG.md +27 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +94 -21
- data/README.md +32 -6
- data/Rakefile +1 -0
- data/boring_generators.gemspec +1 -1
- data/exe/boring +5 -0
- data/lib/boring_generators.rb +1 -0
- data/lib/boring_generators/cli.rb +26 -0
- 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/bootstrap/install/install_generator.rb +2 -2
- data/lib/generators/boring/ci/github_action/install/install_generator.rb +18 -4
- data/lib/generators/boring/ci/github_action/install/templates/ci.yml.tt +1 -11
- data/lib/generators/boring/devise/install/install_generator.rb +75 -0
- data/lib/generators/boring/favicon/build/build_generator.rb +120 -0
- data/lib/generators/boring/favicon/build/templates/favicon.html.erb.tt +19 -0
- data/lib/generators/boring/graphql/install/install_generator.rb +51 -0
- data/lib/generators/boring/graphql/install/templates/base_resolver.rb +2 -0
- data/lib/generators/boring/graphql/install/templates/hello_world_resolver.rb +11 -0
- data/lib/generators/boring/oauth/base_generator.rb +63 -0
- data/lib/generators/boring/oauth/facebook/install/install_generator.rb +42 -0
- data/lib/generators/boring/oauth/facebook/install/templates/README +23 -0
- data/lib/generators/boring/oauth/facebook/install/templates/omniauth.rb +3 -0
- data/lib/generators/boring/oauth/facebook/install/templates/omniauth_callbacks_controller.rb +21 -0
- data/lib/generators/boring/oauth/github/install/install_generator.rb +42 -0
- data/lib/generators/boring/oauth/github/install/templates/README +23 -0
- data/lib/generators/boring/oauth/github/install/templates/omniauth_callbacks_controller.rb +21 -0
- data/lib/generators/boring/oauth/google/install/install_generator.rb +36 -0
- data/lib/generators/boring/oauth/google/install/templates/README +23 -0
- data/lib/generators/boring/oauth/google/install/templates/omniauth_callbacks_controller.rb +21 -0
- data/lib/generators/boring/oauth/twitter/install/install_generator.rb +36 -0
- data/lib/generators/boring/oauth/twitter/install/templates/README +23 -0
- data/lib/generators/boring/oauth/twitter/install/templates/omniauth_callbacks_controller.rb +21 -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
- data/lib/generators/boring/pundit/install/install_generator.rb +85 -0
- data/lib/generators/boring/simple_form/install/install_generator.rb +44 -0
- data/lib/generators/boring/tailwind/install/install_generator.rb +12 -11
- data/lib/generators/boring/tailwind/install/templates/README +13 -0
- data/lib/generators/boring/twilio/install/install_generator.rb +30 -0
- data/lib/generators/boring/twilio/install/templates/README +11 -0
- data/lib/generators/boring/twilio/install/templates/twilio.rb +4 -0
- metadata +42 -665
- data/.travis.yml +0 -6
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/.github/FUNDING.yml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# These are supported funding model platforms
|
2
|
+
|
3
|
+
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
4
|
+
patreon: # Replace with a single Patreon username
|
5
|
+
open_collective: boring_generators
|
6
|
+
ko_fi: # Replace with a single Ko-fi username
|
7
|
+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
8
|
+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
9
|
+
liberapay: # Replace with a single Liberapay username
|
10
|
+
issuehunt: # Replace with a single IssueHunt username
|
11
|
+
otechie: # Replace with a single Otechie username
|
12
|
+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
data/.github/workflows/ci.yml
CHANGED
@@ -10,8 +10,14 @@ jobs:
|
|
10
10
|
- name: Set up Ruby
|
11
11
|
uses: ruby/setup-ruby@v1
|
12
12
|
with:
|
13
|
-
ruby-version: 2.7.
|
13
|
+
ruby-version: 2.7.0
|
14
|
+
bundler-cache: true
|
15
|
+
- name: Install Imagemagick
|
16
|
+
run: |
|
17
|
+
wget https://raw.githubusercontent.com/discourse/discourse_docker/master/image/base/install-imagemagick
|
18
|
+
chmod +x install-imagemagick
|
19
|
+
sudo ./install-imagemagick
|
14
20
|
- name: Install gems
|
15
21
|
run: bundle install --jobs 4 --retry 3
|
16
22
|
- name: Run tests
|
17
|
-
run: bundle exec rake test
|
23
|
+
run: bundle exec rake test --trace
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,30 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
3
|
## master (unreleased)
|
4
|
+
* Adds Ahoy generator. ([@abhaynikam][])
|
5
|
+
* Adds Stripe payment generator. ([@abhaynikam][])
|
6
|
+
|
7
|
+
## 0.8.0 (February 28th, 2021)
|
8
|
+
* Adds Devise Google Omniauth generator. ([@abhaynikam][])
|
9
|
+
* Adds Devise Twitter Omniauth generator. ([@abhaynikam][])
|
10
|
+
* Adds Twilio generator. ([@abhaynikam][])
|
11
|
+
|
12
|
+
## 0.7.0 (January 30th, 2021)
|
13
|
+
* Upgrade the Tailwind CSS generator to support Tailwind V2.0. ([@abhaynikam][])
|
14
|
+
* Adds Devise GitHub Omniauth generator. ([@abhaynikam][])
|
15
|
+
|
16
|
+
## 0.6.0 (January 10th, 2021)
|
17
|
+
* Updates default ruby version of GitHub Actions install generator. ([@jamesglover][])
|
18
|
+
* Simplify generated GitHub Actions install ([@jamesglover][])
|
19
|
+
* Adds boring generator CLI ([@luathn][])
|
20
|
+
* Adds Devise Facebook Omniauth generator. ([@abhaynikam][])
|
21
|
+
|
22
|
+
## 0.5.0 (December 20th, 2020)
|
23
|
+
* Adds favicon build generator. ([@abhaynikam][])
|
24
|
+
* Adds Pundit install generator. ([@CiTroNaK][])
|
25
|
+
* Adds GraphQL generator. ([@abhaynikam][])
|
26
|
+
* Adds SimpleForm generator. ([@abhaynikam][])
|
27
|
+
* Adds Devise generator. ([@abhaynikam][])
|
4
28
|
|
5
29
|
## 0.4.0 (October 23rd, 2020)
|
6
30
|
* Adds CircleCI install generator. ([@abhaynikam][])
|
@@ -28,3 +52,6 @@
|
|
28
52
|
* Initial release. ([@abhaynikam][])
|
29
53
|
|
30
54
|
[@abhaynikam]: https://github.com/abhaynikam
|
55
|
+
[@CiTroNaK]: https://github.com/CiTroNaK
|
56
|
+
[@jamesglover]: https://github.com/JamesGlover
|
57
|
+
[@luathn]: https://github.com/luathn
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,26 +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
|
-
|
11
|
-
|
12
|
-
|
10
|
+
actioncable (6.0.3.6)
|
11
|
+
actionpack (= 6.0.3.6)
|
12
|
+
nio4r (~> 2.0)
|
13
|
+
websocket-driver (>= 0.6.1)
|
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
|
+
mail (>= 2.7.1)
|
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
|
+
mail (~> 2.5, >= 2.5.4)
|
26
|
+
rails-dom-testing (~> 2.0)
|
27
|
+
actionpack (6.0.3.6)
|
28
|
+
actionview (= 6.0.3.6)
|
29
|
+
activesupport (= 6.0.3.6)
|
13
30
|
rack (~> 2.0, >= 2.0.8)
|
14
31
|
rack-test (>= 0.6.3)
|
15
32
|
rails-dom-testing (~> 2.0)
|
16
33
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
17
|
-
|
18
|
-
|
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
|
+
nokogiri (>= 1.8.5)
|
40
|
+
actionview (6.0.3.6)
|
41
|
+
activesupport (= 6.0.3.6)
|
19
42
|
builder (~> 3.1)
|
20
43
|
erubi (~> 1.4)
|
21
44
|
rails-dom-testing (~> 2.0)
|
22
45
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
23
|
-
|
46
|
+
activejob (6.0.3.6)
|
47
|
+
activesupport (= 6.0.3.6)
|
48
|
+
globalid (>= 0.3.6)
|
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)
|
24
60
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
25
61
|
i18n (>= 0.7, < 2)
|
26
62
|
minitest (~> 5.1)
|
@@ -28,39 +64,74 @@ GEM
|
|
28
64
|
zeitwerk (~> 2.2, >= 2.2.2)
|
29
65
|
builder (3.2.4)
|
30
66
|
byebug (11.1.3)
|
31
|
-
concurrent-ruby (1.1.
|
67
|
+
concurrent-ruby (1.1.8)
|
32
68
|
crass (1.0.6)
|
33
|
-
erubi (1.
|
34
|
-
|
69
|
+
erubi (1.10.0)
|
70
|
+
globalid (0.4.2)
|
71
|
+
activesupport (>= 4.2.0)
|
72
|
+
i18n (1.8.10)
|
35
73
|
concurrent-ruby (~> 1.0)
|
36
|
-
loofah (2.
|
74
|
+
loofah (2.9.1)
|
37
75
|
crass (~> 1.0.2)
|
38
76
|
nokogiri (>= 1.5.9)
|
77
|
+
mail (2.7.1)
|
78
|
+
mini_mime (>= 0.1.1)
|
79
|
+
marcel (1.0.1)
|
39
80
|
method_source (1.0.0)
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
81
|
+
mini_mime (1.1.0)
|
82
|
+
mini_portile2 (2.5.0)
|
83
|
+
minitest (5.14.4)
|
84
|
+
nio4r (2.5.7)
|
85
|
+
nokogiri (1.11.3)
|
86
|
+
mini_portile2 (~> 2.5.0)
|
87
|
+
racc (~> 1.4)
|
88
|
+
racc (1.5.2)
|
44
89
|
rack (2.2.3)
|
45
90
|
rack-test (1.1.0)
|
46
91
|
rack (>= 1.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)
|
104
|
+
bundler (>= 1.3.0)
|
105
|
+
railties (= 6.0.3.6)
|
106
|
+
sprockets-rails (>= 2.0.0)
|
47
107
|
rails-dom-testing (2.0.3)
|
48
108
|
activesupport (>= 4.2.0)
|
49
109
|
nokogiri (>= 1.6)
|
50
110
|
rails-html-sanitizer (1.3.0)
|
51
111
|
loofah (~> 2.3)
|
52
|
-
railties (6.0.3.
|
53
|
-
actionpack (= 6.0.3.
|
54
|
-
activesupport (= 6.0.3.
|
112
|
+
railties (6.0.3.6)
|
113
|
+
actionpack (= 6.0.3.6)
|
114
|
+
activesupport (= 6.0.3.6)
|
55
115
|
method_source
|
56
116
|
rake (>= 0.8.7)
|
57
117
|
thor (>= 0.20.3, < 2.0)
|
58
118
|
rake (12.3.3)
|
59
|
-
|
119
|
+
sprockets (4.0.2)
|
120
|
+
concurrent-ruby (~> 1.0)
|
121
|
+
rack (> 1, < 3)
|
122
|
+
sprockets-rails (3.2.2)
|
123
|
+
actionpack (>= 4.0)
|
124
|
+
activesupport (>= 4.0)
|
125
|
+
sprockets (>= 3.0.0)
|
126
|
+
sqlite3 (1.4.2)
|
127
|
+
thor (1.1.0)
|
60
128
|
thread_safe (0.3.6)
|
61
|
-
tzinfo (1.2.
|
129
|
+
tzinfo (1.2.9)
|
62
130
|
thread_safe (~> 0.1)
|
63
|
-
|
131
|
+
websocket-driver (0.7.3)
|
132
|
+
websocket-extensions (>= 0.1.0)
|
133
|
+
websocket-extensions (0.1.5)
|
134
|
+
zeitwerk (2.4.2)
|
64
135
|
|
65
136
|
PLATFORMS
|
66
137
|
ruby
|
@@ -69,7 +140,9 @@ DEPENDENCIES
|
|
69
140
|
boring_generators!
|
70
141
|
byebug
|
71
142
|
minitest (~> 5.0)
|
143
|
+
rails (~> 6.0.3.4)
|
72
144
|
rake (~> 12.0)
|
145
|
+
sqlite3 (~> 1.4)
|
73
146
|
|
74
147
|
BUNDLED WITH
|
75
148
|
2.1.4
|
data/README.md
CHANGED
@@ -32,29 +32,55 @@ Or install it yourself as:
|
|
32
32
|
|
33
33
|
$ gem install boring_generators
|
34
34
|
|
35
|
+
And then you can use it this way:
|
36
|
+
|
37
|
+
$ boring generate boring:simple_form:install --css_framework=<css_framework>
|
38
|
+
$ boring g boring:pry:install
|
39
|
+
|
35
40
|
## Usage
|
36
41
|
|
37
42
|
The boring generator introduces following generators:
|
38
|
-
- Install Tailwind CSS: `rails generate boring:tailwind:install`
|
39
|
-
- Install Bootstrap: `rails generate boring:bootstrap:install`
|
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`
|
40
45
|
- Install JQuery: `rails generate boring:jquery:install`
|
41
|
-
- Install FontAwesome via Yarn: `rails generate boring:font_awesome:yarn:install`
|
42
|
-
- Install FontAwesome via RubyGems: `rails generate boring:font_awesome:ruby_gem:install`
|
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`
|
43
48
|
- Install Bullet: `rails generate boring:bullet:install`
|
44
49
|
- Install Audit gems(bundler-audit, ruby_audit): `rails generate boring:audit:install`
|
45
50
|
- Install Pry gems for easy debugging: `rails generate boring:pry:install`
|
46
51
|
- Install Active Storage for Google Cloud Service: `rails generate boring:active_storage:google:install`
|
47
52
|
- Install Active Storage for AWS: `rails generate boring:active_storage:aws:install`
|
48
53
|
- Install Active Storage for Azure: `rails generate boring:active_storage:azure:install`
|
49
|
-
- Install CircleCI: `rails generate boring:ci:circleci:install --repository_name=<name> --ruby_version=<version>`
|
50
|
-
- 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>`
|
51
56
|
- Install Travis CI: `rails generate boring:ci:travisci:install --ruby_version=<version>`
|
52
57
|
- Install Rubocop: `rails generate boring:rubocop:install --ruby_version=<version>`
|
58
|
+
- Build Favicon: `rails generate boring:favicon:build --application_name=<application_name> --favico_letter=<favico_letter> --primary_color=<color>`
|
59
|
+
- Install Pundit: `rails generate boring:pundit:install`
|
60
|
+
- Install GraphQL: `rails generate boring:graphql:install`
|
61
|
+
- Install SimpleForm: `rails generate boring:simple_form:install --css_framework=<css_framework>`
|
62
|
+
- Install Devise: `rails generate boring:devise:install`
|
63
|
+
- [Install Devise Facebook Omniauth](https://www.boringgenerators.com/blog/2021-02-07-install-oauth-facbook/): `rails generate boring:oauth:facebook:install`
|
64
|
+
- Install Devise GitHub Omniauth: `rails generate boring:oauth:github:install`
|
65
|
+
- Install Devise Google Omniauth: `rails generate boring:oauth:google:install`
|
66
|
+
- Install Devise Twitter Omniauth: `rails generate boring:oauth:twitter:install`
|
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)
|
53
74
|
|
54
75
|
## Development
|
55
76
|
|
56
77
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
57
78
|
|
79
|
+
You can also run specific test cases using following commands:
|
80
|
+
```
|
81
|
+
bundle exec ruby -w -Itest test/generators/tailwind_install_generator_test.rb
|
82
|
+
```
|
83
|
+
|
58
84
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
59
85
|
|
60
86
|
## Contributing
|
data/Rakefile
CHANGED
data/boring_generators.gemspec
CHANGED
data/exe/boring
ADDED
data/lib/boring_generators.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "rails/generators"
|
3
|
+
require_relative "../boring_generators"
|
4
|
+
|
5
|
+
module BoringGenerators
|
6
|
+
class CLI < Thor
|
7
|
+
map "g" => :generate
|
8
|
+
map %w(--version -v) => :__print_version
|
9
|
+
|
10
|
+
desc "generate GENERATOR [options]", "Add gem to the application"
|
11
|
+
def generate(generator, *options)
|
12
|
+
Rails::Generators.invoke(generator, options)
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "--version, -v", "Print gem version"
|
16
|
+
def __print_version
|
17
|
+
puts "Boring generators #{BoringGenerators::VERSION}"
|
18
|
+
end
|
19
|
+
|
20
|
+
class << self
|
21
|
+
def exit_on_failure?
|
22
|
+
true
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -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
|
+
===============================================================================
|
@@ -12,7 +12,7 @@ module Boring
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def add_jquery_plugin_provider_to_webpack_environment
|
15
|
-
say "
|
15
|
+
say "Adding jQuery and popper JS plugin in the webpack", :green
|
16
16
|
if File.exist?("config/webpack/environment.js")
|
17
17
|
insert_into_file "config/webpack/environment.js", <<~RUBY, after: /@rails\/webpacker.*\n/
|
18
18
|
const webpack = require("webpack")
|
@@ -37,7 +37,7 @@ module Boring
|
|
37
37
|
'@import "~bootstrap/scss/bootstrap";'
|
38
38
|
end
|
39
39
|
else
|
40
|
-
say "Copying application.scss with
|
40
|
+
say "Copying application.scss with bootstrap imports", :green
|
41
41
|
template("application.scss", "app/javascript/stylesheets/application.scss")
|
42
42
|
end
|
43
43
|
end
|