Module: GenericApp
- Defined in:
- lib/generic_app.rb,
lib/generic_app/version.rb
Constant Summary collapse
- VERSION =
'2.0.0'.freeze
Class Method Summary collapse
-
.create_new(subdir_name, email) ⇒ Object
Create app, stick with SQLite database in development.
- .email_update(subdir_name, email) ⇒ Object
- .git_clone(subdir_name) ⇒ Object
- .git_init(subdir_name) ⇒ Object
- .remove_badges(subdir_name) ⇒ Object
- .remove_heroku_name(subdir_name) ⇒ Object
Class Method Details
.create_new(subdir_name, email) ⇒ Object
Create app, stick with SQLite database in development
14 15 16 17 18 19 20 21 |
# File 'lib/generic_app.rb', line 14 def self.create_new(subdir_name, email) t1 = Thread.new { self.git_clone(subdir_name) } t1.join self.remove_heroku_name(subdir_name) self.email_update(subdir_name, email) self.remove_badges(subdir_name) self.git_init(subdir_name) end |
.email_update(subdir_name, email) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/generic_app.rb', line 34 def self.email_update(subdir_name, email) email_orig = '[email protected]' path_of_email_1 = "#{subdir_name}/config/initializers/devise.rb" path_of_email_2 = "#{subdir_name}/app/views/static_pages/contact.html.erb" path_of_email_3 = "#{subdir_name}/test/integration/static_pages_test.rb" StringInFile.replace(email_orig, email, path_of_email_1) StringInFile.replace(email_orig, email, path_of_email_2) StringInFile.replace(email_orig, email, path_of_email_3) end |
.git_clone(subdir_name) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/generic_app.rb', line 27 def self.git_clone(subdir_name) puts '------------------------------------' puts 'Downloading the Generic App Template' url_template = StringInFile.read("#{DIR_MAIN}/lib/generic_app/git_clone_url.txt") system("git clone #{url_template} #{subdir_name}") end |
.git_init(subdir_name) ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'lib/generic_app.rb', line 54 def self.git_init(subdir_name) puts '----------------' puts 'Initializing Git' system("cd #{subdir_name} && rm -rf .git") system("cd #{subdir_name} && git init") system("cd #{subdir_name} && git add .") system("cd #{subdir_name} && git commit -m 'Initial commit' >/dev/null") end |
.remove_badges(subdir_name) ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/generic_app.rb', line 44 def self.remove_badges(subdir_name) path_readme = "#{subdir_name}/README.md" line1 = 'BEGIN: continuous integration badges' line2 = 'END: continuous integration badges' LineContaining.delete_between(line1, line2, path_readme) LineContaining.delete(line1, path_readme) LineContaining.delete(line2, path_readme) RemoveDoubleBlank.update(path_readme) end |
.remove_heroku_name(subdir_name) ⇒ Object
23 24 25 |
# File 'lib/generic_app.rb', line 23 def self.remove_heroku_name(subdir_name) File.delete("#{subdir_name}/config/heroku_name.txt") end |