boring_generators 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/PULL_REQUEST_TEMPLATE.md +11 -0
- data/CHANGELOG.md +6 -0
- data/README.md +8 -3
- data/boring_generators.gemspec +1 -1
- data/lib/boring_generators/version.rb +1 -1
- data/lib/generators/boring/bootstrap/install/install_generator.rb +67 -0
- data/lib/generators/boring/bootstrap/install/templates/application.scss +1 -0
- data/lib/generators/boring/font_awesome/ruby_gem/install/install_generator.rb +42 -0
- data/lib/generators/boring/font_awesome/yarn/install/install_generator.rb +53 -0
- data/lib/generators/boring/font_awesome/yarn/install/templates/application.scss +1 -0
- data/lib/generators/boring/jquery/install/install_generator.rb +32 -0
- data/lib/generators/boring/tailwind/install/install_generator.rb +25 -17
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e277610c48ddb35578742b883529c07b4d4b6dfd1c0291b38b0049ae6eab340
|
4
|
+
data.tar.gz: cfc446b54c8591a9eed4b583652a34a0b02a8c9535fd3ebdea54f1599685cb1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7117cb3bef90a4c33edd5c980effa8272fc8669e2225ea85c81371262714ab68ed8122d56f83490331fca00ff619e2b35f788e2dbff83534f8c7fb567e76e17d
|
7
|
+
data.tar.gz: c055b5921c43dcb681364c2a5bbe99becf0c8559c057bd50ee96ea7731c260857a02ff6d75e0f1807418942100a5da6875a40f3bd74482b196cb4e37a9de1afe
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<!--
|
2
|
+
Thanks for submitting a pull request!
|
3
|
+
We appreciate you spending the time to work on these changes. Please provide enough information so that others can review your pull request. The three fields below are mandatory.
|
4
|
+
|
5
|
+
Before submitting a pull request, please make sure the following is done:
|
6
|
+
|
7
|
+
1. Fork [the repository](https://github.com/abhaynikam/boring_generators) and create your branch from `master`.
|
8
|
+
2. Run `bundle install` in the repository root.
|
9
|
+
3. If you've fixed a bug or added code that should be tested, add tests!
|
10
|
+
4. Ensure the test suite passes (`rake test`).
|
11
|
+
-->
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
## master (unreleased)
|
4
4
|
|
5
|
+
## 0.1.0 (September 16th, 2020)
|
6
|
+
* Adds JQuery install generator. ([@abhaynikam][])
|
7
|
+
* Adds Bootstrap install generator. ([@abhaynikam][])
|
8
|
+
* Adds FontAwesome install generator via Yarn. ([@abhaynikam][])
|
9
|
+
* Adds FontAwesome install generator via RubyGems. ([@abhaynikam][])
|
10
|
+
|
5
11
|
## 0.1.0 (September 5th, 2020)
|
6
12
|
|
7
13
|
* Adds Tailwind CSS install generator. ([@abhaynikam][])
|
data/README.md
CHANGED
@@ -22,7 +22,12 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
The boring generator introduces following generators:
|
26
|
+
- Install Tailwind CSS: `rails generate boring:tailwind:install`
|
27
|
+
- Install Bootstrap: `rails generate boring:bootstrap:install`
|
28
|
+
- Install JQuery: `rails generate boring:jquery:install`
|
29
|
+
- Install FontAwesome via Yarn: `rails generate boring:font_awesome:yarn:install`
|
30
|
+
- Install FontAwesome via RubyGems: `rails generate boring:font_awesome:ruby_gem:install`
|
26
31
|
|
27
32
|
## Development
|
28
33
|
|
@@ -32,7 +37,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
37
|
|
33
38
|
## Contributing
|
34
39
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
40
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/abhaynikam/boring_generators. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/abhaynikam/boring_generators/blob/master/CODE_OF_CONDUCT.md).
|
36
41
|
|
37
42
|
|
38
43
|
## License
|
@@ -41,4 +46,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
41
46
|
|
42
47
|
## Code of Conduct
|
43
48
|
|
44
|
-
Everyone interacting in the BoringGenerators project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
49
|
+
Everyone interacting in the BoringGenerators project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/abhaynikam/boring_generators/blob/master/CODE_OF_CONDUCT.md).
|
data/boring_generators.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
|
17
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
18
18
|
spec.metadata["source_code_uri"] = "https://github.com/abhaynikam/boring-generators"
|
19
|
-
spec.metadata["changelog_uri"] = "https://github.com/abhaynikam/
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/abhaynikam/boring_generators/blob/master/CHANGELOG.md"
|
20
20
|
|
21
21
|
# Specify which files should be added to the gem when it is released.
|
22
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Boring
|
4
|
+
module Bootstrap
|
5
|
+
class InstallGenerator < Rails::Generators::Base
|
6
|
+
desc "Adds Bootstrap to the application"
|
7
|
+
source_root File.expand_path("templates", __dir__)
|
8
|
+
|
9
|
+
def add_bootstrap_package
|
10
|
+
say "Adding bootstrap packages", :green
|
11
|
+
run "yarn add bootstrap jquery popper.js"
|
12
|
+
end
|
13
|
+
|
14
|
+
def add_jquery_plugin_provider_to_webpack_environment
|
15
|
+
say "Initailizing tailwind configuration", :green
|
16
|
+
if File.exist?("config/webpack/environment.js")
|
17
|
+
insert_into_file "config/webpack/environment.js", <<~RUBY, after: /@rails\/webpacker.*\n/
|
18
|
+
const webpack = require("webpack")
|
19
|
+
|
20
|
+
environment.plugins.append("Provide", new webpack.ProvidePlugin({
|
21
|
+
$: 'jquery',
|
22
|
+
jQuery: 'jquery',
|
23
|
+
Popper: ['popper.js', 'default']
|
24
|
+
}))
|
25
|
+
RUBY
|
26
|
+
else
|
27
|
+
say <<~WARNING, :red
|
28
|
+
ERROR: Looks like the webpacker installation is incomplete. Could not find environment.js in config/webpack.
|
29
|
+
WARNING
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def add_or_import_stylesheet_for_bootstrap
|
34
|
+
if File.exist?("app/javascript/stylesheets/application.scss")
|
35
|
+
say "Add bootstrap imports to the application.scss", :green
|
36
|
+
append_to_file "app/javascript/stylesheets/application.scss" do
|
37
|
+
'@import "~bootstrap/scss/bootstrap";'
|
38
|
+
end
|
39
|
+
else
|
40
|
+
say "Copying application.scss with tailwind imports", :green
|
41
|
+
template("application.scss", "app/javascript/stylesheets/application.scss")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def insert_stylesheet_in_the_application
|
46
|
+
if File.exist?("app/javascript/packs/application.js")
|
47
|
+
application_js_content = <<~RUBY
|
48
|
+
\n
|
49
|
+
import "bootstrap"
|
50
|
+
import "stylesheets/application"
|
51
|
+
RUBY
|
52
|
+
append_to_file "app/javascript/packs/application.js", application_js_content
|
53
|
+
else
|
54
|
+
say <<~WARNING, :red
|
55
|
+
ERROR: Looks like the webpacker installation is incomplete. Could not find application.js in app/javascript/packs.
|
56
|
+
WARNING
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def insert_stylesheet_packs_tag
|
61
|
+
insert_into_file "app/views/layouts/application.html.erb", <<~RUBY, after: /stylesheet_link_tag.*\n/
|
62
|
+
\t\t<%= stylesheet_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
|
63
|
+
RUBY
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
@import "~bootstrap/scss/bootstrap";
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Boring
|
4
|
+
module FontAwesome
|
5
|
+
module RubyGem
|
6
|
+
class InstallGenerator < Rails::Generators::Base
|
7
|
+
desc "Adds fontawesome via yarn to the application"
|
8
|
+
|
9
|
+
def add_font_awesome_sass_gem
|
10
|
+
say "Adding font_awesome_sass gem", :green
|
11
|
+
|
12
|
+
font_awesome_sass_gem = <<~RUBY
|
13
|
+
\n
|
14
|
+
# for adding font-awesome icons
|
15
|
+
gem 'font-awesome-sass', '~> 5.13'
|
16
|
+
RUBY
|
17
|
+
append_to_file "Gemfile", font_awesome_sass_gem
|
18
|
+
run "bundle install"
|
19
|
+
end
|
20
|
+
|
21
|
+
def import_font_awesome_stylesheet
|
22
|
+
say "Adding font awesome stylesheets", :green
|
23
|
+
stylesheet_font_awesome_imports = <<~RUBY
|
24
|
+
\n
|
25
|
+
@import "font-awesome-sprockets";
|
26
|
+
@import "font-awesome";
|
27
|
+
RUBY
|
28
|
+
|
29
|
+
if File.exist?("app/assets/stylesheets/application.css.scss")
|
30
|
+
append_to_file "app/assets/stylesheets/application.css.scss", stylesheet_font_awesome_imports
|
31
|
+
elsif File.exist?("app/assets/stylesheets/application.scss")
|
32
|
+
append_to_file "app/assets/stylesheets/application.scss", stylesheet_font_awesome_imports
|
33
|
+
else
|
34
|
+
say <<~WARNING, :red
|
35
|
+
ERROR: Looks like the application.css.scss is missing. Please rename the file and re-run the generator.
|
36
|
+
WARNING
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Boring
|
4
|
+
module FontAwesome
|
5
|
+
module Yarn
|
6
|
+
class InstallGenerator < Rails::Generators::Base
|
7
|
+
source_root File.expand_path("templates", __dir__)
|
8
|
+
desc "Adds fontawesome via rubygems to the application"
|
9
|
+
|
10
|
+
def add_font_awesome_package
|
11
|
+
say "Adding fontawesome packages", :green
|
12
|
+
run "yarn add @fortawesome/fontawesome-free"
|
13
|
+
end
|
14
|
+
|
15
|
+
def import_font_awesome_stylesheet
|
16
|
+
say "Adding font awesome stylesheets", :green
|
17
|
+
if File.exist?("app/javascript/stylesheets/application.scss")
|
18
|
+
stylesheet_font_awesome_imports = <<~RUBY
|
19
|
+
\n
|
20
|
+
@import '@fortawesome/fontawesome-free';
|
21
|
+
RUBY
|
22
|
+
|
23
|
+
append_to_file "app/javascript/stylesheets/application.scss", stylesheet_font_awesome_imports
|
24
|
+
else
|
25
|
+
say "Copying application.scss with FontAwesome imports", :green
|
26
|
+
template("application.scss", "app/javascript/stylesheets/application.scss")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def import_font_awesome_javascript
|
31
|
+
if File.exist?("app/javascript/packs/application.js")
|
32
|
+
javascript_font_awesome_imports = <<~RUBY
|
33
|
+
\n
|
34
|
+
import "@fortawesome/fontawesome-free/js/all"
|
35
|
+
RUBY
|
36
|
+
|
37
|
+
append_to_file "app/javascript/packs/application.js", javascript_font_awesome_imports
|
38
|
+
else
|
39
|
+
say <<~WARNING, :red
|
40
|
+
ERROR: Looks like the webpacker installation is incomplete. Could not find application.js in app/javascript/packs.
|
41
|
+
WARNING
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def insert_stylesheet_packs_tag
|
46
|
+
insert_into_file "app/views/layouts/application.html.erb", <<~RUBY, after: /stylesheet_link_tag.*\n/
|
47
|
+
\t\t<%= stylesheet_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
|
48
|
+
RUBY
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
@import '@fortawesome/fontawesome-free';
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Boring
|
4
|
+
module Jquery
|
5
|
+
class InstallGenerator < Rails::Generators::Base
|
6
|
+
desc "Adds JQuery to the application"
|
7
|
+
|
8
|
+
def add_jquery_package
|
9
|
+
say "Adding JQuery packages", :green
|
10
|
+
run "yarn add jquery"
|
11
|
+
end
|
12
|
+
|
13
|
+
def add_jquery_plugin_provider_to_webpack_environment
|
14
|
+
say "Initailizing tailwind configuration", :green
|
15
|
+
if File.exist?("config/webpack/environment.js")
|
16
|
+
insert_into_file "config/webpack/environment.js", <<~RUBY, after: /@rails\/webpacker.*\n/
|
17
|
+
const webpack = require("webpack")
|
18
|
+
|
19
|
+
environment.plugins.append("Provide", new webpack.ProvidePlugin({
|
20
|
+
$: 'jquery',
|
21
|
+
jQuery: 'jquery'
|
22
|
+
}))
|
23
|
+
RUBY
|
24
|
+
else
|
25
|
+
say <<~WARNING, :red
|
26
|
+
ERROR: Looks like the webpacker installation is incomplete. Could not find environment.js in config/webpack.
|
27
|
+
WARNING
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -37,30 +37,38 @@ module Boring
|
|
37
37
|
|
38
38
|
def add_or_import_stylesheet_for_tailwind
|
39
39
|
if File.exist?("app/javascript/stylesheets/application.scss")
|
40
|
-
say "Add
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
40
|
+
say "Add TailwindCSS imports to the application.scss", :green
|
41
|
+
stylesheet_tailwind_imports = <<~RUBY
|
42
|
+
\n
|
43
|
+
@import "tailwindcss/base";
|
44
|
+
@import "tailwindcss/components";
|
45
|
+
@import "tailwindcss/utilities";
|
46
|
+
RUBY
|
45
47
|
|
46
|
-
|
48
|
+
append_to_file "app/javascript/stylesheets/application.scss", stylesheet_tailwind_imports
|
47
49
|
else
|
48
|
-
say "Copying application.scss with
|
50
|
+
say "Copying application.scss with Tailwind imports", :green
|
49
51
|
template("application.scss", "app/javascript/stylesheets/application.scss")
|
52
|
+
end
|
53
|
+
end
|
50
54
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
else
|
56
|
-
raise "Looks like the webpacker installation is incomplete. Could not find application.js in app/javascript/packs."
|
55
|
+
def insert_stylesheet_in_the_application
|
56
|
+
if File.exist?("app/javascript/packs/application.js")
|
57
|
+
append_to_file "app/javascript/packs/application.js" do
|
58
|
+
'import "stylesheets/application"'
|
57
59
|
end
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
60
|
+
else
|
61
|
+
say <<~WARNING, :red
|
62
|
+
ERROR: Looks like the webpacker installation is incomplete. Could not find application.js in app/javascript/packs.
|
63
|
+
WARNING
|
62
64
|
end
|
63
65
|
end
|
66
|
+
|
67
|
+
def insert_stylesheet_packs_tag
|
68
|
+
insert_into_file "app/views/layouts/application.html.erb", <<~RUBY, after: /stylesheet_link_tag.*\n/
|
69
|
+
\t\t<%= stylesheet_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
|
70
|
+
RUBY
|
71
|
+
end
|
64
72
|
end
|
65
73
|
end
|
66
74
|
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.2.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: 2020-09-
|
11
|
+
date: 2020-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Every new project or hobby project of yours needs to setup simple things.
|
14
14
|
Boring generators aims to make your development faster by delegating boring setups
|
@@ -19,6 +19,7 @@ executables: []
|
|
19
19
|
extensions: []
|
20
20
|
extra_rdoc_files: []
|
21
21
|
files:
|
22
|
+
- ".github/PULL_REQUEST_TEMPLATE.md"
|
22
23
|
- ".gitignore"
|
23
24
|
- ".travis.yml"
|
24
25
|
- CHANGELOG.md
|
@@ -33,6 +34,12 @@ files:
|
|
33
34
|
- boring_generators.gemspec
|
34
35
|
- lib/boring_generators.rb
|
35
36
|
- lib/boring_generators/version.rb
|
37
|
+
- lib/generators/boring/bootstrap/install/install_generator.rb
|
38
|
+
- lib/generators/boring/bootstrap/install/templates/application.scss
|
39
|
+
- lib/generators/boring/font_awesome/ruby_gem/install/install_generator.rb
|
40
|
+
- lib/generators/boring/font_awesome/yarn/install/install_generator.rb
|
41
|
+
- lib/generators/boring/font_awesome/yarn/install/templates/application.scss
|
42
|
+
- lib/generators/boring/jquery/install/install_generator.rb
|
36
43
|
- lib/generators/boring/tailwind/install/install_generator.rb
|
37
44
|
- lib/generators/boring/tailwind/install/templates/application.scss
|
38
45
|
homepage: https://github.com/abhaynikam/boring_generators
|
@@ -41,7 +48,7 @@ licenses:
|
|
41
48
|
metadata:
|
42
49
|
homepage_uri: https://github.com/abhaynikam/boring_generators
|
43
50
|
source_code_uri: https://github.com/abhaynikam/boring-generators
|
44
|
-
changelog_uri: https://github.com/abhaynikam/
|
51
|
+
changelog_uri: https://github.com/abhaynikam/boring_generators/blob/master/CHANGELOG.md
|
45
52
|
post_install_message:
|
46
53
|
rdoc_options: []
|
47
54
|
require_paths:
|