generic_app 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -5
- data/README.md +17 -13
- data/bin/generic_app +15 -18
- data/code_test.sh +3 -3
- data/gem_test.sh +5 -10
- data/lib/generic_app/version.rb +1 -1
- data/lib/generic_app.rb +19 -4
- data/spec/lib/generic_app_spec.rb +15 -3
- data/spec/spec_helper.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67f068c19972e24d0872d494945cc7eb8e496012
|
4
|
+
data.tar.gz: 20d7264f0106317546a22928b6eb73e6db95eba4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48c3296e235dc49c3fb88eeed1afdfcfefc03bb0e6bd7bf1eb87fa4ecd1216b6ecdde59dc2f2c737eda96bf642258d7b3de8d62c04acfaf56daf6f77014d0ec9
|
7
|
+
data.tar.gz: 493f4a4b63f0e16290934b8e9943c481155e83b95aafa3815e92d08bc729c4bf2f2e5451a798b108982817f92c87c59b99d14c50fb6749bee293b2a8412cc9ac
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -7,11 +7,11 @@
|
|
7
7
|
|
8
8
|
# GenericApp
|
9
9
|
|
10
|
-
Welcome to GenericApp, the #1 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,
|
10
|
+
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
11
|
|
12
12
|
## Prerequisites
|
13
13
|
|
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.
|
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] (http://www.rubyonracetracks.com/install).
|
15
15
|
|
16
16
|
## Installation
|
17
17
|
|
@@ -21,26 +21,30 @@ Install the GenericApp gem with the command:
|
|
21
21
|
|
22
22
|
## Usage
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
Go to the directory where you keep your Rails projects and enter the command "generic_app". You will be asked to select the name of the directory you wish to use for your Rails project.
|
24
|
+
Go to the directory where you keep your Rails projects and enter the command "generic_app".
|
27
25
|
<br><br>
|
28
|
-
After you have provided all of the necessary parameters, your generic Rails project will not only be created for you but automatically tested as well. This takes a few minutes instead of
|
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.
|
29
27
|
|
30
|
-
##
|
28
|
+
## How Does This Work?
|
31
29
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
30
|
+
This gem downloads and modifies the source code from the URL listed in the lib/generic_app/git_clone_url.txt file. In other words, this gem uses a pre-existing Rails template app as the basis for your new app.
|
31
|
+
|
32
|
+
## How Is That Rails Template App Created?
|
33
|
+
|
34
|
+
I created this Rails Template App by following my [Rails From Scratch](http://www.rubyonracetracks.com/rails_from_scratch.html) protocol.
|
35
|
+
|
36
|
+
## What's the point?
|
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.
|
37
41
|
|
38
42
|
## Development
|
39
43
|
|
40
44
|
### Testing GenericApp
|
41
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.
|
42
46
|
|
43
|
-
|
47
|
+
### Contributing
|
44
48
|
|
45
49
|
1. Fork it ( https://github.com/jhsu802701/generic_app/fork )
|
46
50
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
data/bin/generic_app
CHANGED
@@ -18,34 +18,31 @@ puts
|
|
18
18
|
default_subdir = 'tmp9'
|
19
19
|
puts
|
20
20
|
puts "DEFAULT VALUE: #{default_subdir}"
|
21
|
-
puts 'Enter the directory name you wish to use for your
|
21
|
+
puts 'Enter the directory name you wish to use for your new app:'
|
22
22
|
subdir_name = get_input(default_subdir)
|
23
23
|
puts "You chose '#{subdir_name}'."
|
24
24
|
puts
|
25
25
|
|
26
26
|
default_email = 'please-change-me-at-config-initializers-devise@example.com'
|
27
27
|
puts "DEFAULT VALUE: #{default_email}"
|
28
|
-
puts "Enter the email address you wish to use for your
|
28
|
+
puts "Enter the email address you wish to use for your new app's mailer:"
|
29
29
|
email = get_input(default_email)
|
30
30
|
|
31
|
-
|
31
|
+
default_title = 'Placeholder Title'
|
32
|
+
puts "DEFAULT TITLE: #{default_title}"
|
33
|
+
puts 'Enter the desired title you wish to use for your new app:'
|
34
|
+
title = get_input(default_title)
|
32
35
|
|
33
|
-
|
34
|
-
puts "BEGIN TESTING AND SEEDING THE #{subdir_name} RAILS APP"
|
35
|
-
system("cd #{subdir_name} && sh all.sh")
|
36
|
-
puts "FINISHED TESTING AND SEEDING THE #{subdir_name} RAILS APP"
|
37
|
-
puts '*********************************************************'
|
36
|
+
GenericApp.create_new(subdir_name, email, title)
|
38
37
|
|
39
|
-
puts 'Your new Rails app has been created
|
38
|
+
puts 'Your new Rails app has been created at'
|
40
39
|
puts "#{ENV['PWD']}/#{subdir_name} ."
|
41
|
-
puts '
|
42
|
-
puts '
|
43
|
-
puts
|
44
|
-
puts
|
45
|
-
puts 'sh pg-setup.sh .'
|
46
|
-
puts 'Please note that the rails, pg, and nokogiri gems may be outdated.'
|
47
|
-
puts 'You should update these gem versions in the Gemfile.'
|
40
|
+
puts ''
|
41
|
+
puts 'Enter the following commands:'
|
42
|
+
puts "cd #{subdir_name}"
|
43
|
+
puts 'git commit -m "Initial commit"'
|
48
44
|
puts
|
49
|
-
puts '
|
50
|
-
puts
|
45
|
+
puts 'Use the all.sh script to test, outline, and seed your app.'
|
46
|
+
puts
|
47
|
+
puts 'There is a list of things to do in the README-to_do.txt file.'
|
51
48
|
puts
|
data/code_test.sh
CHANGED
@@ -30,6 +30,6 @@ gemsurance --output log/gemsurance_report.html
|
|
30
30
|
echo 'Gemsurance Report: log/gemsurance_report.html'
|
31
31
|
|
32
32
|
echo '------------------------------------------------------------------------'
|
33
|
-
echo 'bundle viz --file=log/diagram-gems --format=
|
34
|
-
bundle viz --file=log/diagram-gems --format=
|
35
|
-
echo 'Gem dependency diagram: log/diagram-gems.
|
33
|
+
echo 'bundle viz --file=log/diagram-gems --format=jpg --requirements --version'
|
34
|
+
bundle viz --file=log/diagram-gems --format=jpg --requirements --version
|
35
|
+
echo 'Gem dependency diagram: log/diagram-gems.jpg'
|
data/gem_test.sh
CHANGED
@@ -9,15 +9,10 @@ echo '=============='
|
|
9
9
|
echo 'bundle install'
|
10
10
|
bin/setup >/dev/null
|
11
11
|
|
12
|
-
echo '
|
13
|
-
echo '
|
12
|
+
echo '===='
|
13
|
+
echo 'rake'
|
14
14
|
rake
|
15
|
-
|
16
|
-
echo '
|
17
|
-
echo
|
18
|
-
echo '========================'
|
19
|
-
echo 'BEGIN PART 2: rubocop -D'
|
15
|
+
|
16
|
+
echo '=========='
|
17
|
+
echo 'rubocop -D'
|
20
18
|
rubocop -D
|
21
|
-
echo 'FINISHED PART 2: rubocop -D'
|
22
|
-
echo '==========================='
|
23
|
-
echo
|
data/lib/generic_app/version.rb
CHANGED
data/lib/generic_app.rb
CHANGED
@@ -11,12 +11,13 @@ DIR_PARENT = File.expand_path('../../../', __FILE__)
|
|
11
11
|
#
|
12
12
|
module GenericApp
|
13
13
|
# Create app, stick with SQLite database in development
|
14
|
-
def self.create_new(subdir_name, email)
|
14
|
+
def self.create_new(subdir_name, email, title)
|
15
15
|
t1 = Thread.new { self.git_clone(subdir_name) }
|
16
16
|
t1.join
|
17
17
|
self.remove_heroku_name(subdir_name)
|
18
18
|
self.email_update(subdir_name, email)
|
19
19
|
self.remove_badges(subdir_name)
|
20
|
+
self.update_titles(subdir_name, title)
|
20
21
|
self.git_init(subdir_name)
|
21
22
|
end
|
22
23
|
|
@@ -51,12 +52,26 @@ module GenericApp
|
|
51
52
|
RemoveDoubleBlank.update(path_readme)
|
52
53
|
end
|
53
54
|
|
55
|
+
def self.update_titles(subdir_name, title)
|
56
|
+
array_files = []
|
57
|
+
array_files << "#{subdir_name}/README.md"
|
58
|
+
array_files << "#{subdir_name}/app/helpers/application_helper.rb"
|
59
|
+
array_files << "#{subdir_name}/app/views/layouts/_footer.html.erb"
|
60
|
+
array_files << "#{subdir_name}/app/views/static_pages/home.html.erb"
|
61
|
+
array_files << "#{subdir_name}/test/helpers/application_helper_test.rb"
|
62
|
+
array_files << "#{subdir_name}/test/integration/static_pages_test.rb"
|
63
|
+
|
64
|
+
array_files.each do |f|
|
65
|
+
StringInFile.replace('Generic App Template', title, f)
|
66
|
+
StringInFile.replace('GENERIC APP TEMPLATE', title, f)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
54
70
|
def self.git_init(subdir_name)
|
55
|
-
puts '
|
56
|
-
puts '
|
71
|
+
puts '-----------------------'
|
72
|
+
puts 'Removing old Git record'
|
57
73
|
system("cd #{subdir_name} && rm -rf .git")
|
58
74
|
system("cd #{subdir_name} && git init")
|
59
75
|
system("cd #{subdir_name} && git add .")
|
60
|
-
system("cd #{subdir_name} && git commit -m 'Initial commit' >/dev/null")
|
61
76
|
end
|
62
77
|
end
|
@@ -13,7 +13,7 @@ describe GenericApp do
|
|
13
13
|
puts 'New Rails app'
|
14
14
|
system("rm -rf #{dir_app_1}")
|
15
15
|
Dir.chdir(dir_parent) do
|
16
|
-
GenericApp.create_new('tmp1', '007@railstutorial.org')
|
16
|
+
GenericApp.create_new('tmp1', '007@railstutorial.org', 'Your New App')
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -35,7 +35,19 @@ describe GenericApp do
|
|
35
35
|
expect(StringInFile.present('[Code Climate]', "#{dir_app_1}/README.md")).to eq(false)
|
36
36
|
end
|
37
37
|
|
38
|
-
it '
|
39
|
-
|
38
|
+
it 'The specified app title should be provided in place of "Generic App Template"' do
|
39
|
+
array_files = []
|
40
|
+
array_files << "#{dir_app_1}/README.md"
|
41
|
+
array_files << "#{dir_app_1}/app/helpers/application_helper.rb"
|
42
|
+
array_files << "#{dir_app_1}/app/views/layouts/_footer.html.erb"
|
43
|
+
array_files << "#{dir_app_1}/app/views/static_pages/home.html.erb"
|
44
|
+
array_files << "#{dir_app_1}/test/helpers/application_helper_test.rb"
|
45
|
+
array_files << "#{dir_app_1}/test/integration/static_pages_test.rb"
|
46
|
+
|
47
|
+
array_files.each do |f|
|
48
|
+
expect(StringInFile.present('Generic App Template', f)).to eq(false)
|
49
|
+
expect(StringInFile.present('GENERIC APP TEMPLATE', f)).to eq(false)
|
50
|
+
expect(StringInFile.present('Your New App', f)).to eq(true)
|
51
|
+
end
|
40
52
|
end
|
41
53
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: generic_app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
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-01-
|
11
|
+
date: 2017-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|