cavendish 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +103 -0
- data/.circleci/setup-rubygems.sh +3 -0
- data/.editorconfig +24 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.rubocop.yml +496 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +11 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +143 -0
- data/Guardfile +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +82 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/cavendish.gemspec +33 -0
- data/exe/cavendish +8 -0
- data/lib/cavendish.rb +13 -0
- data/lib/cavendish/assets/.circleci/config.yml +93 -0
- data/lib/cavendish/assets/.eslintrc.json +43 -0
- data/lib/cavendish/assets/.node-version +1 -0
- data/lib/cavendish/assets/App.jsx +12 -0
- data/lib/cavendish/assets/README.md.erb +59 -0
- data/lib/cavendish/assets/src/navigators/HomeNavigator.jsx +17 -0
- data/lib/cavendish/assets/src/screens/HomeScreen.jsx.erb +16 -0
- data/lib/cavendish/assets/src/screens/__specs__/HomeScreen.spec.js.erb +22 -0
- data/lib/cavendish/assets/src/utils/tailwindRn.js +7 -0
- data/lib/cavendish/assets/tailwind.config.js +8 -0
- data/lib/cavendish/cli.rb +53 -0
- data/lib/cavendish/commands/add_ci_config.rb +16 -0
- data/lib/cavendish/commands/add_eslint.rb +33 -0
- data/lib/cavendish/commands/add_react_navigation.rb +45 -0
- data/lib/cavendish/commands/add_readme.rb +15 -0
- data/lib/cavendish/commands/add_tailwind.rb +31 -0
- data/lib/cavendish/commands/add_testing.rb +81 -0
- data/lib/cavendish/commands/base.rb +9 -0
- data/lib/cavendish/commands/configure_git.rb +22 -0
- data/lib/cavendish/commands/create_expo_project.rb +20 -0
- data/lib/cavendish/config.rb +18 -0
- data/lib/cavendish/utils.rb +74 -0
- data/lib/cavendish/version.rb +5 -0
- metadata +260 -0
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.7
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# Change Log
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
|
+
|
5
|
+
### Unreleased
|
6
|
+
|
7
|
+
### 0.1.0
|
8
|
+
|
9
|
+
Features:
|
10
|
+
- Add base generator [#2](https://github.com/platanus/cavendish/pull/2)
|
11
|
+
- Add Enzyme as a choice [#5](https://github.com/platanus/cavendish/pull/5)
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cavendish (0.1.0)
|
5
|
+
colorize
|
6
|
+
commander (~> 4.4, >= 4.4.0)
|
7
|
+
power-types
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
activesupport (6.1.4)
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
+
i18n (>= 1.6, < 2)
|
15
|
+
minitest (>= 5.1)
|
16
|
+
tzinfo (~> 2.0)
|
17
|
+
zeitwerk (~> 2.3)
|
18
|
+
ast (2.4.2)
|
19
|
+
coderay (1.1.3)
|
20
|
+
colorize (0.8.1)
|
21
|
+
commander (4.6.0)
|
22
|
+
highline (~> 2.0.0)
|
23
|
+
concurrent-ruby (1.1.9)
|
24
|
+
coveralls (0.8.23)
|
25
|
+
json (>= 1.8, < 3)
|
26
|
+
simplecov (~> 0.16.1)
|
27
|
+
term-ansicolor (~> 1.3)
|
28
|
+
thor (>= 0.19.4, < 2.0)
|
29
|
+
tins (~> 1.6)
|
30
|
+
diff-lcs (1.4.4)
|
31
|
+
docile (1.4.0)
|
32
|
+
ffi (1.15.3)
|
33
|
+
formatador (0.3.0)
|
34
|
+
guard (2.18.0)
|
35
|
+
formatador (>= 0.2.4)
|
36
|
+
listen (>= 2.7, < 4.0)
|
37
|
+
lumberjack (>= 1.0.12, < 2.0)
|
38
|
+
nenv (~> 0.1)
|
39
|
+
notiffany (~> 0.0)
|
40
|
+
pry (>= 0.13.0)
|
41
|
+
shellany (~> 0.0)
|
42
|
+
thor (>= 0.18.1)
|
43
|
+
guard-compat (1.2.1)
|
44
|
+
guard-rspec (4.7.3)
|
45
|
+
guard (~> 2.1)
|
46
|
+
guard-compat (~> 1.1)
|
47
|
+
rspec (>= 2.99.0, < 4.0)
|
48
|
+
highline (2.0.3)
|
49
|
+
i18n (1.8.10)
|
50
|
+
concurrent-ruby (~> 1.0)
|
51
|
+
json (2.5.1)
|
52
|
+
listen (3.6.0)
|
53
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
54
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
55
|
+
lumberjack (1.2.8)
|
56
|
+
method_source (1.0.0)
|
57
|
+
minitest (5.14.4)
|
58
|
+
nenv (0.3.0)
|
59
|
+
notiffany (0.1.3)
|
60
|
+
nenv (~> 0.1)
|
61
|
+
shellany (~> 0.0)
|
62
|
+
parallel (1.20.1)
|
63
|
+
parser (3.0.2.0)
|
64
|
+
ast (~> 2.4.1)
|
65
|
+
power-types (0.4.0)
|
66
|
+
activesupport
|
67
|
+
pry (0.14.1)
|
68
|
+
coderay (~> 1.1)
|
69
|
+
method_source (~> 1.0)
|
70
|
+
rack (2.2.3)
|
71
|
+
rainbow (3.0.0)
|
72
|
+
rake (12.3.3)
|
73
|
+
rb-fsevent (0.11.0)
|
74
|
+
rb-inotify (0.10.1)
|
75
|
+
ffi (~> 1.0)
|
76
|
+
regexp_parser (2.1.1)
|
77
|
+
rexml (3.2.5)
|
78
|
+
rspec (3.10.0)
|
79
|
+
rspec-core (~> 3.10.0)
|
80
|
+
rspec-expectations (~> 3.10.0)
|
81
|
+
rspec-mocks (~> 3.10.0)
|
82
|
+
rspec-core (3.10.1)
|
83
|
+
rspec-support (~> 3.10.0)
|
84
|
+
rspec-expectations (3.10.1)
|
85
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
86
|
+
rspec-support (~> 3.10.0)
|
87
|
+
rspec-mocks (3.10.2)
|
88
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
89
|
+
rspec-support (~> 3.10.0)
|
90
|
+
rspec-support (3.10.2)
|
91
|
+
rspec_junit_formatter (0.4.1)
|
92
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
93
|
+
rubocop (1.18.4)
|
94
|
+
parallel (~> 1.10)
|
95
|
+
parser (>= 3.0.0.0)
|
96
|
+
rainbow (>= 2.2.2, < 4.0)
|
97
|
+
regexp_parser (>= 1.8, < 3.0)
|
98
|
+
rexml
|
99
|
+
rubocop-ast (>= 1.8.0, < 2.0)
|
100
|
+
ruby-progressbar (~> 1.7)
|
101
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
102
|
+
rubocop-ast (1.8.0)
|
103
|
+
parser (>= 3.0.1.1)
|
104
|
+
rubocop-rails (2.11.3)
|
105
|
+
activesupport (>= 4.2.0)
|
106
|
+
rack (>= 1.1)
|
107
|
+
rubocop (>= 1.7.0, < 2.0)
|
108
|
+
ruby-progressbar (1.11.0)
|
109
|
+
shellany (0.0.1)
|
110
|
+
simplecov (0.16.1)
|
111
|
+
docile (~> 1.1)
|
112
|
+
json (>= 1.8, < 3)
|
113
|
+
simplecov-html (~> 0.10.0)
|
114
|
+
simplecov-html (0.10.2)
|
115
|
+
sync (0.5.0)
|
116
|
+
term-ansicolor (1.7.1)
|
117
|
+
tins (~> 1.0)
|
118
|
+
thor (1.1.0)
|
119
|
+
tins (1.29.1)
|
120
|
+
sync
|
121
|
+
tzinfo (2.0.4)
|
122
|
+
concurrent-ruby (~> 1.0)
|
123
|
+
unicode-display_width (2.0.0)
|
124
|
+
zeitwerk (2.4.2)
|
125
|
+
|
126
|
+
PLATFORMS
|
127
|
+
arm64-darwin-20
|
128
|
+
x86_64-linux
|
129
|
+
|
130
|
+
DEPENDENCIES
|
131
|
+
bundler (~> 2.2.15)
|
132
|
+
cavendish!
|
133
|
+
coveralls
|
134
|
+
guard-rspec
|
135
|
+
pry
|
136
|
+
rake (~> 12.0)
|
137
|
+
rspec (~> 3.0)
|
138
|
+
rspec_junit_formatter
|
139
|
+
rubocop (~> 1.9)
|
140
|
+
rubocop-rails
|
141
|
+
|
142
|
+
BUNDLED WITH
|
143
|
+
2.2.24
|
data/Guardfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright 2021 Platanus
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# Cavendish
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/cavendish.svg)](https://badge.fury.io/rb/cavendish)
|
4
|
+
[![CircleCI](https://circleci.com/gh/platanus/cavendish.svg?style=shield)](https://app.circleci.com/pipelines/github/platanus/cavendish)
|
5
|
+
|
6
|
+
React Native + Expo project generator for Platanus
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
```bash
|
11
|
+
$ gem install cavendish
|
12
|
+
```
|
13
|
+
|
14
|
+
Or add to your Gemfile:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem "cavendish"
|
18
|
+
```
|
19
|
+
|
20
|
+
```bash
|
21
|
+
bundle install
|
22
|
+
```
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
> Cavendish uses Yarn under the hood, so make sure that you've installed in your system before running the generator.
|
27
|
+
|
28
|
+
Use the `cavendish create` command to create a new project:
|
29
|
+
|
30
|
+
$ cavendish create <project-name>
|
31
|
+
|
32
|
+
This command will ask for your preferences on some packages and generate a full React Native + Expo project with:
|
33
|
+
|
34
|
+
- ESLint
|
35
|
+
- Testing with Jest (either with `@testing-library/react-native` or `enzyme`)
|
36
|
+
- A base `@react-navigation` config for navigation and screens
|
37
|
+
- A base `tailwind-rn` for managing styles
|
38
|
+
- CI configuration for CircleCI
|
39
|
+
- An initialized Git repository
|
40
|
+
|
41
|
+
The generator uses the `expo-cli` to generate a blank managed workflow project. *Bare workflow* projects are not supported for now.
|
42
|
+
|
43
|
+
## Testing
|
44
|
+
|
45
|
+
To run the specs you need to execute, **in the root path of the gem**, the following command:
|
46
|
+
|
47
|
+
```bash
|
48
|
+
bundle exec guard
|
49
|
+
```
|
50
|
+
|
51
|
+
You need to put **all your tests** in the `/my_gem/spec/` directory.
|
52
|
+
|
53
|
+
## Publishing
|
54
|
+
|
55
|
+
On master/main branch...
|
56
|
+
|
57
|
+
1. Change `VERSION` in `lib/cavendish/version.rb`.
|
58
|
+
2. Change `Unreleased` title to current version in `CHANGELOG.md`.
|
59
|
+
3. Run `bundle install`.
|
60
|
+
4. Commit new release. For example: `Releasing v0.1.0`.
|
61
|
+
5. Create tag. For example: `git tag v0.1.0`.
|
62
|
+
6. Push tag. For example: `git push origin v0.1.0`.
|
63
|
+
|
64
|
+
## Contributing
|
65
|
+
|
66
|
+
1. Fork it
|
67
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
68
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
69
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
70
|
+
5. Create new Pull Request
|
71
|
+
|
72
|
+
## Credits
|
73
|
+
|
74
|
+
Thank you [contributors](https://github.com/platanus/cavendish/graphs/contributors)!
|
75
|
+
|
76
|
+
<img src="http://platan.us/gravatar_with_text.png" alt="Platanus" width="250"/>
|
77
|
+
|
78
|
+
Cavendish is maintained by [platanus](http://platan.us).
|
79
|
+
|
80
|
+
## License
|
81
|
+
|
82
|
+
Cavendish is © 2021 platanus, spa. It is free software and may be redistributed under the terms specified in the LICENSE file.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "cavendish"
|
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__)
|
data/bin/setup
ADDED
data/cavendish.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "cavendish/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "cavendish"
|
8
|
+
spec.version = Cavendish::VERSION
|
9
|
+
spec.authors = ["Platanus"]
|
10
|
+
spec.email = ["rubygems@platan.us"]
|
11
|
+
spec.homepage = "https://github.com/platanus/cavendish/master"
|
12
|
+
spec.summary = "React Native + Expo project generator for Platanus"
|
13
|
+
spec.description = "React Native + Expo project generator for Platanus"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "colorize"
|
22
|
+
spec.add_dependency "commander", "~> 4.4", ">= 4.4.0"
|
23
|
+
spec.add_dependency "power-types"
|
24
|
+
spec.add_development_dependency "bundler", "~> 2.2.15"
|
25
|
+
spec.add_development_dependency "coveralls"
|
26
|
+
spec.add_development_dependency "guard-rspec"
|
27
|
+
spec.add_development_dependency "pry"
|
28
|
+
spec.add_development_dependency "rake"
|
29
|
+
spec.add_development_dependency "rspec"
|
30
|
+
spec.add_development_dependency "rspec_junit_formatter"
|
31
|
+
spec.add_development_dependency "rubocop", "~> 1.9"
|
32
|
+
spec.add_development_dependency "rubocop-rails"
|
33
|
+
end
|
data/exe/cavendish
ADDED
data/lib/cavendish.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require "commander"
|
2
|
+
require "colorize"
|
3
|
+
require "power-types"
|
4
|
+
|
5
|
+
require "cavendish/version"
|
6
|
+
require "cavendish/config"
|
7
|
+
require "cavendish/utils"
|
8
|
+
|
9
|
+
require "cavendish/commands/base"
|
10
|
+
Dir[File.join(__dir__, 'cavendish', 'commands', '*.rb')].each { |path| require_relative path }
|
11
|
+
|
12
|
+
module Cavendish
|
13
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
version: 2.1
|
2
|
+
|
3
|
+
node-image: &node-image circleci/node:14
|
4
|
+
|
5
|
+
executors:
|
6
|
+
base-executor:
|
7
|
+
docker:
|
8
|
+
- image: *node-image
|
9
|
+
|
10
|
+
commands:
|
11
|
+
setup:
|
12
|
+
description: checkout code, restore cache, install dependencies, save cache
|
13
|
+
steps:
|
14
|
+
- checkout
|
15
|
+
- restore_cache:
|
16
|
+
keys:
|
17
|
+
- yarn-dependencies-{{ checksum "yarn.lock" }}
|
18
|
+
- yarn-dependencies-
|
19
|
+
- run:
|
20
|
+
name: Install yarn dependencies
|
21
|
+
command: yarn install --frozen-lockfile
|
22
|
+
- save_cache:
|
23
|
+
key: yarn-dependencies-{{ checksum "yarn.lock" }}
|
24
|
+
paths:
|
25
|
+
- node_modules
|
26
|
+
deploy_expo:
|
27
|
+
description: deploys app to expo
|
28
|
+
steps:
|
29
|
+
- run:
|
30
|
+
name: Check if EXPO_TOKEN environment variable is defined
|
31
|
+
command: $([ -v EXPO_TOKEN ])
|
32
|
+
- run:
|
33
|
+
name: Install Expo CLI and add yarn global path
|
34
|
+
command: |
|
35
|
+
yarn global add expo-cli
|
36
|
+
echo 'export PATH="$HOME/.yarn/bin:$PATH"' >> $BASH_ENV
|
37
|
+
- run:
|
38
|
+
name: Publish to expo
|
39
|
+
command: expo publish --non-interactive
|
40
|
+
|
41
|
+
jobs:
|
42
|
+
test:
|
43
|
+
executor: base-executor
|
44
|
+
steps:
|
45
|
+
- setup
|
46
|
+
- run:
|
47
|
+
name: Yarn test
|
48
|
+
command: yarn test
|
49
|
+
|
50
|
+
lint:
|
51
|
+
executor: base-executor
|
52
|
+
steps:
|
53
|
+
- setup
|
54
|
+
- run:
|
55
|
+
name: Install reviewdog
|
56
|
+
command: |
|
57
|
+
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b ./bin
|
58
|
+
- run:
|
59
|
+
name: Get files to lint
|
60
|
+
command: mkdir tmp && git diff origin/main --name-only --diff-filter=d > tmp/files_to_lint
|
61
|
+
- run:
|
62
|
+
name: Run eslint
|
63
|
+
shell: /bin/bash
|
64
|
+
command: |
|
65
|
+
cat tmp/files_to_lint | grep -E '.+\.(js|jsx|vue)$' | xargs yarn run eslint \
|
66
|
+
| ./bin/reviewdog -reporter=github-pr-review -f=eslint
|
67
|
+
- run:
|
68
|
+
name: Run stylelint
|
69
|
+
shell: /bin/bash
|
70
|
+
command: |
|
71
|
+
cat tmp/files_to_lint | grep -E '.+\.(js|jsx|scss|css|less)$' | xargs yarn run stylelint \
|
72
|
+
| ./bin/reviewdog -reporter=github-pr-review -f=stylelint
|
73
|
+
|
74
|
+
deploy:
|
75
|
+
executor: base-executor
|
76
|
+
steps:
|
77
|
+
- setup
|
78
|
+
|
79
|
+
workflows:
|
80
|
+
version: 2
|
81
|
+
test_lint_and_deploy:
|
82
|
+
jobs:
|
83
|
+
- test
|
84
|
+
- lint:
|
85
|
+
context: org-global
|
86
|
+
- deploy:
|
87
|
+
requires:
|
88
|
+
- test
|
89
|
+
- lint
|
90
|
+
filters:
|
91
|
+
branches:
|
92
|
+
only:
|
93
|
+
- main
|