raygun 1.0.2 → 1.2.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 +5 -5
- data/.circleci/config.yml +66 -0
- data/.rubocop.yml +99 -0
- data/.ruby-version +1 -1
- data/CHANGES.md +45 -0
- data/Gemfile +1 -1
- data/README.md +111 -36
- data/Rakefile +9 -1
- data/bin/raygun +2 -2
- data/bin/setup +6 -0
- data/lib/colorize.rb +55 -55
- data/lib/raygun/c5_conventions.rb +65 -0
- data/lib/raygun/raygun.rb +134 -148
- data/lib/raygun/template_repo.rb +78 -0
- data/lib/raygun/version.rb +1 -1
- data/raygun.gemspec +13 -8
- data/spec/raygun/c5_conventions_spec.rb +41 -0
- data/spec/spec_helper.rb +1 -0
- metadata +75 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6464c730d406fd0cd161d886375e52ef103781865bfb7c81f382987351c08597
|
4
|
+
data.tar.gz: f01fc5f9e573314b6852e002e79e18ca49a1163fbcc9052008ab94ac24ab4d1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ac1c6b995395e8dffeb309443f204b7bd7799083b45e2ac3cf51dcc0d73a15621dcb9648da7fadb8aae133aa94bf06619d7285bc03c2c9b5b627e55bc9e2361
|
7
|
+
data.tar.gz: 1a6b817213c3ed7138a231e2f8b728b6d509c17a3e72f1a0e23248e6582261673156453c36f37fda3796774b2f0bd2946c66c32165ce9dc54281334a2a938828
|
@@ -0,0 +1,66 @@
|
|
1
|
+
version: 2.1
|
2
|
+
executors:
|
3
|
+
ruby:
|
4
|
+
parameters:
|
5
|
+
version:
|
6
|
+
description: "Ruby version number"
|
7
|
+
default: "2.7.2"
|
8
|
+
type: string
|
9
|
+
docker:
|
10
|
+
- image: cimg/ruby:<< parameters.version >>
|
11
|
+
|
12
|
+
commands:
|
13
|
+
bundle_install:
|
14
|
+
description: Install Ruby dependencies with Bundler
|
15
|
+
parameters:
|
16
|
+
version:
|
17
|
+
description: "Ruby version number"
|
18
|
+
default: "2.7.2"
|
19
|
+
type: string
|
20
|
+
steps:
|
21
|
+
- restore_cache:
|
22
|
+
keys:
|
23
|
+
- bundle-v1-{{ arch }}-<< parameters.version >>
|
24
|
+
- run:
|
25
|
+
name: Install Ruby Dependencies
|
26
|
+
command: |
|
27
|
+
gem install bundler -v 2.1.4 --conservative --no-document
|
28
|
+
bundle config --local path vendor/bundle
|
29
|
+
bundle check || (bundle install --jobs=4 --retry=3 && bundle clean)
|
30
|
+
- save_cache:
|
31
|
+
paths:
|
32
|
+
- ./vendor/bundle
|
33
|
+
key: bundle-v1-{{ arch }}-<< parameters.version >>-{{ checksum "Gemfile.lock" }}
|
34
|
+
|
35
|
+
jobs:
|
36
|
+
rubocop:
|
37
|
+
executor: ruby
|
38
|
+
steps:
|
39
|
+
- checkout
|
40
|
+
- bundle_install
|
41
|
+
- run: bundle exec rubocop
|
42
|
+
|
43
|
+
rspec:
|
44
|
+
parameters:
|
45
|
+
version:
|
46
|
+
description: "Ruby version number"
|
47
|
+
default: "2.7.2"
|
48
|
+
type: string
|
49
|
+
executor:
|
50
|
+
name: ruby
|
51
|
+
version: << parameters.version >>
|
52
|
+
steps:
|
53
|
+
- checkout
|
54
|
+
- bundle_install:
|
55
|
+
version: << parameters.version >>
|
56
|
+
- run: bundle exec rake spec
|
57
|
+
|
58
|
+
workflows:
|
59
|
+
version: 2
|
60
|
+
commit-workflow:
|
61
|
+
jobs:
|
62
|
+
- rubocop
|
63
|
+
- rspec:
|
64
|
+
matrix:
|
65
|
+
parameters:
|
66
|
+
version: ["2.5.8", "2.6.6", "2.7.2", "3.0.0"]
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.5
|
3
|
+
DisplayCopNames: true
|
4
|
+
DisplayStyleGuide: true
|
5
|
+
|
6
|
+
#
|
7
|
+
# Ruby Cops
|
8
|
+
#
|
9
|
+
|
10
|
+
Layout/CaseIndentation:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
Layout/FirstArrayElementIndentation:
|
14
|
+
EnforcedStyle: consistent
|
15
|
+
|
16
|
+
Layout/HashAlignment:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Layout/LineLength:
|
20
|
+
Max: 120
|
21
|
+
|
22
|
+
Layout/MultilineMethodCallIndentation:
|
23
|
+
EnforcedStyle: indented
|
24
|
+
|
25
|
+
Lint/AmbiguousBlockAssociation:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
Lint/ScriptPermission:
|
29
|
+
Exclude:
|
30
|
+
- "Rakefile"
|
31
|
+
|
32
|
+
Metrics/AbcSize:
|
33
|
+
Max: 35
|
34
|
+
Exclude:
|
35
|
+
- "spec/**/*"
|
36
|
+
|
37
|
+
Metrics/BlockLength:
|
38
|
+
CountComments: false
|
39
|
+
Max: 50
|
40
|
+
Exclude:
|
41
|
+
- "config/**/*"
|
42
|
+
- "spec/**/*"
|
43
|
+
|
44
|
+
Metrics/ClassLength:
|
45
|
+
Max: 250
|
46
|
+
Exclude:
|
47
|
+
- "spec/**/*"
|
48
|
+
|
49
|
+
Metrics/MethodLength:
|
50
|
+
Max: 25
|
51
|
+
Exclude:
|
52
|
+
- "db/migrate/*"
|
53
|
+
- "spec/**/*"
|
54
|
+
|
55
|
+
Naming/PredicateName:
|
56
|
+
Enabled: false
|
57
|
+
|
58
|
+
Security/YAMLLoad:
|
59
|
+
Enabled: false
|
60
|
+
|
61
|
+
Style/BarePercentLiterals:
|
62
|
+
EnforcedStyle: percent_q
|
63
|
+
|
64
|
+
Style/BlockDelimiters:
|
65
|
+
EnforcedStyle: braces_for_chaining
|
66
|
+
|
67
|
+
Style/Documentation:
|
68
|
+
Enabled: false
|
69
|
+
|
70
|
+
Style/EmptyMethod:
|
71
|
+
EnforcedStyle: expanded
|
72
|
+
|
73
|
+
Style/FrozenStringLiteralComment:
|
74
|
+
EnforcedStyle: never
|
75
|
+
|
76
|
+
Style/Lambda:
|
77
|
+
EnforcedStyle: literal
|
78
|
+
|
79
|
+
Style/ModuleFunction:
|
80
|
+
EnforcedStyle: extend_self
|
81
|
+
|
82
|
+
Style/MutableConstant:
|
83
|
+
Enabled: false
|
84
|
+
|
85
|
+
Style/PreferredHashMethods:
|
86
|
+
Enabled: false
|
87
|
+
|
88
|
+
Style/SpecialGlobalVars:
|
89
|
+
Enabled: false
|
90
|
+
|
91
|
+
Style/StringLiterals:
|
92
|
+
EnforcedStyle: double_quotes
|
93
|
+
|
94
|
+
Style/StringLiteralsInInterpolation:
|
95
|
+
EnforcedStyle: double_quotes
|
96
|
+
|
97
|
+
Style/StructInheritance:
|
98
|
+
Enabled: true
|
99
|
+
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2
|
1
|
+
2.7.2
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,50 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
**Note:** Don't let the apparent lack of activity here scare you away. Almost all changes are captured in the
|
4
|
+
prototype repo (see [raygun-rails](https://github.com/carbonfive/raygun-rails)), and it's kept pretty well up to date.
|
5
|
+
|
6
|
+
## 1.2.0 [2021-05-20]
|
7
|
+
|
8
|
+
New features:
|
9
|
+
|
10
|
+
* Copy the new rubocop conventions from the `main` branch of the c5-conventions repo (#163).
|
11
|
+
|
12
|
+
## 1.1.1 [2020-07-02]
|
13
|
+
|
14
|
+
Housekeeping:
|
15
|
+
|
16
|
+
* Fix compatibility so that any supported Ruby (currently 2.5+) is allowed (#165).
|
17
|
+
|
18
|
+
## 1.1.0 [2020-07-02]
|
19
|
+
|
20
|
+
Breaking:
|
21
|
+
|
22
|
+
* Require Ruby 2.4+ (#151)
|
23
|
+
|
24
|
+
New features:
|
25
|
+
|
26
|
+
* Copy `.rubocop.yml` template instead of using a fragile link to the c5-conventions repo (#148)
|
27
|
+
* Initialize zapped projects with a default branch of "main" (#157)
|
28
|
+
|
29
|
+
Docs:
|
30
|
+
|
31
|
+
* Add Bootstrap instructions to the README (it has been removed from the app prototype) (#141)
|
32
|
+
|
33
|
+
Housekeeping:
|
34
|
+
|
35
|
+
* Add bundler and rake development dependencies (#143)
|
36
|
+
* Upgrade to Ruby 2.6.5 (#142)
|
37
|
+
|
38
|
+
## 1.0.4 [2017-11-28]
|
39
|
+
|
40
|
+
* Tweak instructions: use `heroku local` instead of `foreman s` (#138, thanks @mattbrictson)
|
41
|
+
|
42
|
+
## 1.0.3 [2017-10-25]
|
43
|
+
|
44
|
+
* Add ability to pull template repository by branch name (#137, thanks @bunnymatic!).
|
45
|
+
* Updates to the README (mostly tweaks).
|
46
|
+
* Use Ruby 2.4.2 for development.
|
47
|
+
|
3
48
|
## 1.0.1 [2015-01-30]
|
4
49
|
|
5
50
|
* Simplify instructions: use ./bin/setup instead of explicit commands.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
[](http://badge.fury.io/rb/raygun)
|
2
|
+
<img src="https://raw.github.com/carbonfive/raygun/main/marvin.jpg" align="right"/>
|
3
3
|
|
4
4
|
# Raygun
|
5
5
|
|
6
6
|
Rails application generator that builds a new project skeleton configured with Carbon Five preferences and
|
7
7
|
best practices baked right in. Spend less time configuring and more building cool features.
|
8
8
|
|
9
|
-
Raygun generates Rails
|
9
|
+
Raygun generates Rails projects by copying this [sample app](https://github.com/carbonfive/raygun-rails)
|
10
10
|
and massaging it gently into shape.
|
11
11
|
|
12
12
|
Alternatively, Raygun allows you to specify your own prototype instead of the default sample app. See below
|
@@ -18,17 +18,15 @@ Major tools/libraries:
|
|
18
18
|
* PostgreSQL
|
19
19
|
* Slim
|
20
20
|
* Sass
|
21
|
-
*
|
22
|
-
*
|
23
|
-
* Factory Girl
|
24
|
-
* Jasmine
|
21
|
+
* RSpec and Capybara
|
22
|
+
* Factory Bot
|
25
23
|
* SimpleCov
|
26
|
-
* Guard (rspec,
|
27
|
-
* And many tweaks, patterns and common recipes (see [raygun-rails](https://github.com/carbonfive/raygun-rails) for all
|
24
|
+
* Guard (rspec, livereload)
|
25
|
+
* And many tweaks, patterns and common recipes (see [raygun-rails](https://github.com/carbonfive/raygun-rails) for all
|
26
|
+
the details).
|
28
27
|
|
29
28
|
Raygun includes generator templates for controllers, views, and specs so that generated code follows best
|
30
|
-
practices. For example,
|
31
|
-
girl when appropriate.
|
29
|
+
practices. For example, rspec specs use factory bot when appropriate.
|
32
30
|
|
33
31
|
Inspired by Xavier Shay work at Square and ThoughtBot's Suspenders. Thanks!
|
34
32
|
|
@@ -47,57 +45,126 @@ Raygun...
|
|
47
45
|
|
48
46
|
## Prerequisites
|
49
47
|
|
50
|
-
To generate an application, you only need the
|
48
|
+
To generate an application, you only need the Raygun gem and network connectivity.
|
51
49
|
|
52
50
|
To run your new application's specs or fire up its server, you'll need to meet these requirements.
|
53
51
|
|
54
|
-
* PostgreSQL 9.x with superuser 'postgres' with no password (
|
55
|
-
* PhantomJS for JavaScript testing (
|
52
|
+
* PostgreSQL 9.x with superuser 'postgres' with no password (`createuser -s postgres`)
|
53
|
+
* PhantomJS for JavaScript testing (`brew install phantomjs`)
|
56
54
|
|
57
|
-
The generated app will be configured to use the ruby version that was used to invoke
|
58
|
-
another ruby, just change the
|
55
|
+
The generated app will be configured to use the ruby version that was used to invoke Raygun. If you're using
|
56
|
+
another ruby, just change the `Gemfile` and `.ruby-version` as necessary.
|
59
57
|
|
60
58
|
## Usage
|
61
59
|
|
62
|
-
|
60
|
+
```bash
|
61
|
+
$ raygun your-project
|
62
|
+
```
|
63
63
|
|
64
|
-
Once your project is baked out, you can easily kick the wheels. Be sure that you have the
|
64
|
+
Once your project is baked out, you can easily kick the wheels. Be sure that you have the prerequisites
|
65
65
|
covered (see above).
|
66
66
|
|
67
|
-
|
68
|
-
|
67
|
+
```bash
|
68
|
+
$ cd your-project
|
69
|
+
$ bin/setup
|
69
70
|
|
70
|
-
|
71
|
-
|
71
|
+
# Run the specs, they should all pass
|
72
|
+
$ bin/rake
|
73
|
+
|
74
|
+
# Fire up the app and open it in a browser
|
75
|
+
$ heroku local
|
76
|
+
$ open http://localhost:3000
|
77
|
+
```
|
78
|
+
|
79
|
+
## Next Steps
|
80
|
+
|
81
|
+
### React
|
82
|
+
|
83
|
+
To add React, just run this generator:
|
84
|
+
|
85
|
+
```bash
|
86
|
+
$ bundle exec rails webpacker:install:react
|
87
|
+
```
|
88
|
+
|
89
|
+
You can use JSX in your `app/javascript` sources and the `react_component` helper in your Rails views. Your React code
|
90
|
+
will be packaged and deployed automatically with the rest of your app, and you can test it end-to-end with Capybara,
|
91
|
+
just like other Rails apps. See the [webpacker-react](https://github.com/renchap/webpacker-react) README for more
|
92
|
+
information.
|
93
|
+
|
94
|
+
> :bulb: Check out [spraygun-react](https://github.com/carbonfive/spraygun-react) for eslint and stylelint configurations that can work for React projects.
|
95
|
+
|
96
|
+
### React with Typescript
|
97
|
+
|
98
|
+
To add React with Typescript, run the React generator listed above, and then add Typescript:
|
99
|
+
|
100
|
+
```bash
|
101
|
+
$ bundle exec rails webpacker:install:typescript
|
102
|
+
```
|
103
|
+
|
104
|
+
Don't forget to rename any files containing JSX to `.tsx`.
|
105
|
+
|
106
|
+
For more information, see the [webpacker Typescript docs](https://github.com/rails/webpacker/blob/master/docs/typescript.md).
|
107
|
+
|
108
|
+
### Bootstrap
|
109
|
+
|
110
|
+
As you'll notice, the project comes with enough CSS (SCSS, actually) to establish some patterns. If you
|
111
|
+
need more of a framework, here are instructions on how to add Bootstrap to your new project.
|
112
|
+
|
113
|
+
```bash
|
114
|
+
$ yarn add bootstrap
|
115
|
+
$ rails generate simple_form:install --bootstrap
|
116
|
+
|
117
|
+
# Answer Yes to the question about overwriting your existing `config/initializers/simple_form.rb`
|
118
|
+
```
|
119
|
+
|
120
|
+
This generates an initializer and scaffold files for Rails view scaffolding.
|
121
|
+
|
122
|
+
Add Bootstrap imports to the top your `application.scss`
|
123
|
+
|
124
|
+
```css
|
125
|
+
// application.scss
|
126
|
+
@import "~bootstrap/scss/_functions";
|
127
|
+
@import "~bootstrap/scss/_variables";
|
128
|
+
|
129
|
+
...
|
130
|
+
```
|
131
|
+
|
132
|
+
Now you've got Bootstrap in the application.
|
133
|
+
|
134
|
+
We include `simple_form` in the project by default. For more information about using Bootstrap styling
|
135
|
+
on `simple_form` forms, check out the documentation here http://simple-form-bootstrap.plataformatec.com.br/documentation
|
72
136
|
|
73
|
-
# Fire up the app and open it in a browser
|
74
|
-
$ foreman start
|
75
|
-
$ open http://localhost:3000
|
76
137
|
|
77
138
|
## Using a Custom Project Template
|
78
139
|
|
79
140
|
The default is to use the project at [carbonfive/raygun-rails](https://github.com/carbonfive/raygun-rails) as a
|
80
|
-
starting point. You can use another repo as the project template with the
|
141
|
+
starting point. You can use another repo as the project template with the `-p` command line option.
|
81
142
|
|
82
|
-
If you invoke raygun with the
|
143
|
+
If you invoke raygun with the `-p` option, you can specify your own github repository.
|
83
144
|
|
84
145
|
$ raygun -p githubid/repo your-project
|
85
146
|
|
147
|
+
Or
|
148
|
+
|
149
|
+
$ raygun -p githubid/repo your-project#new-branch-name
|
150
|
+
|
86
151
|
The repository must:
|
87
152
|
|
88
|
-
|
89
|
-
* Not have any binary files. Raygun runs a 'sed' command on all files, which will fail on binaries, such as jar files.
|
153
|
+
Not have any binary files. Raygun runs a 'sed' command on all files, which will fail on binaries, such as jar files.
|
90
154
|
|
91
|
-
If
|
92
|
-
|
155
|
+
If you are not planning to pull the prototype repository by branch, it must also have a tag. Raygun will choose the
|
156
|
+
"greatest" tag and downloads the repository as of that tag.
|
157
|
+
|
158
|
+
If your project template requires a minimum version of Raygun, include the version in a file called
|
159
|
+
`.raygun-version` at the root. Raygun will make sure it's new enough for your repo.
|
93
160
|
|
94
161
|
## Internal Mechanics
|
95
162
|
|
96
163
|
Raygun fetches the greatest tag from the [carbonfive/raygun-rails](https://github.com/carbonfive/raygun-rails)
|
97
|
-
repo, unless it already has it cached in
|
164
|
+
repo, unless it already has it cached in `~/.raygun`, extracts the contents of the tarball, and runs a series of
|
98
165
|
search-and-replaces on the code to customize it accordingly.
|
99
166
|
|
100
|
-
This approach is fast, simple, and makes
|
167
|
+
This approach is fast, simple, and makes developmentn on Raygun very easy: make changes to the application
|
101
168
|
prototype (which is a valid rails app) and tag them when they should be used for new applications.
|
102
169
|
|
103
170
|
## Contributing
|
@@ -110,10 +177,18 @@ prototype (which is a valid rails app) and tag them when they should be used for
|
|
110
177
|
|
111
178
|
### Development
|
112
179
|
|
113
|
-
|
180
|
+
To set up your local environment, run:
|
181
|
+
|
182
|
+
$ bin/setup
|
183
|
+
|
184
|
+
To run tests and rubocop checks:
|
185
|
+
|
186
|
+
$ bundle exec rake
|
187
|
+
|
188
|
+
To generate an example app using your local development version of Raygun:
|
114
189
|
|
115
|
-
$
|
190
|
+
$ bin/raygun tmp/example_app
|
116
191
|
|
117
192
|
## Changes
|
118
193
|
|
119
|
-
[View the Change Log](https://github.com/carbonfive/raygun/tree/
|
194
|
+
[View the Change Log](https://github.com/carbonfive/raygun/tree/main/CHANGES.md)
|