lib/generic_app.rb in generic_app-3.0.14 vs lib/generic_app.rb in generic_app-3.0.15
- old
+ new
@@ -1,12 +1,11 @@
-URL_TEMPLATE = 'https://github.com/jhsu802701/rails-20180313-173135-247.git'.freeze
+URL_TEMPLATE = 'https://github.com/rubyonracetracks/rails-20180402-041538-763.git'.freeze
require 'generic_app/version'
require 'string_in_file'
require 'line_containing'
require 'remove_double_blank'
-require 'open-uri'
# rubocop:disable Metrics/ModuleLength
module GenericApp
# Create app, stick with SQLite database in development
def self.create_new(subdir_name, email, title)
@@ -17,12 +16,14 @@
remove_heroku_name(subdir_name)
email_update(subdir_name, email)
remove_badges(subdir_name)
update_titles(subdir_name, title)
update_todo(subdir_name)
- git_init(subdir_name)
+ remove_travis(subdir_name)
+ update_origin(subdir_name)
print_end_msg(subdir_name)
+ git_init(subdir_name) # Goes last
end
def self.remove_heroku_name(subdir_name)
File.delete("#{subdir_name}/config/heroku_name.txt")
end
@@ -30,13 +31,12 @@
def self.remove_neutrino(subdir_name)
File.delete("#{subdir_name}/neutrino.sh")
end
def self.update_pg_setup(subdir_name)
- File.open("#{subdir_name}/pg_setup.sh", 'w') do |f|
- f.write open('https://gist.githubusercontent.com/jhsu802701/e4d60a972893f78da0f6906a0beeac06/raw/293bd0e74adbfa6b47c81332aa81b84d89770518/pg_setup.sh').read
- end
+ dir_gem_lib = File.expand_path(File.expand_path(__dir__))
+ FileUtils.cp("#{dir_gem_lib}/pg_setup.sh", subdir_name)
end
def self.git_clone(subdir_name)
puts '------------------------------------'
puts 'Downloading the Generic App Template'
@@ -62,10 +62,16 @@
LineContaining.delete('[![Code Climate](https://codeclimate.com', path_readme)
LineContaining.delete('[![Maintainability](https://api.codeclimate.com', path_readme)
RemoveDoubleBlank.update(path_readme)
end
+ def self.update_origin(subdir_name)
+ path_readme = "#{subdir_name}/README.md"
+ StringInFile.replace('[Rails Neutrino]', '[Generic App]', path_readme)
+ StringInFile.replace('(https://github.com/rubyonracetracks/rails_neutrino_5)', '(https://github.com/rubyonracetracks/generic_app)', path_readme)
+ end
+
# rubocop:disable Metrics/AbcSize
def self.update_titles(subdir_name, title)
array_files = []
array_files << "#{subdir_name}/README.md"
array_files << "#{subdir_name}/app/helpers/application_helper.rb"
@@ -106,11 +112,11 @@
end
end
# rubocop:enable Metrics/AbcSize
def self.update_todo(subdir_name)
- url_todo = 'https://gist.github.com/jhsu802701/fdfd6e0732773b379413625463f2d2c0'
+ url_todo = 'https://github.com/rubyonracetracks/cheat_sheets/blob/master/post_generic_app.md'
msg_todo = "Go to #{url_todo} for further instructions."
StringInFile.write("#{msg_todo}\n", "#{subdir_name}/README-to_do.txt")
end
def self.git_init(subdir_name)
@@ -128,8 +134,15 @@
puts ''
puts "Your new app is at #{subdir_name}"
puts ''
puts 'Instructions on how to get started are in the file'
puts 'README-to_do.txt within your new app.'
+ end
+
+ def self.remove_travis(subdir_name)
+ puts '------------------------'
+ puts 'Removing Travis CI files'
+ File.delete("#{subdir_name}/.travis.yml")
+ File.delete("#{subdir_name}/config/database.yml.travis")
end
end
# rubocop:enable Metrics/ModuleLength