datacrafts-io-skeleton 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6a8a7f1e3667328f825505e1b90a9f34548dc6a8426b48ff5125f5db2d9ede8d
4
+ data.tar.gz: 54b24bb63320fdd65259fe522603a76ef5c8331494ea966942442313f975b1a8
5
+ SHA512:
6
+ metadata.gz: 140634ed3abb87538160981b25b4f464f4f2eb867fbce41679cacb98e107e12d0f535f562db1487aed6fd4555f5ccc8a02a730172be2e2fbe8949b4062837bc2
7
+ data.tar.gz: 7a99a01212e82edc917b2bd542ae9f3ce57d62b06407555c8cc978402fbc24c3c88e17c9dec05836a670f1b9b0d73fa85c27a299b4cf21db38896982b871d6ef
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /.idea/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,135 @@
1
+ AllCops:
2
+ UseCache: false
3
+ TargetRubyVersion: 2.6
4
+
5
+ Style/NumericPredicate:
6
+ Enabled: false
7
+
8
+ Style/Lambda:
9
+ EnforcedStyle: literal
10
+
11
+ Style/Documentation:
12
+ Enabled: false
13
+
14
+ Style/FrozenStringLiteralComment:
15
+ Enabled: false
16
+
17
+ Style/ReturnNil:
18
+ Enabled: true
19
+
20
+ Style/SymbolArray:
21
+ MinSize: 5
22
+
23
+ Style/BarePercentLiterals:
24
+ EnforcedStyle: percent_q
25
+
26
+ Style/ClassAndModuleChildren:
27
+ Enabled: false
28
+
29
+ Style/DoubleNegation:
30
+ Enabled: false
31
+
32
+ Style/EmptyMethod:
33
+ Enabled: false
34
+
35
+ Style/StringLiterals:
36
+ EnforcedStyle: double_quotes
37
+
38
+ Style/TrivialAccessors:
39
+ AllowPredicates: true
40
+
41
+ Style/HashEachMethods:
42
+ Enabled: true
43
+
44
+ Style/HashTransformKeys:
45
+ Enabled: true
46
+
47
+ Style/HashTransformValues:
48
+ Enabled: true
49
+
50
+ Style/ExponentialNotation:
51
+ Enabled: true
52
+
53
+ Style/SlicingWithRange:
54
+ Enabled: true
55
+
56
+ Style/RedundantRegexpCharacterClass:
57
+ Enabled: true
58
+
59
+ Style/RedundantRegexpEscape:
60
+ Enabled: true
61
+
62
+ Style/AccessorGrouping:
63
+ Enabled: true
64
+
65
+ Style/ArrayCoercion:
66
+ Enabled: true
67
+
68
+ Style/BisectedAttrAccessor:
69
+ Enabled: true
70
+
71
+ Style/CaseLikeIf:
72
+ Enabled: true
73
+
74
+ Style/HashAsLastArrayItem:
75
+ Enabled: true
76
+
77
+ Style/HashLikeCase:
78
+ Enabled: true
79
+
80
+ Style/RedundantAssignment:
81
+ Enabled: true
82
+
83
+ Style/RedundantFetchBlock:
84
+ Enabled: true
85
+
86
+ Style/RedundantFileExtensionInRequire:
87
+ Enabled: true
88
+
89
+ Lint/RaiseException:
90
+ Enabled: true
91
+
92
+ Lint/StructNewOverride:
93
+ Enabled: true
94
+
95
+ Lint/DeprecatedOpenSSLConstant:
96
+ Enabled: true
97
+
98
+ Lint/MixedRegexpCaptureTypes:
99
+ Enabled: true
100
+
101
+ Lint/DuplicateElsifCondition:
102
+ Enabled: true
103
+
104
+ Layout/SpaceAroundMethodCallOperator:
105
+ Enabled: true
106
+
107
+ Layout/SpaceInsideStringInterpolation:
108
+ EnforcedStyle: no_space
109
+
110
+ Layout/EmptyLinesAroundAttributeAccessor:
111
+ Enabled: true
112
+
113
+ Layout/SpaceAroundEqualsInParameterDefault:
114
+ EnforcedStyle: no_space
115
+
116
+ Layout/ClassStructure:
117
+ Enabled: true
118
+
119
+ Layout/LineLength:
120
+ Max: 120
121
+
122
+ Metrics/AbcSize:
123
+ Max: 15
124
+
125
+ Metrics/MethodLength:
126
+ Max: 18
127
+
128
+ Metrics/BlockLength:
129
+ Enabled: false
130
+
131
+ Naming/MemoizedInstanceVariableName:
132
+ EnforcedStyleForLeadingUnderscores: optional
133
+
134
+ Naming/VariableNumber:
135
+ Enabled: true
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.6.6
6
+ before_install: gem install bundler -v 2.1.4
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at overchind@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in datacrafts_io_skeleton.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "rspec", "~> 3.0"
@@ -0,0 +1,159 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ datacrafts-io-skeleton (0.1.0)
5
+ bundler (>= 2.0)
6
+ rails (>= 5.2)
7
+ thor (~> 1.0.1)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ actioncable (6.0.3.1)
13
+ actionpack (= 6.0.3.1)
14
+ nio4r (~> 2.0)
15
+ websocket-driver (>= 0.6.1)
16
+ actionmailbox (6.0.3.1)
17
+ actionpack (= 6.0.3.1)
18
+ activejob (= 6.0.3.1)
19
+ activerecord (= 6.0.3.1)
20
+ activestorage (= 6.0.3.1)
21
+ activesupport (= 6.0.3.1)
22
+ mail (>= 2.7.1)
23
+ actionmailer (6.0.3.1)
24
+ actionpack (= 6.0.3.1)
25
+ actionview (= 6.0.3.1)
26
+ activejob (= 6.0.3.1)
27
+ mail (~> 2.5, >= 2.5.4)
28
+ rails-dom-testing (~> 2.0)
29
+ actionpack (6.0.3.1)
30
+ actionview (= 6.0.3.1)
31
+ activesupport (= 6.0.3.1)
32
+ rack (~> 2.0, >= 2.0.8)
33
+ rack-test (>= 0.6.3)
34
+ rails-dom-testing (~> 2.0)
35
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
36
+ actiontext (6.0.3.1)
37
+ actionpack (= 6.0.3.1)
38
+ activerecord (= 6.0.3.1)
39
+ activestorage (= 6.0.3.1)
40
+ activesupport (= 6.0.3.1)
41
+ nokogiri (>= 1.8.5)
42
+ actionview (6.0.3.1)
43
+ activesupport (= 6.0.3.1)
44
+ builder (~> 3.1)
45
+ erubi (~> 1.4)
46
+ rails-dom-testing (~> 2.0)
47
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
48
+ activejob (6.0.3.1)
49
+ activesupport (= 6.0.3.1)
50
+ globalid (>= 0.3.6)
51
+ activemodel (6.0.3.1)
52
+ activesupport (= 6.0.3.1)
53
+ activerecord (6.0.3.1)
54
+ activemodel (= 6.0.3.1)
55
+ activesupport (= 6.0.3.1)
56
+ activestorage (6.0.3.1)
57
+ actionpack (= 6.0.3.1)
58
+ activejob (= 6.0.3.1)
59
+ activerecord (= 6.0.3.1)
60
+ marcel (~> 0.3.1)
61
+ activesupport (6.0.3.1)
62
+ concurrent-ruby (~> 1.0, >= 1.0.2)
63
+ i18n (>= 0.7, < 2)
64
+ minitest (~> 5.1)
65
+ tzinfo (~> 1.1)
66
+ zeitwerk (~> 2.2, >= 2.2.2)
67
+ builder (3.2.4)
68
+ concurrent-ruby (1.1.6)
69
+ crass (1.0.6)
70
+ diff-lcs (1.3)
71
+ erubi (1.9.0)
72
+ globalid (0.4.2)
73
+ activesupport (>= 4.2.0)
74
+ i18n (1.8.2)
75
+ concurrent-ruby (~> 1.0)
76
+ loofah (2.5.0)
77
+ crass (~> 1.0.2)
78
+ nokogiri (>= 1.5.9)
79
+ mail (2.7.1)
80
+ mini_mime (>= 0.1.1)
81
+ marcel (0.3.3)
82
+ mimemagic (~> 0.3.2)
83
+ method_source (1.0.0)
84
+ mimemagic (0.3.5)
85
+ mini_mime (1.0.2)
86
+ mini_portile2 (2.4.0)
87
+ minitest (5.14.1)
88
+ nio4r (2.5.2)
89
+ nokogiri (1.10.9)
90
+ mini_portile2 (~> 2.4.0)
91
+ rack (2.2.2)
92
+ rack-test (1.1.0)
93
+ rack (>= 1.0, < 3)
94
+ rails (6.0.3.1)
95
+ actioncable (= 6.0.3.1)
96
+ actionmailbox (= 6.0.3.1)
97
+ actionmailer (= 6.0.3.1)
98
+ actionpack (= 6.0.3.1)
99
+ actiontext (= 6.0.3.1)
100
+ actionview (= 6.0.3.1)
101
+ activejob (= 6.0.3.1)
102
+ activemodel (= 6.0.3.1)
103
+ activerecord (= 6.0.3.1)
104
+ activestorage (= 6.0.3.1)
105
+ activesupport (= 6.0.3.1)
106
+ bundler (>= 1.3.0)
107
+ railties (= 6.0.3.1)
108
+ sprockets-rails (>= 2.0.0)
109
+ rails-dom-testing (2.0.3)
110
+ activesupport (>= 4.2.0)
111
+ nokogiri (>= 1.6)
112
+ rails-html-sanitizer (1.3.0)
113
+ loofah (~> 2.3)
114
+ railties (6.0.3.1)
115
+ actionpack (= 6.0.3.1)
116
+ activesupport (= 6.0.3.1)
117
+ method_source
118
+ rake (>= 0.8.7)
119
+ thor (>= 0.20.3, < 2.0)
120
+ rake (12.3.3)
121
+ rspec (3.9.0)
122
+ rspec-core (~> 3.9.0)
123
+ rspec-expectations (~> 3.9.0)
124
+ rspec-mocks (~> 3.9.0)
125
+ rspec-core (3.9.2)
126
+ rspec-support (~> 3.9.3)
127
+ rspec-expectations (3.9.2)
128
+ diff-lcs (>= 1.2.0, < 2.0)
129
+ rspec-support (~> 3.9.0)
130
+ rspec-mocks (3.9.1)
131
+ diff-lcs (>= 1.2.0, < 2.0)
132
+ rspec-support (~> 3.9.0)
133
+ rspec-support (3.9.3)
134
+ sprockets (4.0.0)
135
+ concurrent-ruby (~> 1.0)
136
+ rack (> 1, < 3)
137
+ sprockets-rails (3.2.1)
138
+ actionpack (>= 4.0)
139
+ activesupport (>= 4.0)
140
+ sprockets (>= 3.0.0)
141
+ thor (1.0.1)
142
+ thread_safe (0.3.6)
143
+ tzinfo (1.2.7)
144
+ thread_safe (~> 0.1)
145
+ websocket-driver (0.7.2)
146
+ websocket-extensions (>= 0.1.0)
147
+ websocket-extensions (0.1.4)
148
+ zeitwerk (2.3.0)
149
+
150
+ PLATFORMS
151
+ ruby
152
+
153
+ DEPENDENCIES
154
+ datacrafts-io-skeleton!
155
+ rake (~> 12.0)
156
+ rspec (~> 3.0)
157
+
158
+ BUNDLED WITH
159
+ 2.1.4
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Roman Ovcharov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,38 @@
1
+ # Skeleton
2
+
3
+ Create new apps quickly!
4
+
5
+ ## Installation
6
+
7
+ Install this gem as follow:
8
+
9
+ $ gem install datacrafts-io-skeleton
10
+
11
+ ## Usage
12
+
13
+ ### New Rails API application without frontend part.
14
+
15
+ This command will create new rails app with configured rails_helper.rb and .rubocop.yml files. All major gems are also included.
16
+
17
+ $ datacrafts-io-skeleton create APP_NAME
18
+ $ datacrafts-io-skeleton build APP_NAME
19
+ $ datacrafts-io-skeleton new APP_NAME
20
+
21
+ ## Development
22
+
23
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
24
+
25
+ To install this gem onto your local machine, run `bundle exec rake install`.
26
+
27
+ ## Contributing
28
+
29
+ Bug reports and pull requests are welcome on GitHub at [datacrafts-io/skeleton](https://github.com/datacrafts-io/skeleton). 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/datacrafts-io/skeleton/blob/master/CODE_OF_CONDUCT.md).
30
+
31
+ ## License
32
+
33
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
34
+
35
+ ## Code of Conduct
36
+
37
+ Everyone interacting in the Skeleton project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/datacrafts-io/skeleton/blob/master/CODE_OF_CONDUCT.md).
38
+ g
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "datacrafts_io_skeleton"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,32 @@
1
+ require_relative "lib/datacrafts_io_skeleton/version"
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "datacrafts-io-skeleton"
5
+ spec.version = DatacraftsIoSkeleton::VERSION
6
+ spec.authors = ["Roman Ovcharov"]
7
+ spec.email = ["overchind@gmail.com"]
8
+
9
+ spec.summary = "Simple gem for fast rails apps creation."
10
+ spec.description = spec.summary
11
+ spec.homepage = "https://github.com/datacrafts-io/skeleton"
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+
15
+ spec.metadata["allowed_push_host"] = "https://rubygems.org/"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://github.com/datacrafts-io/skeleton"
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
23
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
+ end
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+
29
+ spec.add_dependency "bundler", ">= 2.0"
30
+ spec.add_dependency "rails", ">= 5.2"
31
+ spec.add_dependency "thor", "~> 1.0.1"
32
+ end
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "datacrafts_io_skeleton"
4
+
5
+ DatacraftsIoSkeleton::Composer.start(ARGV)
@@ -0,0 +1,6 @@
1
+ require "datacrafts_io_skeleton/version"
2
+ require "datacrafts_io_skeleton/composer"
3
+
4
+ # Simple gem with CLI that helps team to start new project quickly.
5
+ module DatacraftsIoSkeleton
6
+ end
@@ -0,0 +1,34 @@
1
+ require "thor"
2
+ require_relative "./version"
3
+ require_relative "./rails_creator"
4
+
5
+ module DatacraftsIoSkeleton
6
+ # Defines all CLI commands, their descriptions, params and aliases.
7
+ class Composer < Thor
8
+ desc "create APP_NAME", "This will create new rails app."
9
+ long_desc <<-CREATE_NEW_APP
10
+ This command will create new rails app with configured rails_helper.rb and .rubocop.yml files.
11
+ All major gems are also included.
12
+
13
+ You can use this command with next aliases:\n
14
+
15
+ `datacrafts-io-skeleton create APPNAME`\n
16
+ `datacrafts-io-skeleton build APPNAME`\n
17
+ `datacrafts-io-skeleton new APPNAME`\n
18
+ CREATE_NEW_APP
19
+ map %w[new build] => :create
20
+ # Creates new app.
21
+ #
22
+ # @param [String] app_name The name of app you are going to create.
23
+ def create(app_name)
24
+ DatacraftsIoSkeleton::RailsCreator.new(app_name).call
25
+ end
26
+
27
+ desc "version", "Display version"
28
+ map %w[-v --version] => :version
29
+ # Informs user about gem version.
30
+ def version
31
+ say "datacrafts-io-skeleton #{DatacraftsIoSkeleton::VERSION}"
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,67 @@
1
+ require "thor"
2
+
3
+ module DatacraftsIoSkeleton
4
+ # Responsible for the creation of rails projects.
5
+ class RailsCreator < Thor
6
+ include Thor::Actions
7
+
8
+ # Defines gem templates folder which you can use to load template to the new app.
9
+ TEMPLATES_DIR = (File.dirname(__FILE__) + "/../../templates").freeze
10
+
11
+ source_root TEMPLATES_DIR
12
+
13
+ no_commands do
14
+ # Creates new instance of _DatacraftsIoSkeleton::RailsCreator_ class
15
+ # with app_name which will be used during creation.
16
+ #
17
+ # @param [String] app_name The name of app you are going to create.
18
+ def initialize(app_name)
19
+ super()
20
+ @app_name = app_name
21
+ end
22
+
23
+ # Creates new rails API app from predefined template. Copies rubocop and spec files
24
+ # to the new project.
25
+ def call
26
+ create_rails_api_app
27
+ configure_rubocop
28
+ update_spec_config
29
+ run_rubocop
30
+ commit_project
31
+ end
32
+ end
33
+
34
+ private
35
+
36
+ no_commands do
37
+ def create_rails_api_app
38
+ run "rails new #{@app_name} --database=postgresql --api -T -m #{TEMPLATES_DIR}/rails.rb"
39
+ end
40
+
41
+ def configure_rubocop
42
+ template "rubocop.yml.erb", app(".rubocop.yml")
43
+ end
44
+
45
+ def update_spec_config
46
+ remove_file app("spec/rails_helper.rb")
47
+ copy_file "spec.rb", app("spec/rails_helper.rb")
48
+ empty_directory app("spec/factories")
49
+ empty_directory app("spec/models")
50
+ empty_directory app("spec/controllers")
51
+ end
52
+
53
+ def run_rubocop
54
+ run "cd #{app} && rubocop -a"
55
+ end
56
+
57
+ def commit_project
58
+ append_to_file app(".gitignore"), "/.idea/\n"
59
+ run "cd #{app} && git add . && git commit -m 'Initial commit.'"
60
+ end
61
+
62
+ def app(path=nil)
63
+ "#{@app_name}/#{path}"
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,4 @@
1
+ module DatacraftsIoSkeleton
2
+ # Defines gem version
3
+ VERSION = "0.1.0".freeze
4
+ end
@@ -0,0 +1,46 @@
1
+ gem "dry-initializer"
2
+ gem "rake-task-migration"
3
+ gem "timecop"
4
+ gem "sidekiq"
5
+
6
+ gem_group :development do
7
+ gem "annotate"
8
+ gem "brakeman"
9
+ gem "bullet"
10
+ gem "bundle-audit"
11
+ gem "pry-byebug"
12
+ gem "pry-rails"
13
+ gem "rails_best_practices"
14
+ gem "reek"
15
+ gem "rubocop", require: false
16
+ gem "rubocop-performance", require: false
17
+ gem "rubocop-rails", require: false
18
+ gem "rubocop-faker"
19
+ end
20
+
21
+ gem_group :development, :test do
22
+ gem "faker"
23
+ gem "rspec"
24
+ gem "rspec-rails"
25
+ gem "rubocop-rspec", require: false
26
+ gem "dotenv-rails"
27
+ gem "webmock"
28
+ end
29
+
30
+ gem_group :test do
31
+ gem "database_cleaner-active_record"
32
+ gem "factory_bot"
33
+ gem "simplecov", require: false
34
+ gem "shoulda-matchers"
35
+ end
36
+
37
+ uncomment_lines "Gemfile", "rack-cors"
38
+
39
+ run "bundle install"
40
+
41
+ rails_command "generate rspec:install"
42
+
43
+ run "bundle exec rake task_migration:install:migrations"
44
+
45
+ rails_command "db:create"
46
+ rails_command "db:migrate"
@@ -0,0 +1,252 @@
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-rails
4
+ - rubocop-rspec
5
+ - rubocop-faker
6
+
7
+ AllCops:
8
+ UseCache: false
9
+ TargetRubyVersion: <%= RUBY_VERSION[/\d+\.\d+/] %>
10
+ Exclude:
11
+ - bin/*
12
+ - db/schema.rb
13
+ - db/seeds.rb
14
+ - config/puma.rb
15
+ - config/environments/*
16
+
17
+ Style/NumericPredicate:
18
+ Enabled: false
19
+
20
+ Style/Lambda:
21
+ EnforcedStyle: literal
22
+
23
+ Style/Documentation:
24
+ Enabled: false
25
+
26
+ Style/ReturnNil:
27
+ Enabled: true
28
+
29
+ Style/SymbolArray:
30
+ MinSize: 5
31
+
32
+ Style/BarePercentLiterals:
33
+ EnforcedStyle: percent_q
34
+
35
+ Style/ClassAndModuleChildren:
36
+ Enabled: false
37
+
38
+ Style/DoubleNegation:
39
+ Enabled: false
40
+
41
+ Style/EmptyMethod:
42
+ Enabled: false
43
+
44
+ Style/StringLiterals:
45
+ EnforcedStyle: double_quotes
46
+
47
+ Style/TrivialAccessors:
48
+ AllowPredicates: true
49
+
50
+ Style/HashEachMethods:
51
+ Enabled: true
52
+
53
+ Style/HashTransformKeys:
54
+ Enabled: true
55
+
56
+ Style/HashTransformValues:
57
+ Enabled: true
58
+
59
+ Style/ExponentialNotation:
60
+ Enabled: true
61
+
62
+ Style/SlicingWithRange:
63
+ Enabled: true
64
+
65
+ Style/RedundantRegexpCharacterClass:
66
+ Enabled: true
67
+
68
+ Style/RedundantRegexpEscape:
69
+ Enabled: true
70
+
71
+ Style/AccessorGrouping:
72
+ Enabled: true
73
+
74
+ Style/ArrayCoercion:
75
+ Enabled: true
76
+
77
+ Style/BisectedAttrAccessor:
78
+ Enabled: true
79
+
80
+ Style/CaseLikeIf:
81
+ Enabled: true
82
+
83
+ Style/HashAsLastArrayItem:
84
+ Enabled: true
85
+
86
+ Style/HashLikeCase:
87
+ Enabled: true
88
+
89
+ Style/RedundantAssignment:
90
+ Enabled: true
91
+
92
+ Style/RedundantFetchBlock:
93
+ Enabled: true
94
+
95
+ Style/RedundantFileExtensionInRequire:
96
+ Enabled: true
97
+
98
+ Lint/RaiseException:
99
+ Enabled: true
100
+
101
+ Lint/StructNewOverride:
102
+ Enabled: true
103
+
104
+ Lint/DeprecatedOpenSSLConstant:
105
+ Enabled: true
106
+
107
+ Lint/MixedRegexpCaptureTypes:
108
+ Enabled: true
109
+
110
+ Lint/DuplicateElsifCondition:
111
+ Enabled: true
112
+
113
+ Layout/SpaceAroundMethodCallOperator:
114
+ Enabled: true
115
+
116
+ Layout/SpaceInsideStringInterpolation:
117
+ EnforcedStyle: no_space
118
+
119
+ Layout/EmptyLinesAroundAttributeAccessor:
120
+ Enabled: true
121
+
122
+ Layout/HashAlignment:
123
+ EnforcedColonStyle:
124
+ - table
125
+ - key
126
+ EnforcedHashRocketStyle:
127
+ - table
128
+ - key
129
+
130
+ Layout/SpaceAroundEqualsInParameterDefault:
131
+ EnforcedStyle: no_space
132
+
133
+ Layout/ClassStructure:
134
+ Enabled: true
135
+
136
+ Layout/LineLength:
137
+ Max: 120
138
+
139
+ Metrics/AbcSize:
140
+ Max: 15
141
+ Exclude:
142
+ - "spec/**/*"
143
+
144
+ Metrics/BlockLength:
145
+ Exclude:
146
+ - "config/**/*"
147
+ - "spec/**/*"
148
+
149
+ Metrics/ClassLength:
150
+ Exclude:
151
+ - "spec/**/*"
152
+
153
+ Metrics/MethodLength:
154
+ Max: 18
155
+ Exclude:
156
+ - "db/migrate/*"
157
+ - "spec/**/*"
158
+
159
+ Performance/Casecmp:
160
+ Enabled: false
161
+
162
+ Performance/AncestorsInclude:
163
+ Enabled: true
164
+
165
+ Performance/BigDecimalWithNumericArgument:
166
+ Enabled: true
167
+
168
+ Performance/RedundantSortBlock:
169
+ Enabled: true
170
+
171
+ Performance/RedundantStringChars:
172
+ Enabled: true
173
+
174
+ Performance/ReverseFirst:
175
+ Enabled: true
176
+
177
+ Performance/SortReverse:
178
+ Enabled: true
179
+
180
+ Performance/Squeeze:
181
+ Enabled: true
182
+
183
+ Performance/StringInclude:
184
+ Enabled: true
185
+
186
+ Rails/ApplicationRecord:
187
+ Exclude:
188
+ - "db/migrate/**"
189
+
190
+ Rails/RakeEnvironment:
191
+ Enabled: false
192
+
193
+ Rails/RefuteMethods:
194
+ Enabled: false
195
+
196
+ Rails/Validation:
197
+ Enabled: false
198
+
199
+ Rails/ActiveRecordCallbacksOrder:
200
+ Enabled: true
201
+
202
+ Rails/FindById:
203
+ Enabled: true
204
+
205
+ Rails/Inquiry:
206
+ Enabled: true
207
+
208
+ Rails/MailerName:
209
+ Enabled: true
210
+
211
+ Rails/MatchRoute:
212
+ Enabled: true
213
+
214
+ Rails/NegateInclude:
215
+ Enabled: true
216
+
217
+ Rails/Pluck:
218
+ Enabled: true
219
+
220
+ Rails/PluckId:
221
+ Enabled: true
222
+
223
+ Rails/PluckInWhere:
224
+ Enabled: true
225
+
226
+ Rails/RenderInline:
227
+ Enabled: true
228
+
229
+ Rails/RenderPlainText:
230
+ Enabled: true
231
+
232
+ Rails/ShortI18n:
233
+ Enabled: true
234
+
235
+ Rails/WhereExists:
236
+ Enabled: true
237
+
238
+ Rails/CreateTableWithTimestamps:
239
+ Enabled: false
240
+
241
+ Rails/UnknownEnv:
242
+ Environments:
243
+ - production
244
+ - development
245
+ - test
246
+ - staging
247
+
248
+ Naming/MemoizedInstanceVariableName:
249
+ EnforcedStyleForLeadingUnderscores: optional
250
+
251
+ Naming/VariableNumber:
252
+ Enabled: false
@@ -0,0 +1,94 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ require "spec_helper"
3
+
4
+ ENV["RAILS_ENV"] ||= "test"
5
+ require File.expand_path("../config/environment", __dir__)
6
+ # Prevent database truncation if the environment is production
7
+ abort("The Rails environment is running in production mode!") if Rails.env.production?
8
+ require "rspec/rails"
9
+ # Add additional requires below this line. Rails is not loaded until this point!
10
+
11
+ require "database_cleaner/active_record"
12
+ require "sidekiq/testing"
13
+ require "simplecov"
14
+ require "webmock/rspec"
15
+ SimpleCov.start "rails"
16
+
17
+ # Requires supporting ruby files with custom matchers and macros, etc, in
18
+ # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
19
+ # run as spec files by default. This means that files in spec/support that end
20
+ # in _spec.rb will both be required and run as specs, causing the specs to be
21
+ # run twice. It is recommended that you do not name files matching this glob to
22
+ # end with _spec.rb. You can configure this pattern with the --pattern
23
+ # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
24
+ #
25
+ # The following line is provided for convenience purposes. It has the downside
26
+ # of increasing the boot-up time by auto-requiring all files in the support
27
+ # directory. Alternatively, in the individual `*_spec.rb` files, manually
28
+ # require only the support files necessary.
29
+ #
30
+ Dir[Rails.root.join("spec/support/**/*.rb")].sort.each { |f| require f }
31
+
32
+ # Checks for pending migrations and applies them before tests are run.
33
+ # If you are not using ActiveRecord, you can remove these lines.
34
+ begin
35
+ ActiveRecord::Migration.maintain_test_schema!
36
+ rescue ActiveRecord::PendingMigrationError => e
37
+ puts e.to_s.strip
38
+ exit 1
39
+ end
40
+
41
+ RSpec.configure do |config|
42
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
43
+ # examples within a transaction, remove the following line or assign false
44
+ # instead of true.
45
+ config.use_transactional_fixtures = true
46
+
47
+ # You can uncomment this line to turn off ActiveRecord support entirely.
48
+ # config.use_active_record = false
49
+
50
+ config.infer_spec_type_from_file_location!
51
+
52
+ # Filter lines from Rails gems in backtraces.
53
+ config.filter_rails_from_backtrace!
54
+ # arbitrary gems may also be filtered via:
55
+ # config.filter_gems_from_backtrace("gem name")
56
+
57
+ config.mock_with :rspec
58
+
59
+ config.before do
60
+ WebMock.disable_net_connect!
61
+ end
62
+ # Webmock
63
+ # config.before do
64
+ # stub_request(:get, 'https://example.com')
65
+ # .with(
66
+ # headers: {
67
+ # 'Authorization' => 'Bearer'
68
+ # }
69
+ # )
70
+ # .to_return(status: 200, body: '', headers: {})
71
+ # end
72
+
73
+ config.include FactoryBot::Syntax::Methods
74
+ # Travel in time
75
+ config.include ActiveSupport::Testing::TimeHelpers
76
+
77
+ config.before(:suite) do
78
+ DatabaseCleaner.strategy = :transaction
79
+ DatabaseCleaner.clean_with(:truncation)
80
+ end
81
+
82
+ config.around do |example|
83
+ DatabaseCleaner.cleaning do
84
+ example.run
85
+ end
86
+ end
87
+ end
88
+
89
+ Shoulda::Matchers.configure do |config|
90
+ config.integrate do |with|
91
+ with.test_framework :rspec
92
+ with.library :rails
93
+ end
94
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: datacrafts-io-skeleton
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Roman Ovcharov
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-08-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '5.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '5.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: thor
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.0.1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.1
55
+ description: Simple gem for fast rails apps creation.
56
+ email:
57
+ - overchind@gmail.com
58
+ executables:
59
+ - datacrafts-io-skeleton
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - ".rspec"
65
+ - ".rubocop.yml"
66
+ - ".travis.yml"
67
+ - CODE_OF_CONDUCT.md
68
+ - Gemfile
69
+ - Gemfile.lock
70
+ - LICENSE.txt
71
+ - README.md
72
+ - Rakefile
73
+ - bin/console
74
+ - bin/setup
75
+ - datacrafts-io-skeleton.gemspec
76
+ - exe/datacrafts-io-skeleton
77
+ - lib/datacrafts_io_skeleton.rb
78
+ - lib/datacrafts_io_skeleton/composer.rb
79
+ - lib/datacrafts_io_skeleton/rails_creator.rb
80
+ - lib/datacrafts_io_skeleton/version.rb
81
+ - templates/rails.rb
82
+ - templates/rubocop.yml.erb
83
+ - templates/spec.rb
84
+ homepage: https://github.com/datacrafts-io/skeleton
85
+ licenses:
86
+ - MIT
87
+ metadata:
88
+ allowed_push_host: https://rubygems.org/
89
+ homepage_uri: https://github.com/datacrafts-io/skeleton
90
+ source_code_uri: https://github.com/datacrafts-io/skeleton
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: 2.3.0
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubygems_version: 3.1.2
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: Simple gem for fast rails apps creation.
110
+ test_files: []