generic_app 2.1.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +92 -6
- data/.rspec +2 -0
- data/.rubocop.yml +10 -16
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +2 -2
- data/LICENSE.txt +17 -18
- data/README.md +33 -30
- data/Rakefile +3 -2
- data/all.sh +3 -15
- data/bin/console +14 -0
- data/bin/setup +1 -1
- data/code_test.sh +11 -6
- data/credentials.sh +40 -39
- data/gem_console.sh +4 -0
- data/gem_install.sh +8 -10
- data/gem_test.sh +5 -13
- data/generic_app.gemspec +12 -6
- data/git_check.sh +13 -0
- data/lib/generic_app/version.rb +1 -1
- data/lib/generic_app.rb +14 -14
- data/long_test.sh +22 -0
- metadata +60 -18
- data/.codeclimate.yml +0 -8
- data/.travis.yml +0 -8
- data/lib/generic_app/git_clone_url.txt +0 -1
- data/spec/lib/generic_app_spec.rb +0 -57
- data/spec/spec_helper.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6591daca4bb4751629e25fe7a278ef3b2ba0356f
|
4
|
+
data.tar.gz: 7ca9558c27369dd4114eda56ce5d6c9a935ce3e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 332d3c2d00d4c85ebf8ae23c6ea4da4fe2af40d0f5cc2e9b084ba8b091d4448469174fcf04456abdfaf2d73c82125b122200e09f007c342d4937d690751ea19f
|
7
|
+
data.tar.gz: a84c5cc284202da87ee7e4df8dc463b680e8ddb0bf182f30b7b6391e3fccb4707104c8fc25813f254d6f4a45345eccac5a1b6fe04f7e8df239e7807b679a09f7
|
data/.gitignore
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
########################
|
2
|
+
# BEGIN:initial contents
|
3
|
+
########################
|
1
4
|
/.bundle/
|
2
5
|
/.yardoc
|
3
6
|
/Gemfile.lock
|
@@ -7,13 +10,96 @@
|
|
7
10
|
/pkg/
|
8
11
|
/spec/reports/
|
9
12
|
/tmp/
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
|
14
|
+
# rspec failure tracking
|
15
|
+
.rspec_status
|
16
|
+
#######################
|
17
|
+
# END: initial contents
|
18
|
+
#######################
|
19
|
+
|
20
|
+
################################
|
21
|
+
# BEGIN: Windows files to ignore
|
22
|
+
################################
|
23
|
+
# FROM https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
|
24
|
+
|
25
|
+
# Windows image file caches
|
26
|
+
Thumbs.db
|
27
|
+
ehthumbs.db
|
28
|
+
|
29
|
+
# Folder config file
|
30
|
+
Desktop.ini
|
31
|
+
|
32
|
+
# Recycle Bin used on file shares
|
33
|
+
$RECYCLE.BIN/
|
34
|
+
|
35
|
+
# Windows Installer files
|
36
|
+
*.cab
|
37
|
+
*.msi
|
38
|
+
*.msm
|
39
|
+
*.msp
|
40
|
+
|
41
|
+
# Windows shortcuts
|
42
|
+
*.lnk
|
43
|
+
##############################
|
44
|
+
# END: Windows files to ignore
|
45
|
+
##############################
|
46
|
+
|
47
|
+
#############################
|
48
|
+
# BEGIN: OS X files to ignore
|
49
|
+
#############################
|
50
|
+
# FROM https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
|
51
|
+
|
52
|
+
*.DS_Store
|
53
|
+
.AppleDouble
|
54
|
+
.LSOverride
|
55
|
+
|
56
|
+
# Icon must end with two \r
|
57
|
+
Icon
|
58
|
+
|
59
|
+
|
60
|
+
# Thumbnails
|
61
|
+
._*
|
62
|
+
|
63
|
+
# Files that might appear in the root of a volume
|
64
|
+
.DocumentRevisions-V100
|
65
|
+
.fseventsd
|
66
|
+
.Spotlight-V100
|
67
|
+
.TemporaryItems
|
68
|
+
.Trashes
|
69
|
+
.VolumeIcon.icns
|
70
|
+
.com.apple.timemachine.donotpresent
|
71
|
+
|
72
|
+
# Directories potentially created on remote AFP share
|
73
|
+
.AppleDB
|
74
|
+
.AppleDesktop
|
75
|
+
Network Trash Folder
|
76
|
+
Temporary Items
|
77
|
+
.apdisk
|
78
|
+
###########################
|
79
|
+
# END: OS X files to ignore
|
80
|
+
###########################
|
81
|
+
|
82
|
+
##############################
|
83
|
+
# BEGIN: Linux files to ignore
|
84
|
+
##############################
|
85
|
+
# FROM https://github.com/github/gitignore/blob/master/Global/Linux.gitignore
|
86
|
+
|
87
|
+
*~
|
88
|
+
|
89
|
+
# temporary files which can be created if a process still has a handle open of a deleted file
|
90
|
+
.fuse_hidden*
|
91
|
+
|
92
|
+
# KDE directory preferences
|
93
|
+
.directory
|
94
|
+
|
95
|
+
# Linux trash folder which might appear on any partition or disk
|
96
|
+
.Trash-*
|
97
|
+
############################
|
98
|
+
# END: Linux files to ignore
|
99
|
+
############################
|
15
100
|
|
16
101
|
*.gem
|
17
102
|
tmp*
|
18
|
-
.DS_Store
|
19
103
|
/log/
|
104
|
+
|
105
|
+
# NOTE: Comments MUST get their own dedicated lines and cannot be shared with that of the file name.
|
data/.rspec
ADDED
data/.rubocop.yml
CHANGED
@@ -1,26 +1,20 @@
|
|
1
|
-
|
1
|
+
Metrics/LineLength:
|
2
2
|
Exclude:
|
3
|
-
-
|
4
|
-
-
|
5
|
-
-
|
3
|
+
- generic_app.gemspec
|
4
|
+
- spec/generic_app_spec.rb
|
5
|
+
- lib/generic_app.rb
|
6
6
|
|
7
7
|
Metrics/BlockLength:
|
8
|
-
Exclude:
|
9
|
-
- spec/lib/generic_app_spec.rb
|
10
|
-
|
11
|
-
Metrics/LineLength:
|
12
8
|
Exclude:
|
13
9
|
- generic_app.gemspec
|
14
|
-
-
|
15
|
-
- spec/lib/generic_app_spec.rb
|
10
|
+
- spec/generic_app_spec.rb
|
16
11
|
|
17
|
-
|
12
|
+
AllCops:
|
18
13
|
Exclude:
|
19
|
-
-
|
14
|
+
- tmp/vulnerabilities/*
|
15
|
+
- tmp/vulnerabilities/lib/*
|
16
|
+
- tmp/vulnerabilities/spec/*
|
20
17
|
|
21
|
-
|
18
|
+
Metrics/MethodLength:
|
22
19
|
Exclude:
|
23
20
|
- lib/generic_app.rb
|
24
|
-
|
25
|
-
Style/VariableNumber:
|
26
|
-
Enabled: false
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -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 rubyist@jasonhsu.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 [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
@@ -1,22 +1,21 @@
|
|
1
|
-
|
1
|
+
The MIT License (MIT)
|
2
2
|
|
3
|
-
|
3
|
+
Copyright (c) 2017 Jason Hsu
|
4
4
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
the following conditions:
|
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:
|
12
11
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
15
14
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
OF
|
22
|
-
|
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
CHANGED
@@ -1,53 +1,56 @@
|
|
1
|
-
[![
|
2
|
-
[![Dependency Status](https://gemnasium.com/jhsu802701/generic_app.svg)](https://gemnasium.com/jhsu802701/generic_app)
|
3
|
-
[![Build Status](https://travis-ci.org/jhsu802701/generic_app.svg?branch=master)](http://travis-ci.org/jhsu802701/generic_app)
|
4
|
-
[![Code Climate](https://codeclimate.com/github/jhsu802701/generic_app/badges/gpa.svg)](https://codeclimate.com/github/jhsu802701/generic_app)
|
5
|
-
<a href="https://codeclimate.com/github/jhsu802701/generic_app/coverage"><img src="https://codeclimate.com/github/jhsu802701/generic_app/badges/coverage.svg" /></a>
|
1
|
+
[![CircleCI](https://circleci.com/gh/jhsu802701/generic_app.svg?style=svg)](https://circleci.com/gh/jhsu802701/generic_app)
|
2
|
+
[![Dependency Status](https://gemnasium.com/badges/github.com/jhsu802701/generic_app.svg)](https://gemnasium.com/github.com/jhsu802701/generic_app)
|
6
3
|
[![security](https://hakiri.io/github/jhsu802701/generic_app/master.svg)](https://hakiri.io/github/jhsu802701/generic_app/master)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/jhsu802701/generic_app/badges/gpa.svg)](https://codeclimate.com/github/jhsu802701/generic_app)
|
5
|
+
[![Test Coverage](https://codeclimate.com/github/jhsu802701/generic_app/badges/coverage.svg)](https://codeclimate.com/github/jhsu802701/generic_app/coverage)
|
7
6
|
|
8
7
|
# GenericApp
|
9
8
|
|
10
|
-
Welcome to GenericApp, the #1 most comprehensive Rails app generator!
|
9
|
+
Welcome to GenericApp, the #1 most comprehensive Rails app generator! No other method of starting a Rails app can save you so much time and effort. Stop reinventing the wheel every time you start a new Rails project. User authentication, comprehensive tests, Twitter bootstrap styling, and other features that are desirable in all or most Rails apps are implemented in advance. You get post-installation scripts that consolidate routine multi-step tasks into one step, including the process of setting up your app for PostgreSQL. Outlines of the initial MVC architecture of your new app are also provided. Only GenericApp way gives you a comprehensive Rails app in just a few minutes. If you're not exactly a GenericApp user, then you're not exactly viable at Startup Weekend or 24-hour web site challenges.
|
11
10
|
|
12
11
|
## Prerequisites
|
13
12
|
|
14
|
-
You must have not only Ruby on Rails installed but SQLite and PostgreSQL installed as well. Everything you need to use the GenericApp gem is pre-installed in my general purpose Debian Stable Docker image (rbenv-general) for Ruby On Rails. To get started, go to the [Ruby on Racetracks web site]
|
13
|
+
You must have not only Ruby on Rails installed but SQLite and PostgreSQL installed as well. Everything you need to use the GenericApp gem is pre-installed in my general purpose Debian Stable Docker image (rbenv-general) for Ruby On Rails. To get started, go to the [Ruby on Racetracks web site](http://www.rubyonracetracks.com/tutorials).
|
15
14
|
|
16
15
|
## Installation
|
17
16
|
|
18
|
-
|
17
|
+
Add this line to your application's Gemfile:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
gem 'generic_app'
|
21
|
+
```
|
22
|
+
|
23
|
+
And then execute:
|
24
|
+
|
25
|
+
$ bundle
|
26
|
+
|
27
|
+
Or install it yourself as:
|
19
28
|
|
20
29
|
$ gem install generic_app
|
21
30
|
|
22
31
|
## Usage
|
23
32
|
|
24
|
-
Go to the directory where you keep your Rails projects and enter the command "generic_app".
|
25
|
-
|
26
|
-
After you have provided all of the necessary parameters, your generic Rails project will not only be created for you but automatically tested, outlined, and seeded as well. This takes a few minutes instead of many long and grueling hours.
|
27
|
-
|
28
|
-
## How Does This Work?
|
33
|
+
* Go to the directory where you keep your Rails projects and enter the command "generic_app".
|
34
|
+
* After you have provided all of the necessary parameters, your generic Rails project will be available for you in just a few seconds. This saves you many hours of hard work.
|
29
35
|
|
30
|
-
|
36
|
+
## Development
|
31
37
|
|
32
|
-
|
38
|
+
* To test this gem, enter the command "sh gem_test.sh".
|
39
|
+
* To test this gem AND the app created during this process, enter the command "sh long_test.sh".
|
40
|
+
* To install this gem, enter the command "sh gem_install.sh".
|
41
|
+
* To test the source code for various metrics, enter the command "sh code_test.sh".
|
42
|
+
* To do all of the above, enter the command "sh all.sh".
|
43
|
+
* To run an interactive prompt, enter the command "sh console.sh".
|
44
|
+
* To release a new version, update the version number in the lib/(name of gem)/version.rb file, and then run "bundle exec rake release". This creates a git tag for the version, push git commits and tags, and pushes the `.gem` file to [rubygems.org](https://rubygems.org).
|
33
45
|
|
34
|
-
|
46
|
+
## Contributing
|
35
47
|
|
36
|
-
|
37
|
-
* Creating a basic generic web site with user authentication and testing is a long and slow process that spans multiple long chapters in Rails Tutorial. The GenericApp Ruby gem allows you to create such a site in minutes instead of hours or days. This is valuable for any project and essential for events like Startup Weekend and 24-hour website challenges.
|
38
|
-
* GenericApp saves you time by automatically providing the basic elements and features that nearly all Rails apps require. Instead of spending hours reinventing the wheel, you can spend more of your time on the more advanced features and capabilities that are unique to your specific Rails app. Modifying a generic app takes far less time than creating an app completely from scratch.
|
39
|
-
* At the same time GenericApp provides superior quality. Unlike other Rails app generating systems, GenericApp INCLUDES comprehensive model, controller, and integration tests. The time you save allows you to get work done faster AND double down on quality control.
|
40
|
-
* By default, GenericApp respects the privacy of the users of your app. The only people who can view information on a given user are that given user and your app's admins. Other users and the general public are not allowed to view information on that user. While the assumption that user information should be private won't be true for all apps, it's better to err on the side of too much privacy rather than too little, and it's still much easier to modify the app than to create a new one completely from scratch.
|
48
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/jhsu802701/generic_app. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
41
49
|
|
42
|
-
##
|
50
|
+
## License
|
43
51
|
|
44
|
-
|
45
|
-
Download this GitHub repository, cd into the source code, and enter the command "sh gem_test.sh". The screen output is saved to the log files in the log directory. If all goes well, every test is completed with 0 failures and 0 errors. Please note that bundle-audit will flag the outdated gems that result from using the old versions of the rails, pg, and nokogiri gems from the Rails Tutorial Sample App. You should update the Gemfile to the newer versions of these gems available in the rbenv-general version of the Docker image.
|
52
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
46
53
|
|
47
|
-
|
54
|
+
## Code of Conduct
|
48
55
|
|
49
|
-
|
50
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
51
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
52
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
53
|
-
5. Create a new Pull Request
|
56
|
+
Everyone interacting in the GenericApp project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/jhsu802701/generic_app/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
CHANGED
data/all.sh
CHANGED
@@ -1,17 +1,5 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
FILE_INSTALL_GEM='log/3-install-gem.log'
|
7
|
-
sh gem_test.sh 2>&1 | tee $FILE_TEST_GEM
|
8
|
-
sh code_test.sh 2>&1 | tee $FILE_TEST_CODE
|
9
|
-
sh gem_install.sh 2>&1 | tee $FILE_INSTALL_GEM
|
10
|
-
|
11
|
-
echo 'Results are logged in:'
|
12
|
-
echo $FILE_TEST_GEM
|
13
|
-
echo $FILE_TEST_CODE
|
14
|
-
echo $FILE_INSTALL_GEM
|
15
|
-
echo
|
16
|
-
echo 'Gemsurance Report: log/gemsurance_report.html'
|
17
|
-
echo 'Gem dependency diagram: log/diagram-gems.svg'
|
3
|
+
sh gem_test.sh
|
4
|
+
sh gem_install.sh
|
5
|
+
sh code_test.sh
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'generic_app'
|
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
CHANGED
data/code_test.sh
CHANGED
@@ -14,17 +14,22 @@ echo '----------------------'
|
|
14
14
|
echo 'bundle exec rubocop -D'
|
15
15
|
bundle exec rubocop -D
|
16
16
|
|
17
|
-
|
17
|
+
# Update the local ruby-advisory-db advisory database
|
18
|
+
echo '-------------------------------'
|
19
|
+
echo 'bundle exec bundle-audit update'
|
20
|
+
bundle exec bundle-audit update
|
21
|
+
|
22
|
+
# Audit the gems listed in Gemfile.lock for vulnerabilities
|
18
23
|
echo '------------------------'
|
19
24
|
echo 'bundle exec bundle-audit'
|
20
25
|
bundle exec bundle-audit
|
21
26
|
|
22
|
-
echo '------------------------------------------------------------------------'
|
23
|
-
echo 'bundle viz --file=log/diagram-gems --format=jpg --requirements --version'
|
24
|
-
bundle viz --file=log/diagram-gems --format=jpg --requirements --version
|
25
|
-
echo 'Gem dependency diagram: log/diagram-gems.jpg'
|
26
|
-
|
27
27
|
echo '----------------------------------------------------------'
|
28
28
|
echo 'bundle exec gemsurance --output log/gemsurance_report.html'
|
29
29
|
bundle exec gemsurance --output log/gemsurance_report.html
|
30
30
|
echo 'Gemsurance Report: log/gemsurance_report.html'
|
31
|
+
|
32
|
+
echo '------------------------------------------------------------------------'
|
33
|
+
echo 'bundle viz --file=log/diagram-gems --format=svg --requirements --version'
|
34
|
+
bundle viz --file=log/diagram-gems --format=jpg --requirements --version
|
35
|
+
echo 'Gem dependency diagram: log/diagram-gems.jpg'
|
data/credentials.sh
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
|
3
|
-
# This script provides one-stop shopping for entering your credentials.
|
4
|
-
# Please run this script when you reset the Docker container.
|
5
|
-
# The "git commit" command will not work without your Git credentials.
|
6
|
-
|
7
3
|
# Output:
|
8
4
|
# First argument if it is not blank
|
9
5
|
# Second argument if first argument is blank
|
@@ -15,38 +11,43 @@ anti_blank () {
|
|
15
11
|
fi
|
16
12
|
}
|
17
13
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
echo
|
23
|
-
echo "Default email address: ${EMAIL_DEF}"
|
24
|
-
echo
|
25
|
-
echo 'Enter your Git email address:'
|
26
|
-
read EMAIL_SEL
|
27
|
-
EMAIL=$(anti_blank $EMAIL_SEL $EMAIL_DEF)
|
28
|
-
echo
|
29
|
-
|
30
|
-
echo
|
31
|
-
echo '------------------------------'
|
32
|
-
echo "git config --global user.email"
|
33
|
-
echo "$EMAIL"
|
34
|
-
git config --global user.email "$EMAIL"
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
echo
|
14
|
+
# Setting Git email if necessary
|
15
|
+
GIT_EMAIL="$(git config user.email)"
|
16
|
+
if [ -z "$GIT_EMAIL" ]; then
|
17
|
+
EMAIL_DEF='you@example.com'
|
18
|
+
echo
|
19
|
+
echo "Default email address: ${EMAIL_DEF}"
|
20
|
+
echo
|
21
|
+
echo 'Enter your Git email address:'
|
22
|
+
read EMAIL_SEL
|
23
|
+
EMAIL=$(anti_blank $EMAIL_SEL $EMAIL_DEF)
|
24
|
+
echo
|
25
|
+
|
26
|
+
echo
|
27
|
+
echo '------------------------------'
|
28
|
+
echo "git config --global user.email"
|
29
|
+
echo "$EMAIL"
|
30
|
+
git config --global user.email "$EMAIL"
|
31
|
+
fi
|
32
|
+
|
33
|
+
# Setting Git name if necessary
|
34
|
+
GIT_NAME="$(git config user.name)"
|
35
|
+
if [ -z "$GIT_NAME" ]; then
|
36
|
+
NAME_DEF='Your Name'
|
37
|
+
echo
|
38
|
+
echo "Default name: ${NAME_DEF}"
|
39
|
+
echo
|
40
|
+
echo 'Enter your Git name:'
|
41
|
+
read NAME_SEL
|
42
|
+
|
43
|
+
# NOTE: The double quotes are needed to avoid truncating the string
|
44
|
+
# at the space.
|
45
|
+
NAME=$(anti_blank "$NAME_SEL" "$NAME_DEF")
|
46
|
+
|
47
|
+
echo
|
48
|
+
echo '-----------------------------'
|
49
|
+
echo "git config --global user.name"
|
50
|
+
echo "$NAME"
|
51
|
+
git config --global user.name "$NAME"
|
52
|
+
echo
|
53
|
+
fi
|
data/gem_console.sh
ADDED
data/gem_install.sh
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
gem
|
8
|
-
|
9
|
-
echo '
|
10
|
-
|
11
|
-
echo "FINISHED INSTALLING generic_app"
|
12
|
-
echo "*******************************"
|
3
|
+
echo '--------------------'
|
4
|
+
echo 'BEGIN INSTALLING gem'
|
5
|
+
|
6
|
+
gem build *.gemspec
|
7
|
+
gem install *.gem
|
8
|
+
|
9
|
+
echo 'FINISHED INSTALLING gem'
|
10
|
+
echo '-----------------------'
|
data/gem_test.sh
CHANGED
@@ -1,18 +1,10 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
DIR_PARENT="${PWD%/*}"
|
6
|
-
mkdir -p log
|
3
|
+
echo '-----------------'
|
4
|
+
echo 'BEGIN TESTING gem'
|
7
5
|
|
8
|
-
|
9
|
-
echo 'bundle install'
|
10
|
-
bin/setup >/dev/null
|
11
|
-
|
12
|
-
echo '===='
|
13
|
-
echo 'rake'
|
6
|
+
bin/setup
|
14
7
|
rake
|
15
8
|
|
16
|
-
echo '
|
17
|
-
echo '
|
18
|
-
bundle exec rubocop -D
|
9
|
+
echo 'FINISHED TESTING gem'
|
10
|
+
echo '--------------------'
|
data/generic_app.gemspec
CHANGED
@@ -9,22 +9,28 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.version = GenericApp::VERSION
|
10
10
|
spec.authors = ['Jason Hsu']
|
11
11
|
spec.email = ['rubyist@jasonhsu.com']
|
12
|
-
|
13
|
-
spec.
|
12
|
+
|
13
|
+
spec.summary = 'Save time by instantly creating a generic Rails app.'
|
14
|
+
spec.description = 'Instead of creating your Rails app from scratch, start with a prebuilt template.'
|
14
15
|
spec.homepage = 'https://github.com/jhsu802701/generic_app'
|
15
16
|
spec.license = 'MIT'
|
16
17
|
|
17
|
-
spec.files
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
19
|
+
f.match(%r{^(test|spec|features)/})
|
20
|
+
end
|
21
|
+
spec.bindir = 'bin'
|
18
22
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
23
|
spec.require_paths = ['lib']
|
21
24
|
|
22
|
-
spec.add_development_dependency '
|
23
|
-
spec.add_development_dependency '
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.15'
|
26
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
24
28
|
spec.add_development_dependency 'rubocop'
|
25
29
|
spec.add_development_dependency 'bundler-audit'
|
26
30
|
spec.add_development_dependency 'gemsurance'
|
27
31
|
spec.add_development_dependency 'ruby-graphviz'
|
32
|
+
spec.add_development_dependency 'simplecov'
|
33
|
+
spec.add_development_dependency 'codeclimate-test-reporter'
|
28
34
|
|
29
35
|
spec.add_runtime_dependency 'string_in_file'
|
30
36
|
spec.add_runtime_dependency 'line_containing'
|
data/git_check.sh
ADDED
data/lib/generic_app/version.rb
CHANGED
data/lib/generic_app.rb
CHANGED
@@ -12,15 +12,15 @@ DIR_PARENT = File.expand_path('../../../', __FILE__)
|
|
12
12
|
module GenericApp
|
13
13
|
# Create app, stick with SQLite database in development
|
14
14
|
def self.create_new(subdir_name, email, title)
|
15
|
-
t1 = Thread.new {
|
15
|
+
t1 = Thread.new { git_clone(subdir_name) }
|
16
16
|
t1.join
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
remove_neutrino(subdir_name)
|
18
|
+
remove_heroku_name(subdir_name)
|
19
|
+
email_update(subdir_name, email)
|
20
|
+
remove_badges(subdir_name)
|
21
|
+
update_titles(subdir_name, title)
|
22
|
+
git_init(subdir_name)
|
23
|
+
print_end_msg(subdir_name)
|
24
24
|
end
|
25
25
|
|
26
26
|
def self.remove_heroku_name(subdir_name)
|
@@ -39,12 +39,12 @@ module GenericApp
|
|
39
39
|
|
40
40
|
def self.email_update(subdir_name, email)
|
41
41
|
email_orig = 'somebody@rubyonracetracks.com'
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
StringInFile.replace(email_orig, email,
|
46
|
-
StringInFile.replace(email_orig, email,
|
47
|
-
StringInFile.replace(email_orig, email,
|
42
|
+
path1 = "#{subdir_name}/config/initializers/devise.rb"
|
43
|
+
path2 = "#{subdir_name}/app/views/static_pages/contact.html.erb"
|
44
|
+
path3 = "#{subdir_name}/test/integration/static_pages_test.rb"
|
45
|
+
StringInFile.replace(email_orig, email, path1)
|
46
|
+
StringInFile.replace(email_orig, email, path2)
|
47
|
+
StringInFile.replace(email_orig, email, path3)
|
48
48
|
end
|
49
49
|
|
50
50
|
def self.remove_badges(subdir_name)
|
data/long_test.sh
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
echo '------------------------'
|
4
|
+
echo 'BEGIN TESTING gem (rake)'
|
5
|
+
|
6
|
+
bin/setup
|
7
|
+
rake
|
8
|
+
|
9
|
+
echo 'FINISHED TESTING gem (rake)'
|
10
|
+
echo '---------------------------'
|
11
|
+
|
12
|
+
echo '#####################'
|
13
|
+
echo 'BEGIN TESTING new app'
|
14
|
+
|
15
|
+
DIR_MAIN=$PWD
|
16
|
+
DIR_PARENT="$(dirname "$DIR_MAIN")"
|
17
|
+
DIR_APP=$DIR_PARENT/tmp1
|
18
|
+
|
19
|
+
cd $DIR_APP && sh all.sh
|
20
|
+
|
21
|
+
echo 'FINISHED TESTING new app'
|
22
|
+
echo '########################'
|
metadata
CHANGED
@@ -1,17 +1,59 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: generic_app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Hsu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-27 00:00:00.000000000 Z
|
12
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: '1.15'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.15'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
15
57
|
requirement: !ruby/object:Gem::Requirement
|
16
58
|
requirements:
|
17
59
|
- - ">="
|
@@ -25,7 +67,7 @@ dependencies:
|
|
25
67
|
- !ruby/object:Gem::Version
|
26
68
|
version: '0'
|
27
69
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
70
|
+
name: bundler-audit
|
29
71
|
requirement: !ruby/object:Gem::Requirement
|
30
72
|
requirements:
|
31
73
|
- - ">="
|
@@ -39,7 +81,7 @@ dependencies:
|
|
39
81
|
- !ruby/object:Gem::Version
|
40
82
|
version: '0'
|
41
83
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
84
|
+
name: gemsurance
|
43
85
|
requirement: !ruby/object:Gem::Requirement
|
44
86
|
requirements:
|
45
87
|
- - ">="
|
@@ -53,7 +95,7 @@ dependencies:
|
|
53
95
|
- !ruby/object:Gem::Version
|
54
96
|
version: '0'
|
55
97
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
98
|
+
name: ruby-graphviz
|
57
99
|
requirement: !ruby/object:Gem::Requirement
|
58
100
|
requirements:
|
59
101
|
- - ">="
|
@@ -67,7 +109,7 @@ dependencies:
|
|
67
109
|
- !ruby/object:Gem::Version
|
68
110
|
version: '0'
|
69
111
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
112
|
+
name: simplecov
|
71
113
|
requirement: !ruby/object:Gem::Requirement
|
72
114
|
requirements:
|
73
115
|
- - ">="
|
@@ -81,7 +123,7 @@ dependencies:
|
|
81
123
|
- !ruby/object:Gem::Version
|
82
124
|
version: '0'
|
83
125
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
126
|
+
name: codeclimate-test-reporter
|
85
127
|
requirement: !ruby/object:Gem::Requirement
|
86
128
|
requirements:
|
87
129
|
- - ">="
|
@@ -136,37 +178,39 @@ dependencies:
|
|
136
178
|
- - ">="
|
137
179
|
- !ruby/object:Gem::Version
|
138
180
|
version: '0'
|
139
|
-
description: Instead of creating your Rails app from scratch, start with a
|
140
|
-
|
181
|
+
description: Instead of creating your Rails app from scratch, start with a prebuilt
|
182
|
+
template.
|
141
183
|
email:
|
142
184
|
- rubyist@jasonhsu.com
|
143
185
|
executables:
|
186
|
+
- console
|
144
187
|
- generic_app
|
145
188
|
- setup
|
146
189
|
extensions: []
|
147
190
|
extra_rdoc_files: []
|
148
191
|
files:
|
149
|
-
- ".codeclimate.yml"
|
150
192
|
- ".gitignore"
|
193
|
+
- ".rspec"
|
151
194
|
- ".rubocop.yml"
|
152
|
-
-
|
195
|
+
- CODE_OF_CONDUCT.md
|
153
196
|
- Gemfile
|
154
197
|
- LICENSE.txt
|
155
198
|
- README.md
|
156
199
|
- Rakefile
|
157
200
|
- all.sh
|
201
|
+
- bin/console
|
158
202
|
- bin/generic_app
|
159
203
|
- bin/setup
|
160
204
|
- code_test.sh
|
161
205
|
- credentials.sh
|
206
|
+
- gem_console.sh
|
162
207
|
- gem_install.sh
|
163
208
|
- gem_test.sh
|
164
209
|
- generic_app.gemspec
|
210
|
+
- git_check.sh
|
165
211
|
- lib/generic_app.rb
|
166
|
-
- lib/generic_app/git_clone_url.txt
|
167
212
|
- lib/generic_app/version.rb
|
168
|
-
-
|
169
|
-
- spec/spec_helper.rb
|
213
|
+
- long_test.sh
|
170
214
|
homepage: https://github.com/jhsu802701/generic_app
|
171
215
|
licenses:
|
172
216
|
- MIT
|
@@ -190,7 +234,5 @@ rubyforge_project:
|
|
190
234
|
rubygems_version: 2.6.12
|
191
235
|
signing_key:
|
192
236
|
specification_version: 4
|
193
|
-
summary: Save time by instantly
|
194
|
-
test_files:
|
195
|
-
- spec/lib/generic_app_spec.rb
|
196
|
-
- spec/spec_helper.rb
|
237
|
+
summary: Save time by instantly creating a generic Rails app.
|
238
|
+
test_files: []
|
data/.codeclimate.yml
DELETED
data/.travis.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
https://github.com/jhsu802701/generic-rails-2017-01-10-2332.git
|
@@ -1,57 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'generic_app'
|
3
|
-
require 'string_in_file'
|
4
|
-
|
5
|
-
dir_parent = File.expand_path('../../../../', __FILE__)
|
6
|
-
dir_app_1 = "#{dir_parent}/tmp1"
|
7
|
-
|
8
|
-
describe GenericApp do
|
9
|
-
it 'New Rails app' do
|
10
|
-
puts
|
11
|
-
puts '**************'
|
12
|
-
puts 'CREATING APP 1'
|
13
|
-
puts 'New Rails app'
|
14
|
-
system("rm -rf #{dir_app_1}")
|
15
|
-
Dir.chdir(dir_parent) do
|
16
|
-
GenericApp.create_new('tmp1', '007@railstutorial.org', 'Your New App')
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'The neutrino.sh script should be removed' do
|
21
|
-
expect(File.exist?("#{dir_app_1}/neutrino.sh")).to eq(false)
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'config/heroku_name.txt should be removed' do
|
25
|
-
expect(File.exist?("#{dir_app_1}/config/heroku_name.txt")).to eq(false)
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'Email address should be updated' do
|
29
|
-
expect(StringInFile.present('007@railstutorial.org', "#{dir_app_1}/config/initializers/devise.rb")).to eq(true)
|
30
|
-
expect(StringInFile.present('007@railstutorial.org', "#{dir_app_1}/app/views/static_pages/contact.html.erb")).to eq(true)
|
31
|
-
expect(StringInFile.present('007@railstutorial.org', "#{dir_app_1}/test/integration/static_pages_test.rb")).to eq(true)
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'Badges should be removed from README.md' do
|
35
|
-
expect(StringInFile.present('[![CircleCI](https://circleci.com', "#{dir_app_1}/README.md")).to eq(false)
|
36
|
-
expect(StringInFile.present('[![Dependency Status](https://gemnasium.com', "#{dir_app_1}/README.md")).to eq(false)
|
37
|
-
expect(StringInFile.present('[![security](https://hakiri.io', "#{dir_app_1}/README.md")).to eq(false)
|
38
|
-
expect(StringInFile.present('[![Code Climate](https://codeclimate.com', "#{dir_app_1}/README.md")).to eq(false)
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'The specified app title should be provided in place of "Generic App Template"' do
|
42
|
-
array_files = []
|
43
|
-
array_files << "#{dir_app_1}/README.md"
|
44
|
-
array_files << "#{dir_app_1}/app/helpers/application_helper.rb"
|
45
|
-
array_files << "#{dir_app_1}/app/views/layouts/_header.html.erb"
|
46
|
-
array_files << "#{dir_app_1}/app/views/layouts/_footer.html.erb"
|
47
|
-
array_files << "#{dir_app_1}/app/views/static_pages/home.html.erb"
|
48
|
-
array_files << "#{dir_app_1}/test/helpers/application_helper_test.rb"
|
49
|
-
array_files << "#{dir_app_1}/test/integration/static_pages_test.rb"
|
50
|
-
|
51
|
-
array_files.each do |f|
|
52
|
-
expect(StringInFile.present('Generic App Template', f)).to eq(false)
|
53
|
-
expect(StringInFile.present('GENERIC APP TEMPLATE', f)).to eq(false)
|
54
|
-
expect(StringInFile.present('Your New App', f)).to eq(true)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
data/spec/spec_helper.rb
DELETED