raygun 1.0.1 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +66 -0
- data/.rubocop.yml +99 -0
- data/.ruby-version +1 -1
- data/CHANGES.md +39 -0
- data/Gemfile +1 -1
- data/README.md +110 -39
- data/Rakefile +9 -1
- data/bin/raygun +2 -2
- data/bin/setup +6 -0
- data/lib/colorize.rb +55 -55
- data/lib/raygun/raygun.rb +158 -143
- data/lib/raygun/template_repo.rb +78 -0
- data/lib/raygun/version.rb +1 -1
- data/raygun.gemspec +13 -8
- data/spec/raygun/runner_spec.rb +27 -0
- data/spec/spec_helper.rb +1 -0
- metadata +74 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: eeaeb612fe4e56ab156e26d6d8299598274e0e5a8baf66647a62a399c3245067
|
4
|
+
data.tar.gz: c41f24ad804b4e7301bc54de9d1ecb0f04390fc909cb9823e7855cc820c2442f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88423daeb034fca34d5db7c3b97836e61a462064c87788c07a3fa20d36774a9f86be6b782dff428eccc52651a919a1483dce2caae0591842577fb19ef6ef56bf
|
7
|
+
data.tar.gz: 86dd56014f3ddb0255f9ebc0796cdf038f06f8e7b7fc57c0fe9f72efeff9912a92a9c565c16bc4020b483013f667e6be4673a0a05a237ab4edddac79dcfbd094
|
@@ -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,44 @@
|
|
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.1.1 [2020-07-02]
|
7
|
+
|
8
|
+
Housekeeping:
|
9
|
+
|
10
|
+
* Fix compatibility so that any supported Rudy (currently 2.5+) is allowed (#165).
|
11
|
+
|
12
|
+
## 1.1.0 [2020-07-02]
|
13
|
+
|
14
|
+
Breaking:
|
15
|
+
|
16
|
+
* Require Ruby 2.4+ (#151)
|
17
|
+
|
18
|
+
New features:
|
19
|
+
|
20
|
+
* Copy `.rubocop.yml` template instead of using a fragile link to the c5-conventions repo (#148)
|
21
|
+
* Initialize zapped projects with a default branch of "main" (#157)
|
22
|
+
|
23
|
+
Docs:
|
24
|
+
|
25
|
+
* Add Bootstrap instructions to the README (it has been removed from the app prototype) (#141)
|
26
|
+
|
27
|
+
Housekeeping:
|
28
|
+
|
29
|
+
* Add bundler and rake development dependencies (#143)
|
30
|
+
* Upgrade to Ruby 2.6.5 (#142)
|
31
|
+
|
32
|
+
## 1.0.4 [2017-11-28]
|
33
|
+
|
34
|
+
* Tweak instructions: use `heroku local` instead of `foreman s` (#138, thanks @mattbrictson)
|
35
|
+
|
36
|
+
## 1.0.3 [2017-10-25]
|
37
|
+
|
38
|
+
* Add ability to pull template repository by branch name (#137, thanks @bunnymatic!).
|
39
|
+
* Updates to the README (mostly tweaks).
|
40
|
+
* Use Ruby 2.4.2 for development.
|
41
|
+
|
3
42
|
## 1.0.1 [2015-01-30]
|
4
43
|
|
5
44
|
* Simplify instructions: use ./bin/setup instead of explicit commands.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
[![Gem Version](https://badge.fury.io/rb/raygun.
|
2
|
-
<img src="https://raw.github.com/carbonfive/raygun/
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/raygun.svg)](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,61 +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
|
-
|
69
|
-
|
67
|
+
```bash
|
68
|
+
$ cd your-project
|
69
|
+
$ bin/setup
|
70
70
|
|
71
|
-
|
72
|
-
|
71
|
+
# Run the specs, they should all pass
|
72
|
+
$ bin/rake
|
73
73
|
|
74
|
-
|
75
|
-
|
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
|
76
136
|
|
77
|
-
# Fire up the app and open it in a browser
|
78
|
-
$ foreman start
|
79
|
-
$ open http://localhost:3000
|
80
137
|
|
81
138
|
## Using a Custom Project Template
|
82
139
|
|
83
140
|
The default is to use the project at [carbonfive/raygun-rails](https://github.com/carbonfive/raygun-rails) as a
|
84
|
-
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.
|
85
142
|
|
86
|
-
If you invoke raygun with the
|
143
|
+
If you invoke raygun with the `-p` option, you can specify your own github repository.
|
87
144
|
|
88
145
|
$ raygun -p githubid/repo your-project
|
89
146
|
|
147
|
+
Or
|
148
|
+
|
149
|
+
$ raygun -p githubid/repo your-project#new-branch-name
|
150
|
+
|
90
151
|
The repository must:
|
91
152
|
|
92
|
-
|
93
|
-
* 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.
|
94
154
|
|
95
|
-
If
|
96
|
-
|
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.
|
97
160
|
|
98
161
|
## Internal Mechanics
|
99
162
|
|
100
163
|
Raygun fetches the greatest tag from the [carbonfive/raygun-rails](https://github.com/carbonfive/raygun-rails)
|
101
|
-
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
|
102
165
|
search-and-replaces on the code to customize it accordingly.
|
103
166
|
|
104
|
-
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
|
105
168
|
prototype (which is a valid rails app) and tag them when they should be used for new applications.
|
106
169
|
|
107
170
|
## Contributing
|
@@ -114,10 +177,18 @@ prototype (which is a valid rails app) and tag them when they should be used for
|
|
114
177
|
|
115
178
|
### Development
|
116
179
|
|
117
|
-
|
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:
|
118
189
|
|
119
|
-
$
|
190
|
+
$ bin/raygun tmp/example_app
|
120
191
|
|
121
192
|
## Changes
|
122
193
|
|
123
|
-
[View the Change Log](https://github.com/carbonfive/raygun/tree/
|
194
|
+
[View the Change Log](https://github.com/carbonfive/raygun/tree/main/CHANGES.md)
|