Skip to content

Commit f503f27

Browse files
authored
[JewishPulse]
1 parent 3781708 commit f503f27

File tree

10 files changed

+232
-0
lines changed

10 files changed

+232
-0
lines changed

.gitattributes

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Force LF line endings
2+
* text=auto eol=lf
3+
4+
# Set file types
5+
*.php text
6+
*.sh text eol=lf
7+
*.md text
8+
*.yml text
9+
*.json text
10+
*.xml text
11+
*.env text
12+
13+
# Exclude tests and dev files from export
14+
/tests export-ignore
15+
phpunit.xml export-ignore
16+
phpcs.xml export-ignore
17+
php-cs-fixer.dist.php export-ignore
18+
Makefile export-ignore
19+
.dockerignore export-ignore
20+
Dockerfile export-ignore
21+
composer.lock export-ignore
22+
23+
README.md export-ignore
24+
CHANGELOG.md export-ignore
25+

.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.env
2+
.env.local
3+
.env.*.local
4+
/vendor/
5+
/node_modules/
6+
/.idea/
7+
/.vscode/
8+
.DS_Store
9+
*.log
10+
*.cache
11+
12+
docker-compose.override.yml
13+
*.pid
14+
15+
composer.lock
16+
17+
.phpunit.result.cache
18+
/tests/output/
19+
20+
data/**/lang.txt
21+
data/**/user_config.json
22+
data/**/*.sqlite
23+
24+
/build/
25+
/dist/
26+
27+
*.bak
28+
*.swp
29+
*.swo
30+
31+
sessions
32+
docs_md
33+
session.mad
34+
*.madeline
35+
*.madeline.*
36+
madeline.phar
37+
madeline.phar.version
38+
madeline.php
39+
40+
*.save
41+
*.save.1
42+
*.save.*

.php-cs-fixer.dist.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->in(__DIR__)
5+
->exclude('vendor');
6+
7+
return (new PhpCsFixer\Config())
8+
->setRules([
9+
'@PSR12' => true,
10+
'array_syntax' => ['syntax' => 'short'],
11+
])
12+
->setFinder($finder);

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM hub.madelineproto.xyz/danog/madelineproto
2+
3+
RUN apk add --no-cache docker-cli docker-compose
4+
5+
WORKDIR /app

Makefile

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# 📦 Build the Docker image
2+
build:
3+
@echo "🔧 Building Docker containers..."
4+
@docker-compose build
5+
6+
# 🚀 Start the bot in the background
7+
up:
8+
@echo "🚀 Starting the bot..."
9+
@docker-compose up -d
10+
11+
# ⛔ Stop the bot and remove containers
12+
down:
13+
@echo "🛑 Stopping the bot..."
14+
@docker-compose down
15+
16+
# 📺 Live logs from the bot
17+
logs:
18+
@echo "📟 Streaming logs..."
19+
@docker-compose logs -f
20+
21+
# 🐚 Interactive shell access to the bot container
22+
sh:
23+
@docker-compose exec bot sh
24+
25+
# 📥 Install PHP dependencies using Composer
26+
composer-install:
27+
@echo "📥 Installing composer dependencies..."
28+
@docker-compose run --rm bot composer install
29+
30+
# 🔄 Regenerate the Composer autoloader
31+
composer-dump:
32+
@echo "🔄 Dumping composer autoloader..."
33+
@docker-compose run --rm bot composer dump-autoload
34+
35+
# ♻️ Restart the bot without rebuilding
36+
restart:
37+
@echo "♻️ Restarting the bot..."
38+
@docker-compose down
39+
@docker-compose up -d
40+
41+
# ✅ Run tests (if you use PHPUnit)
42+
test:
43+
@echo "✅ Running tests..."
44+
@docker-compose run --rm bot vendor/bin/phpunit
45+
46+
# 🧹 Lint PHP code (if PHP-CS-Fixer or PHPCS is used)
47+
lint:
48+
@echo "🔍 Linting PHP files..."
49+
@docker-compose run --rm bot vendor/bin/phpcs --standard=PSR12 src/
50+
51+
# 🧼 Fix code style
52+
fix:
53+
@echo "🧼 Fixing code style..."
54+
@docker-compose run --rm bot vendor/bin/phpcbf --standard=PSR12 src/
55+
56+
# 🧽 Clean up temporary/cache/dev files
57+
clean:
58+
@echo "🧽 Cleaning build and cache files..."
59+
rm -rf vendor \
60+
.phpunit.result.cache \
61+
/tmp/* \
62+
data/*/lang.txt \
63+
data/*/user_config.json \
64+
data/*/*.sqlite \
65+
tests/output \
66+
*.log
67+
68+
# 📁 Normalize line endings via .gitattributes
69+
gitattributes-check:
70+
@echo "🔄 Checking for line-ending normalization via .gitattributes..."
71+
@git add --renormalize .
72+
73+
# 🖥 Show the status of Docker containers
74+
ps:
75+
@echo "📊 Showing Docker container status..."
76+
@docker-compose ps

composer.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "wizardloop/jewishpulse",
3+
"description": "Your Jewish Bot for Times, Holiness, and Daily Connection.",
4+
"type": "project",
5+
"require": {
6+
"php": "^8.2",
7+
"danog/madelineproto": "^8.4",
8+
"amphp/http-client": "^5.3",
9+
"amphp/amp": "^3.0"
10+
},
11+
"require-dev": {
12+
"phpunit/phpunit": "^10.0",
13+
"squizlabs/php_codesniffer": "^3.7",
14+
"friendsofphp/php-cs-fixer": "^3.50"
15+
},
16+
"autoload": {
17+
"psr-4": {
18+
"JewishPulse\\": "src/"
19+
}
20+
},
21+
"autoload-dev": {
22+
"psr-4": {
23+
"JewishPulse\\Tests\\": "tests/"
24+
}
25+
},
26+
"scripts": {
27+
"test": "phpunit --configuration phpunit.xml"
28+
},
29+
"license": "AGPL-3.0-only",
30+
"authors": [
31+
{
32+
"name": "WizardLoop"
33+
}
34+
]
35+
}

docker-compose.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
services:
2+
jewishpulse:
3+
build: .
4+
restart: always
5+
init: true
6+
tty: true
7+
volumes:
8+
- ./:/app
9+
command: php /app/main.php

main.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
the project created by @wizardloop
4+
*/
5+
require_once __DIR__ . '/vendor/autoload.php';
6+
require_once __DIR__ . '/src/bot.php';
7+
8+
$env = parse_ini_file(__DIR__ . '/src/.env');
9+
10+
runJewishPulse($env['API_ID'], $env['API_HASH'], $env['BOT_TOKEN']);

phpcs.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="JewishPulse">
3+
<description>PHP CodeSniffer configuration for JewishPulse</description>
4+
<file>src</file>
5+
<file>tests</file>
6+
<exclude-pattern>vendor/*</exclude-pattern>
7+
<rule ref="PSR12"/>
8+
</ruleset>

phpunit.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit bootstrap="vendor/autoload.php"
3+
colors="true"
4+
verbose="true">
5+
<testsuites>
6+
<testsuite name="Default">
7+
<directory suffix="Test.php">./tests</directory>
8+
</testsuite>
9+
</testsuites>
10+
</phpunit>

0 commit comments

Comments
 (0)