onotole 1.0.4 → 1.0.6
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 +4 -4
- data/.gitignore +2 -1
- data/.rubocop.yml +3 -0
- data/Gemfile +2 -0
- data/README.md +9 -6
- data/bin/install +1 -1
- data/bin/onotole +1 -0
- data/lib/onotole/add_user_gems/after_install_patch.rb +5 -4
- data/lib/onotole/add_user_gems/before_bundle_patch.rb +7 -2
- data/lib/onotole/add_user_gems/edit_menu_questions.rb +1 -0
- data/lib/onotole/app_builder.rb +4 -4
- data/lib/onotole/generators/app_generator.rb +18 -15
- data/lib/onotole/git.rb +31 -0
- data/lib/onotole/helpers.rb +127 -0
- data/lib/onotole/mail.rb +38 -0
- data/lib/onotole/tests.rb +85 -0
- data/lib/onotole/version.rb +1 -1
- data/spec/features/new_project_spec.rb +17 -14
- data/spec/support/onotole.rb +7 -0
- data/templates/README.md.erb +14 -8
- data/templates/bin_setup +2 -0
- data/templates/rubocop.yml +3 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c4e5ff618f59d204c81a9cb49cfe976f7fb72f8
|
4
|
+
data.tar.gz: 3496e8d1ecf92daf05e09cf6ca41e4956a29f350
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 743b9c67aa65f211fa5ff93321d605c0eceaa48286dac7ffff5ab118d75a7a55a8a54a8097120a947dd2e7696396cc27a6b14df89beb90b5322ab5c7b2f50d6f
|
7
|
+
data.tar.gz: 4672390c520bb254b4386ec33087f5f3690d99aae4784ee84784b521c724fcde3586e3e048d143e6fb414469c6b5422d9f88f4ca48a02c124fa5d01851af4948
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -73,6 +73,8 @@ pack will not be installed with any gem option.
|
|
73
73
|
provides an easy-to-use interface for managing your data
|
74
74
|
* [activeadmin](https://github.com/activeadmin/activeadmin) Rails framework for
|
75
75
|
creating elegant backends for website administration.
|
76
|
+
* `*`[rubycritic](https://github.com/whitesmith/rubycritic) A Ruby code quality
|
77
|
+
reporter
|
76
78
|
|
77
79
|
|
78
80
|
Mandatory installation gem list you will find in `Gemfile` section
|
@@ -89,23 +91,22 @@ First install the onotole gem add this in `Gemfile` and `bundle`
|
|
89
91
|
|
90
92
|
or
|
91
93
|
|
92
|
-
|
93
|
-
gem install onotole
|
94
|
-
```
|
94
|
+
gem install onotole
|
95
95
|
|
96
96
|
Create gemset if you need it.
|
97
97
|
|
98
98
|
Then run:
|
99
99
|
|
100
|
-
|
100
|
+
onotole projectname [ -c ] [ * rails_genetator_flags ]
|
101
|
+
|
101
102
|
|
102
103
|
This will create a Rails app in `projectname` using the latest version of Rails.
|
103
104
|
|
104
|
-
|
105
|
+
onotole projectname -c
|
105
106
|
|
106
107
|
And command like this will add some magic
|
107
108
|
|
108
|
-
|
109
|
+
onotole app * github organization/project * heroku true
|
109
110
|
|
110
111
|
This will provide a dialog, where you can select needed gems, also you can add
|
111
112
|
it with gemname flag, after app_name, like `onotole projectname --slim`.
|
@@ -200,6 +201,7 @@ Onotole also comes with:
|
|
200
201
|
environments
|
201
202
|
* The analytics adapter [Segment][segment] (and therefore config for Google
|
202
203
|
Analytics, Intercom, Facebook Ads, Twitter Ads, etc.)
|
204
|
+
* Check existing of app DB and ask about continuation if base persisted
|
203
205
|
|
204
206
|
## Heroku
|
205
207
|
|
@@ -278,6 +280,7 @@ installing QT are
|
|
278
280
|
[here](https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit).
|
279
281
|
|
280
282
|
PostgreSQL needs to be installed and running for the `db:create` rake task.
|
283
|
+
Also DB existing checking in `PostgreSQL` only.
|
281
284
|
|
282
285
|
## Contributing
|
283
286
|
|
data/bin/install
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
#!/bin/sh
|
2
|
-
gem build onotole.gemspec && gem install onotole
|
2
|
+
rm onotole-*.gem && gem build onotole.gemspec && gem install onotole
|
data/bin/onotole
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
module Onotole
|
3
3
|
module AfterInstallPatch
|
4
4
|
def post_init
|
5
|
-
install_queue = [:
|
5
|
+
install_queue = [:devise,
|
6
|
+
:responders,
|
6
7
|
:annotate,
|
7
8
|
:overcommit,
|
8
9
|
:activeadmin,
|
@@ -12,7 +13,6 @@ module Onotole
|
|
12
13
|
:guard_rubocop,
|
13
14
|
:bootstrap3_sass,
|
14
15
|
:bootstrap3,
|
15
|
-
:devise,
|
16
16
|
:normalize,
|
17
17
|
:tinymce,
|
18
18
|
:rubocop,
|
@@ -22,7 +22,7 @@ module Onotole
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def after_install_devise
|
25
|
-
|
25
|
+
rails_generator 'devise:install'
|
26
26
|
if AppBuilder.devise_model
|
27
27
|
rails_generator "devise #{AppBuilder.devise_model.titleize}"
|
28
28
|
inject_into_file('app/controllers/application_controller.rb',
|
@@ -46,7 +46,7 @@ if ENV['RAILS_ENV'] == 'test' || ENV['RAILS_ENV'] == 'development'
|
|
46
46
|
end
|
47
47
|
TEXT
|
48
48
|
append_file 'Rakefile', t
|
49
|
-
|
49
|
+
clean_by_rubocop
|
50
50
|
end
|
51
51
|
|
52
52
|
def after_install_guard
|
@@ -119,6 +119,7 @@ end
|
|
119
119
|
def after_install_overcommit
|
120
120
|
bundle_command 'exec overcommit --install'
|
121
121
|
bundle_command 'exec overcommit --sign'
|
122
|
+
inject_into_file('bin/setup', "\novercommit --install\novercommit --sign", after: '# User addons installation')
|
122
123
|
end
|
123
124
|
|
124
125
|
def after_install_activeadmin
|
@@ -100,7 +100,7 @@ module Onotole
|
|
100
100
|
# v.3.5 syntax. will be deprecated in 4.0
|
101
101
|
def configure_permitted_parameters
|
102
102
|
devise_parameter_sanitizer.for(:sign_in) do |user_params|
|
103
|
-
user_params.permit(:email, :password)
|
103
|
+
user_params.permit(:email, :password, :remember_me)
|
104
104
|
end
|
105
105
|
|
106
106
|
devise_parameter_sanitizer.for(:sign_up) do |user_params|
|
@@ -166,7 +166,7 @@ module Onotole
|
|
166
166
|
append_file '.overcommit.yml', rubocop_overcommit if user_choose?(:rubocop)
|
167
167
|
end
|
168
168
|
|
169
|
-
def
|
169
|
+
def add_activerecord_import_gem
|
170
170
|
inject_into_file('Gemfile', "\ngem 'activerecord-import'", after: '# user_choice')
|
171
171
|
end
|
172
172
|
|
@@ -182,5 +182,10 @@ module Onotole
|
|
182
182
|
inject_into_file('Gemfile', "\ngem 'rails_admin'", after: '# user_choice')
|
183
183
|
puts
|
184
184
|
end
|
185
|
+
|
186
|
+
def add_rubycritic_gem
|
187
|
+
inject_into_file('Gemfile', "\n gem 'rubycritic', :require => false",
|
188
|
+
after: 'group :development do')
|
189
|
+
end
|
185
190
|
end
|
186
191
|
end
|
@@ -41,6 +41,7 @@ module Onotole
|
|
41
41
|
will_paginate: 'Easy pagination implement',
|
42
42
|
faker: 'Gem for generate fake data in testing',
|
43
43
|
rubocop: 'Code inspector and code formatting tool',
|
44
|
+
rubycritic: 'A Ruby code quality reporter',
|
44
45
|
guard: 'Guard (with RSpec, livereload, rails, migrate, bundler)',
|
45
46
|
guard_rubocop: 'Auto-declare code miss in guard',
|
46
47
|
bundler_audit: 'Extra possibilities for gems version control',
|
data/lib/onotole/app_builder.rb
CHANGED
@@ -195,7 +195,7 @@ end
|
|
195
195
|
end
|
196
196
|
|
197
197
|
def create_database
|
198
|
-
bundle_command 'exec rake db:drop db:create db:migrate'
|
198
|
+
bundle_command 'exec rake db:drop db:create db:migrate db:seed'
|
199
199
|
end
|
200
200
|
|
201
201
|
def replace_gemfile
|
@@ -392,12 +392,12 @@ end
|
|
392
392
|
|
393
393
|
def user_gems_from_args_or_default_set
|
394
394
|
gems_flags = []
|
395
|
-
options.each { |
|
395
|
+
options.each { |gem, usage| gems_flags.push(gem.to_sym) if usage }
|
396
396
|
gems = GEMPROCLIST & gems_flags
|
397
397
|
if gems.empty?
|
398
398
|
AppBuilder.user_choice = DEFAULT_GEMSET
|
399
399
|
else
|
400
|
-
gems.each { |
|
400
|
+
gems.each { |gem| AppBuilder.user_choice << gem }
|
401
401
|
end
|
402
402
|
add_user_gems
|
403
403
|
end
|
@@ -418,7 +418,7 @@ end
|
|
418
418
|
end
|
419
419
|
|
420
420
|
def prevent_double_usage
|
421
|
-
|
421
|
+
unless !pgsql_db_exist?("#{app_name}_development") || !pgsql_db_exist?("#{app_name}_test")
|
422
422
|
say_color RED, " YOU HAVE EXISTING DB WITH #{app_name.upcase}!!!"
|
423
423
|
say_color RED, " WRITE 'Y' TO CONTINUE WITH DELETION OF ALL DATA"
|
424
424
|
say_color RED, ' ANY OTHER INPUT FOR EXIT'
|
@@ -31,9 +31,9 @@ module Onotole
|
|
31
31
|
class_option :clean_comments, type: :boolean, aliases: '--clean_comments', default: false,
|
32
32
|
desc: 'Clean up comments in config & routes files'
|
33
33
|
|
34
|
-
GEMPROCLIST.each do |
|
35
|
-
class_option
|
36
|
-
|
34
|
+
GEMPROCLIST.each do |gem_name|
|
35
|
+
class_option gem_name.to_sym, type: :boolean, aliases: "--#{gem_name}",
|
36
|
+
default: false, desc: "#{gem_name.to_s.humanize} gem install"
|
37
37
|
end
|
38
38
|
super
|
39
39
|
end
|
@@ -72,6 +72,7 @@ module Onotole
|
|
72
72
|
invoke :create_github_repo
|
73
73
|
invoke :setup_segment
|
74
74
|
invoke :setup_spring
|
75
|
+
invoke :pre_commit_cleanup
|
75
76
|
invoke :git_first_commit
|
76
77
|
invoke :outro
|
77
78
|
end
|
@@ -191,17 +192,15 @@ module Onotole
|
|
191
192
|
# end
|
192
193
|
|
193
194
|
def setup_git
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
end
|
195
|
+
return if options[:skip_git]
|
196
|
+
say 'Initializing git'
|
197
|
+
invoke :init_git
|
198
198
|
end
|
199
199
|
|
200
200
|
def setup_gitignore
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
end
|
201
|
+
return if options[:skip_git]
|
202
|
+
say 'Replace .gitignore'
|
203
|
+
invoke :setup_gitignore
|
205
204
|
end
|
206
205
|
|
207
206
|
def git_first_commit
|
@@ -224,10 +223,10 @@ module Onotole
|
|
224
223
|
end
|
225
224
|
|
226
225
|
def create_github_repo
|
227
|
-
if
|
228
|
-
|
229
|
-
|
230
|
-
|
226
|
+
return if options[:skip_git]
|
227
|
+
return unless options[:github]
|
228
|
+
say 'Creating Github repo'
|
229
|
+
build :create_github_repo, options[:github]
|
231
230
|
end
|
232
231
|
|
233
232
|
def setup_segment
|
@@ -292,6 +291,10 @@ module Onotole
|
|
292
291
|
build :prevent_double_usage
|
293
292
|
end
|
294
293
|
|
294
|
+
def pre_commit_cleanup
|
295
|
+
build :clean_by_rubocop
|
296
|
+
end
|
297
|
+
|
295
298
|
protected
|
296
299
|
|
297
300
|
def get_builder_class
|
data/lib/onotole/git.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Onotole
|
3
|
+
module Git
|
4
|
+
def install_user_gems_from_github
|
5
|
+
File.readlines('Gemfile').each do |l|
|
6
|
+
possible_gem_name = l.match(%r{(?:github:\s+)(?:'|")\w+/(.*)(?:'|")}i)
|
7
|
+
install_from_github possible_gem_name[1] if possible_gem_name
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def create_github_repo(repo_name)
|
12
|
+
system "hub create #{repo_name}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def init_git
|
16
|
+
run 'git init'
|
17
|
+
end
|
18
|
+
|
19
|
+
def git_init_commit
|
20
|
+
return unless user_choose?(:gitcommit)
|
21
|
+
say 'Init commit'
|
22
|
+
run 'git add .'
|
23
|
+
run 'git commit -m "Init commit"'
|
24
|
+
end
|
25
|
+
|
26
|
+
def gitignore_files
|
27
|
+
remove_file '.gitignore'
|
28
|
+
copy_file 'gitignore_file', '.gitignore'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Onotole
|
3
|
+
module Helpers
|
4
|
+
def yes_no_question(gem_name, gem_description)
|
5
|
+
gem_name_color = "#{gem_name.capitalize}.\n"
|
6
|
+
variants = { none: 'No', gem_name.to_sym => gem_name_color }
|
7
|
+
choice "Use #{gem_name}? #{gem_description}", variants
|
8
|
+
end
|
9
|
+
|
10
|
+
def choice(selector, variants)
|
11
|
+
unless variants.keys[1..-1].map { |a| options[a] }.include? true
|
12
|
+
values = []
|
13
|
+
say "\n #{BOLDGREEN}#{selector}#{COLOR_OFF}"
|
14
|
+
variants.each_with_index do |variant, i|
|
15
|
+
values.push variant[0]
|
16
|
+
say "#{i.to_s.rjust(5)}. #{BOLDBLUE}#{variant[1]}#{COLOR_OFF}"
|
17
|
+
end
|
18
|
+
answer = ask_stylish('Enter choice:') until (0...variants.length)
|
19
|
+
.map(&:to_s).include? answer
|
20
|
+
numeric_answer = answer.to_i
|
21
|
+
numeric_answer == :none ? nil : numeric_answer
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def multiple_choice(selector, variants)
|
26
|
+
values = []
|
27
|
+
result = []
|
28
|
+
answers = ''
|
29
|
+
say "\n #{BOLDGREEN}#{selector} Use space as separator#{COLOR_OFF}"
|
30
|
+
variants.each_with_index do |variant, i|
|
31
|
+
values.push variant[0]
|
32
|
+
say "#{i.to_s.rjust(5)}. #{BOLDBLUE}#{variant[0]
|
33
|
+
.to_s.ljust(20)}-#{COLOR_OFF} #{variant[1]}"
|
34
|
+
end
|
35
|
+
loop do
|
36
|
+
answers = ask_stylish('Enter choices:').split ' '
|
37
|
+
break if answers.any? && (answers - (0...variants.length)
|
38
|
+
.to_a.map(&:to_s)).empty?
|
39
|
+
end
|
40
|
+
answers.delete '0'
|
41
|
+
answers.uniq.each { |answer| result.push values[answer.to_i] }
|
42
|
+
result
|
43
|
+
end
|
44
|
+
|
45
|
+
def raise_on_missing_translations_in(environment)
|
46
|
+
config = 'config.action_view.raise_on_missing_translations = true'
|
47
|
+
uncomment_lines("config/environments/#{environment}.rb", config)
|
48
|
+
end
|
49
|
+
|
50
|
+
def heroku_adapter
|
51
|
+
@heroku_adapter ||= Adapters::Heroku.new(self)
|
52
|
+
end
|
53
|
+
|
54
|
+
def serve_static_files_line
|
55
|
+
"config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?\n"
|
56
|
+
end
|
57
|
+
|
58
|
+
def add_gems_from_args
|
59
|
+
ARGV.each do |gem_name|
|
60
|
+
next unless gem_name.slice(0, 2) == '--'
|
61
|
+
add_to_user_choise gem_name[2..-1].to_sym
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def cleanup_comments(file_name)
|
66
|
+
accepted_content = File.readlines(file_name).reject do |line|
|
67
|
+
line =~ /^\s*#.*$/ || line =~ /^$\n/
|
68
|
+
end
|
69
|
+
|
70
|
+
File.open(file_name, 'w') do |file|
|
71
|
+
accepted_content.each { |line| file.puts line }
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# does not recognize variable nesting, but now it does not matter
|
76
|
+
def cover_def_by(file_name, lookup_str, external_def)
|
77
|
+
expect_end = 0
|
78
|
+
found = false
|
79
|
+
accepted_content = ''
|
80
|
+
File.readlines(file_name).each do |line|
|
81
|
+
expect_end += 1 if found && line =~ /\sdo\s/
|
82
|
+
expect_end -= 1 if found && line =~ /(\s+end|^end)/
|
83
|
+
if line =~ Regexp.new(lookup_str)
|
84
|
+
accepted_content += "#{external_def}\n#{line}"
|
85
|
+
expect_end += 1
|
86
|
+
found = true
|
87
|
+
else
|
88
|
+
accepted_content += line
|
89
|
+
end
|
90
|
+
if found && expect_end == 0
|
91
|
+
accepted_content += "\nend"
|
92
|
+
found = false
|
93
|
+
end
|
94
|
+
end
|
95
|
+
File.open(file_name, 'w') { |file| file.puts accepted_content }
|
96
|
+
end
|
97
|
+
|
98
|
+
def install_from_github(_gem_name)
|
99
|
+
# TODO: in case of bundler update `bundle show` do now work any more
|
100
|
+
true
|
101
|
+
|
102
|
+
# return nil unless gem_name
|
103
|
+
# path = `cd #{Dir.pwd} && bundle show #{gem_name}`.chomp
|
104
|
+
# run "cd #{path} && bundle exec gem build #{gem_name}.gemspec && bundle exec gem install *.gem"
|
105
|
+
end
|
106
|
+
|
107
|
+
def user_choose?(gem)
|
108
|
+
AppBuilder.user_choice.include? gem
|
109
|
+
end
|
110
|
+
|
111
|
+
def add_to_user_choise(gem)
|
112
|
+
AppBuilder.user_choice.push gem
|
113
|
+
end
|
114
|
+
|
115
|
+
def rails_generator(command)
|
116
|
+
bundle_command "exec rails generate #{command} -f"
|
117
|
+
end
|
118
|
+
|
119
|
+
def pgsql_db_exist?(db_name)
|
120
|
+
system "psql -l | grep #{db_name}"
|
121
|
+
end
|
122
|
+
|
123
|
+
def clean_by_rubocop
|
124
|
+
bundle_command 'exec rubocop --auto-correct' if user_choose?(:rubocop)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
data/lib/onotole/mail.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Onotole
|
3
|
+
module Mail
|
4
|
+
def configure_action_mailer
|
5
|
+
action_mailer_host 'development', %("localhost:3000")
|
6
|
+
action_mailer_host 'test', %("www.example.com")
|
7
|
+
action_mailer_host 'production', %{ENV.fetch("APPLICATION_HOST")}
|
8
|
+
end
|
9
|
+
|
10
|
+
def configure_action_mailer_in_specs
|
11
|
+
copy_file 'action_mailer.rb', 'spec/support/action_mailer.rb'
|
12
|
+
end
|
13
|
+
|
14
|
+
def configure_smtp
|
15
|
+
copy_file 'smtp.rb', 'config/smtp.rb'
|
16
|
+
|
17
|
+
prepend_file 'config/environments/production.rb',
|
18
|
+
%{require Rails.root.join("config/smtp")\n}
|
19
|
+
|
20
|
+
config = <<-RUBY
|
21
|
+
|
22
|
+
config.action_mailer.delivery_method = :smtp
|
23
|
+
config.action_mailer.smtp_settings = SMTP_SETTINGS
|
24
|
+
RUBY
|
25
|
+
|
26
|
+
inject_into_file 'config/environments/production.rb', config,
|
27
|
+
after: 'config.action_mailer.raise_delivery_errors = false'
|
28
|
+
end
|
29
|
+
|
30
|
+
def set_test_delivery_method
|
31
|
+
inject_into_file(
|
32
|
+
'config/environments/development.rb',
|
33
|
+
"\n config.action_mailer.delivery_method = :test",
|
34
|
+
after: 'config.action_mailer.raise_delivery_errors = true'
|
35
|
+
)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Onotole
|
3
|
+
module Tests
|
4
|
+
def generate_rspec
|
5
|
+
['app/views/pages',
|
6
|
+
'spec/lib',
|
7
|
+
'spec/controllers',
|
8
|
+
'spec/helpers',
|
9
|
+
'spec/support/matchers',
|
10
|
+
'spec/support/mixins',
|
11
|
+
'spec/support/shared_examples'
|
12
|
+
].each do |dir|
|
13
|
+
run "mkdir #{dir}"
|
14
|
+
run "touch #{dir}/.keep"
|
15
|
+
end
|
16
|
+
bundle_command 'exec rails generate rspec:install'
|
17
|
+
end
|
18
|
+
|
19
|
+
def configure_capybara_webkit
|
20
|
+
copy_file 'capybara_webkit.rb', 'spec/support/capybara_webkit.rb'
|
21
|
+
end
|
22
|
+
|
23
|
+
def configure_i18n_for_test_environment
|
24
|
+
copy_file 'i18n.rb', 'spec/support/i18n.rb'
|
25
|
+
end
|
26
|
+
|
27
|
+
def configure_rspec
|
28
|
+
remove_file 'spec/rails_helper.rb'
|
29
|
+
remove_file 'spec/spec_helper.rb'
|
30
|
+
copy_file 'rails_helper.rb', 'spec/rails_helper.rb'
|
31
|
+
copy_file 'spec_helper.rb', 'spec/spec_helper.rb'
|
32
|
+
end
|
33
|
+
|
34
|
+
def configure_generators
|
35
|
+
config = <<-RUBY
|
36
|
+
|
37
|
+
config.generators do |generate|
|
38
|
+
generate.helper false
|
39
|
+
generate.javascript_engine false
|
40
|
+
generate.request_specs false
|
41
|
+
generate.routing_specs false
|
42
|
+
generate.stylesheets false
|
43
|
+
generate.test_framework :rspec
|
44
|
+
generate.view_specs false
|
45
|
+
generate.fixture_replacement :factory_girl
|
46
|
+
end
|
47
|
+
|
48
|
+
RUBY
|
49
|
+
|
50
|
+
inject_into_class 'config/application.rb', 'Application', config
|
51
|
+
end
|
52
|
+
|
53
|
+
def enable_database_cleaner
|
54
|
+
copy_file 'database_cleaner_rspec.rb', 'spec/support/database_cleaner.rb'
|
55
|
+
end
|
56
|
+
|
57
|
+
def provide_shoulda_matchers_config
|
58
|
+
copy_file(
|
59
|
+
'shoulda_matchers_config_rspec.rb',
|
60
|
+
'spec/support/shoulda_matchers.rb'
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
def configure_spec_support_features
|
65
|
+
empty_directory_with_keep_file 'spec/features'
|
66
|
+
empty_directory_with_keep_file 'spec/support/features'
|
67
|
+
end
|
68
|
+
|
69
|
+
def set_up_factory_girl_for_rspec
|
70
|
+
copy_file 'factory_girl_rspec.rb', 'spec/support/factory_girl.rb'
|
71
|
+
end
|
72
|
+
|
73
|
+
def generate_factories_file
|
74
|
+
copy_file 'factories.rb', 'spec/factories.rb'
|
75
|
+
end
|
76
|
+
|
77
|
+
def raise_on_missing_assets_in_test
|
78
|
+
inject_into_file(
|
79
|
+
'config/environments/test.rb',
|
80
|
+
"\n config.assets.raise_runtime_errors = true",
|
81
|
+
after: 'Rails.application.configure do'
|
82
|
+
)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
data/lib/onotole/version.rb
CHANGED
@@ -176,20 +176,23 @@ RSpec.describe 'Suspend a new project with default configuration' do
|
|
176
176
|
end
|
177
177
|
end
|
178
178
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
179
|
+
# TODO
|
180
|
+
# Not actual in current init config. I'll test it when I'll
|
181
|
+
# write tests for working with flags.
|
182
|
+
# it 'removes comments and extra newlines from config files' do
|
183
|
+
# config_files = [
|
184
|
+
# IO.read("#{project_path}/config/application.rb"),
|
185
|
+
# IO.read("#{project_path}/config/environment.rb"),
|
186
|
+
# IO.read("#{project_path}/config/environments/development.rb"),
|
187
|
+
# IO.read("#{project_path}/config/environments/production.rb"),
|
188
|
+
# IO.read("#{project_path}/config/environments/test.rb")
|
189
|
+
# ]
|
190
|
+
|
191
|
+
# config_files.each do |file|
|
192
|
+
# expect(file).not_to match(/.*\s#.*/)
|
193
|
+
# expect(file).not_to match(/^$\n/)
|
194
|
+
# end
|
195
|
+
# end
|
193
196
|
|
194
197
|
it 'copies factories.rb' do
|
195
198
|
expect(File).to exist("#{project_path}/spec/factories.rb")
|
data/spec/support/onotole.rb
CHANGED
@@ -11,6 +11,9 @@ module OnotoleTestHelpers
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def run_onotole(arguments = nil)
|
14
|
+
# unless !pgsql_db_exist?("#{APP_NAME}_development") || !pgsql_db_exist?("#{APP_NAME}_test")
|
15
|
+
# allow(STDIN).to receive(:gets) { 'Y' }
|
16
|
+
# end
|
14
17
|
Dir.chdir(tmp_path) do
|
15
18
|
Bundler.with_clean_env do
|
16
19
|
add_fakes_to_path
|
@@ -56,4 +59,8 @@ module OnotoleTestHelpers
|
|
56
59
|
def root_path
|
57
60
|
File.expand_path('../../../', __FILE__)
|
58
61
|
end
|
62
|
+
|
63
|
+
def pgsql_db_exist?(db_name)
|
64
|
+
system "psql -l | grep #{db_name}"
|
65
|
+
end
|
59
66
|
end
|
data/templates/README.md.erb
CHANGED
@@ -2,25 +2,31 @@
|
|
2
2
|
|
3
3
|
## Onotole helped!
|
4
4
|
|
5
|
-
|
5
|
+
At first, I want to say thank you for using Onotole(https://github.com/kvokka/onotole)
|
6
|
+
Visit project page for news and updates
|
7
|
+
|
8
|
+
### Getting Started
|
6
9
|
|
7
10
|
After you have cloned this repo, run this setup script to set up your machine
|
8
11
|
with the necessary dependencies to run and test this app:
|
9
12
|
|
10
|
-
|
11
|
-
|
12
|
-
It assumes you have a machine equipped with Ruby, Postgres, etc. If not, set up
|
13
|
-
your machine with [this script].
|
13
|
+
./bin/setup
|
14
14
|
|
15
|
-
|
15
|
+
It assumes you have a machine equipped with Bundler, Git, Ruby, Postgres, Bash
|
16
|
+
You will need to use the Ruby at least <%= Onotole::RUBY_VERSION %> and
|
17
|
+
Rails <%= Onotole::RAILS_VERSION%>
|
16
18
|
|
17
19
|
After setting up, you can run the application using [Heroku Local]:
|
18
20
|
|
19
|
-
|
21
|
+
heroku local
|
20
22
|
|
21
23
|
[Heroku Local]: https://devcenter.heroku.com/articles/heroku-local
|
22
24
|
|
23
|
-
|
25
|
+
rails server
|
26
|
+
|
27
|
+
It is also available, of course.
|
28
|
+
|
29
|
+
### Guidelines
|
24
30
|
|
25
31
|
Use the following guides for getting things done, programming well, and
|
26
32
|
programming in style.
|
data/templates/bin_setup
CHANGED
data/templates/rubocop.yml
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onotole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kvokka
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-02-
|
12
|
+
date: 2016-02-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -90,6 +90,10 @@ files:
|
|
90
90
|
- lib/onotole/app_builder.rb
|
91
91
|
- lib/onotole/colors.rb
|
92
92
|
- lib/onotole/generators/app_generator.rb
|
93
|
+
- lib/onotole/git.rb
|
94
|
+
- lib/onotole/helpers.rb
|
95
|
+
- lib/onotole/mail.rb
|
96
|
+
- lib/onotole/tests.rb
|
93
97
|
- lib/onotole/version.rb
|
94
98
|
- onotole.gemspec
|
95
99
|
- spec/adapters/heroku_spec.rb
|