hamal 0.1.1 → 0.2

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -4
  3. data/Rakefile +0 -2
  4. data/lib/hamal.rb +15 -4
  5. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 14bef85ae15ae3ceb857725982046d459aae93ac8c0310abc906ceeb1b1a7582
4
- data.tar.gz: d278a83cd3bcb2a48f1d46a3fdbcba5b3d5d199d7cc7a3eb71443376f36dd625
3
+ metadata.gz: f9ef115de2f093d85ef84dbc3fcc3018ced655c0a8a71311ba3cbbbabeb2195f
4
+ data.tar.gz: 65a1477d5ff0827ea4c93bced1f08590b29d806e3497b71898437baa92e446a8
5
5
  SHA512:
6
- metadata.gz: be7aed76bd241ee1d673d98e2c888bf7fe5d2d0995c214120abab1b54f161770e76934d5ece7c45a1fab5dd52780637bb2d3f76e7092620db19675560f00f2d1
7
- data.tar.gz: 60ea6cd95d7a457bb9faabe337cfd74c65b8c4533dc72c3ffc0c9701ed89b1b704caaf95b787f08cbd16a2cc864b87fd9f520bd99220ee1ceb0f906afdda12a4
6
+ metadata.gz: a1a7250bd24d6c87653f3ecb1e725e52a6e342fc9bd0fedf8621ef61c29d5b8b260ea5e0b687458a5f975b56a9680e6131c79cf34e7194f85829943d3effa69f
7
+ data.tar.gz: 6c382bd0bf2e8e4d5817e1ba3f6b940a5fc83d8d999d389ee26e9568ddb76b35803b985dfc1cf1d6aec39e12f86882540c1e9f54f90bfa59b2d7341186514759
data/README.md CHANGED
@@ -252,13 +252,13 @@ Make sure its owner user and group are `rails:rails`.
252
252
 
253
253
  If this is a new app, create its database by running `bin/rails db:create` in
254
254
  out of its images. You will likely have to do this at a later point, when you
255
- do have such an image. Examine `bin/hamal` to determine what arguments to
255
+ do have such an image. Examine `hamal` to determine what arguments to
256
256
  `docker run` are needed, e.g. to set ENV variables and mount host directories.
257
257
  The final commands you're looking for will look something like this:
258
258
 
259
259
  ```
260
- docker run --rm <args inferred from bin/hamal> --entrypoint '/rails/bin/rails' <app_image> -- db:create
261
- docker run --rm <args inferred from bin/hamal> --entrypoint '/rails/bin/rails' <app_image> -- db:schema:load
260
+ docker run --rm <args inferred from hamal> --entrypoint '/rails/bin/rails' <app_image> -- db:create
261
+ docker run --rm <args inferred from hamal> --entrypoint '/rails/bin/rails' <app_image> -- db:schema:load
262
262
  ```
263
263
 
264
264
  ## GitHub
@@ -334,7 +334,7 @@ local commits.
334
334
  For more commands, run `hamal --help`:
335
335
 
336
336
  ```
337
- Usage: bin/hamal [command]
337
+ Usage: hamal [command]
338
338
 
339
339
  Commands:
340
340
  deploy - Deploy the app to the server
data/Rakefile CHANGED
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "bundler/gem_tasks"
4
2
  require "rubocop/rake_task"
5
3
 
data/lib/hamal.rb CHANGED
@@ -3,7 +3,7 @@ require "json"
3
3
  require "yaml"
4
4
 
5
5
  module Hamal
6
- VERSION = "0.1.1"
6
+ VERSION = "0.2"
7
7
 
8
8
  module Config
9
9
  def config_file = "config/deploy.yml"
@@ -209,7 +209,9 @@ module Hamal
209
209
  console_command
210
210
  when "logs"
211
211
  logs_command
212
- when "sudo"
212
+ when "dump"
213
+ dump_command
214
+ when "ssh", "sudo"
213
215
  sudo_command
214
216
  else
215
217
  help_command
@@ -261,6 +263,14 @@ module Hamal
261
263
  end
262
264
  end
263
265
 
266
+ def dump_command
267
+ log "Dumping database"
268
+
269
+ on_server do
270
+ system "scp -O root@#{server}:/var/lib/#{app_name}/db/data.sqlite3 data.sqlite3", exception: true
271
+ end
272
+ end
273
+
264
274
  def sudo_command
265
275
  system "ssh root@#{server}", exception: true
266
276
  end
@@ -271,9 +281,10 @@ module Hamal
271
281
 
272
282
  Commands:
273
283
  deploy - Deploy the app to the server
274
- console - Run Rails console in the deployed container
284
+ console - Run rails console in the deployed container
285
+ backup - Backup the SQLite database from the server
275
286
  logs - Follow logs of the deployed container
276
- sudo - SSH into the server as administrator
287
+ ssh - SSH into the server as administrator, alias: sudo
277
288
  HELP
278
289
  end
279
290
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hamal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genadi Samokovarov
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-01-02 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: json
@@ -56,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0'
58
58
  requirements: []
59
- rubygems_version: 3.6.2
59
+ rubygems_version: 3.6.9
60
60
  specification_version: 4
61
61
  summary: Hamal is a simple deploy tool for self-hosted Rails applications
62
62
  test_files: []