]> gitweb.hamatoma.de Git - worxer.git/commitdiff
V0.0.2 InitApp.sh improvements
authorWinfried Kappeler <winfried.kappeler@infeos.eu>
Thu, 28 Mar 2024 21:14:22 +0000 (22:14 +0100)
committerWinfried Kappeler <winfried.kappeler@infeos.eu>
Thu, 28 Mar 2024 21:16:09 +0000 (22:16 +0100)
- RoleWorxerSeeder: set of id removed
- InitApp.sh improved

CHANGELOG.md
app/Models/Word2.php [deleted file]
database/seeders/RoleWorxerSeeder.php
scripts/InitApp.sh

index 8d1b5d501e387e9d06e138d876345f557727554e..c9eb20853e9fd85ab76ad5d3f71370e7abc96127 100644 (file)
@@ -1,3 +1,10 @@
+# V0.0.2 InitApp.sh improvements
+
+## Changed
+
+- RoleWorxerSeeder: set of id removed
+- InitApp.sh improved
+
 # V0.0.1
 
 ## Added
diff --git a/app/Models/Word2.php b/app/Models/Word2.php
deleted file mode 100644 (file)
index edaaace..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Illuminate\Database\Eloquent\Collection;
-use Illuminate\Support\Facades\DB;
-use Hamatoma\Laraknife\ViewHelpers;
-use Illuminate\Database\Eloquent\Model;
-use Illuminate\Database\Eloquent\Factories\HasFactory;
-
-class Word extends Model
-{
-    use HasFactory;
-    protected $table = 'words';
-    protected $fillable = [
-        'name',
-        'usage',
-        'wordtype_scope',
-        'verifiedby_id'
-    ];
-}
index 308eccf1d83ee959b6d33ed83e8a95b25219ff68..63ff6a47deb02dd9411d4cf02c997528f4fb83d4 100644 (file)
@@ -14,14 +14,12 @@ class RoleWorxerSeeder extends Seeder
     public function run(): void
     {
         DB::table('roles')->insert([
-            'id' => 5,
             'name' => 'Tutor',
             'priority' => '30'
         ]);
         DB::table('roles')->insert([
-            'id' => 5,
             'name' => 'Student',
-            'priority' => '30'
+            'priority' => '40'
         ]);
     }
 }
index 7408251f6909695ee82b3353fc7031588e46cb0f..377a7caa681ff7d6b1f8ab9facec0f9d4d0bc41c 100755 (executable)
@@ -1,37 +1,58 @@
 #! /bin/bash
 
 function Wait(){
-    read answer "OK? Break with Ctrl-C"
+    echo "OK? Break with Ctrl-C"
+    read answer
 }
 function SeedIt(){
   for class in DatabaseSeeder ModuleSeeder SPropertySeeder RoleSeeder UserSeeder \
       MenuitemSeeder RoleWorxerSeeder FileSeeder NoteSeeder \
       WordSeeder NounSeeder; do
-    sudo -u www-data ./artisan db:seed --class=$class
+    sudo -u $DEV_USER ./artisan db:seed --class=$class
   done
 }
+function CreateStorage(){
+  mkdir -p storage/log
+  if [ ! -d storage/framework/cache ]; then
+    mkdir -p storage/framework/cache storage/framework/views storage/framework/sessions
+  fi
+}
+function LinkLaraknife(){
+  if [ ! -L vendor/hamatoma/laraknife ]; then
+    mkdir -p vendor/hamatoma
+    ln -sv ../../../laraknife vendor/hamatoma
+  fi
+}
 function DoIt(){
-    sudo composer update
-    Wait
-    ./artisan migrate
-    Wait
-    SeedIt
-    Wait
-    npm run build
+  # get DEV_USER
+  . .dev.user
+  apt update && apt install composer
+  LinkLaraknife
+  CreateStorage
+  Wait
+  chown -R $DEV_USER:www-data bootstrap/cache
+  sudo -u $DEV_USER composer update
+  Wait
+  sudo -u $DEV_USER ./artisan migrate
+  Wait
+  SeedIt
+  Wait
+  sudo -u $DEV_USER npm run build
 }
-if [ "$(id -u)" != 0 ]; then
-  echo "+++ Be root"
+if [ ! -d ../laraknife ]; then
+  echo "+++ missing ../laraknife"
+  echo "cd .. ; git clone git@github.com:hamatoma/laraknife.git"
 elif [ ! -e .dev.user ]; then
   echo "+++ call './Own all' before!"
-elif [ ! -d ../laraknife ]; then
-  echo "+++ missing ../laraknife"
-  echo "git clone git@github.com:hamatoma/laraknife.git"
 elif [ ! -f .env ]; then
   echo "+++ missing .env"
   echo "cp -a env.example .env"
 elif [ ! -d /var/lib/mysql/lrvworxer ]; then
   echo "+++ missing db lrvworxer"
   echo "sudo mysqladmin create lrvworxer"
+  echo "echo \"grant all on lrvworxer.* to 'worxer'@'localhost' identified by 'topsecret';\" | sudo mysql mysql"
+elif [ "$(id -u)" != 0 ]; then
+  echo "+++ Be root"
 else
   DoIt
-fi
\ No newline at end of file
+fi