autogen_sindb 0.1.0 → 0.1.1
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/lib/sinatrabase_fs/structure_me.rb +3 -4
- data/lib/sinatrabase_fs/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29e04bf93b59d2a892136e66c9a082591a04516b8c9bb2157e62e9b2c63754a3
|
4
|
+
data.tar.gz: 0e6ff0c5587ef227cdf0d5e979a863a278557bfbd5a3bdda005338b66c4afc2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ed5e97d2d6d4ab0e053cfde4e014385b8c29846fe37918a4feae844928b5c75bc378b1c2a6d59f5477815e860c45c421cec8a58c03182478ae955ed1cfaa513
|
7
|
+
data.tar.gz: 1b67c48c31f63831c4555d283b9bc4e7e6031a2cb725a25ae8388596aaacaced25cdb81e3d78aa6fcc095c50e16e144a6be46b20950baaa3dc0beab45901c253
|
@@ -14,7 +14,6 @@ class SinatrabaseFs::StructureMe
|
|
14
14
|
|
15
15
|
def make_dirs
|
16
16
|
curr_dir = Dir.pwd
|
17
|
-
# root = "/sinatrabase_fs"
|
18
17
|
|
19
18
|
FileUtils.cd(curr_dir) do |dir|
|
20
19
|
%w(app app/controllers app/models app/views config public public/css public/images public/js db/migrate spec).each do |directory|
|
@@ -56,7 +55,7 @@ class SinatrabaseFs::StructureMe
|
|
56
55
|
def write_to_config_environment_rb
|
57
56
|
FileUtils.cd(Dir.pwd) do |dir|
|
58
57
|
file = File.open("config/environment.rb", 'w')
|
59
|
-
file.puts "ENV['SINATRA_ENV'] ||= \"development\"\n\nrequire 'bundler/setup'\nBundler.require(:default, ENV['SINATRA_ENV'])\n\n# SET CONNECTION TO DATABASE\
|
58
|
+
file.puts "ENV['SINATRA_ENV'] ||= \"development\"\n\nrequire 'bundler/setup'\nBundler.require(:default, ENV['SINATRA_ENV'])\n\n# SET CONNECTION TO DATABASE\ndef fi_check_migration\n\tbegin\n\t\tActiveRecord::Migration.check_pending!\n\trescue ActiveRecord::PendingMigrationError\n\t\traise ActiveRecord::PendingMigrationError.new \"Migrations are pending.\nTo resolve this issue, run: \nrake db:migrate SINATRA_ENV=\#{ENV['SINATRA_ENV']}\"\n\tend\nend\n\nActiveRecord::Base.establish_connection(\n\t:adapter => \"sqlite3\",\n\t:database => \"db/\#{ENV['SINATRA_ENV']}.sqlite\"\n)\n\nrequire_all 'app'"
|
60
59
|
file.close
|
61
60
|
end
|
62
61
|
end
|
@@ -64,7 +63,7 @@ class SinatrabaseFs::StructureMe
|
|
64
63
|
def write_to_config_ru
|
65
64
|
FileUtils.cd(Dir.pwd) do |dir|
|
66
65
|
file = File.open("config.ru", 'w')
|
67
|
-
file.puts "require './config/environment'\n\
|
66
|
+
file.puts "require './config/environment'\n\nbegin\n\tfi_check_migration\n\n\tuse Rack::MethodOverride\n\n\trun ApplicationController # or whatever the app controller module/class name you want eg. App\nrescue ActiveRecord::PendingMigrationError => err\n\tSTDERR.puts err\n\texit 1\nend"
|
68
67
|
file.close
|
69
68
|
end
|
70
69
|
end
|
@@ -72,7 +71,7 @@ class SinatrabaseFs::StructureMe
|
|
72
71
|
def write_to_gemfile
|
73
72
|
FileUtils.cd(Dir.pwd) do |dir|
|
74
73
|
file = File.open("Gemfile", 'w')
|
75
|
-
file.puts "source 'https://rubygems.org'\n\ngem 'sinatra'\ngem 'thin'\ngem 'require_all'\ngem 'activerecord', '5.2'\ngem 'sinatra-activerecord'\ngem 'rake'\n\ngroup :development do\n\tgem 'shotgun'\n\tgem 'pry'\n\tgem 'tux'\n\tgem 'sqlite3', '~> 1.3.6'\nend"
|
74
|
+
file.puts "source 'https://rubygems.org'\n\ngem 'sinatra'\ngem 'thin'\ngem 'require_all'\ngem 'activerecord', '5.2'\ngem 'sinatra-activerecord'\ngem 'database_cleaner'\ngem 'rake'\n\ngroup :development do\n\tgem 'capybara'\n\tgem 'shotgun'\n\tgem 'pry'\n\tgem 'tux'\n\tgem 'sqlite3', '~> 1.3.6'\nend"
|
76
75
|
file.close
|
77
76
|
end
|
78
77
|
end
|