jamal 0.1.1 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 92d9da245898c6f20744182ba5ee84267311786a7a43a29969fc5b9eea848fef
4
- data.tar.gz: bc1dde5d560ce64ea86899811dc287b3abe34effddf02bebc509f322155548ba
3
+ metadata.gz: 1fe7761dd35cd40d0ca04b1340feea7917035e0ce9f2714c6e652106b923a107
4
+ data.tar.gz: 4c073a21d16236e4ce6f300f18fad852d3574de5d6a4dc09cae14a81a38b01e2
5
5
  SHA512:
6
- metadata.gz: b87d271bc63ae31e24547acdb46ae320d8daa00a8139ae4bb3acd10cfeeb2b2c099d9e2351f04ba2cf4498d817152148e6bf96c6ac12705bfb8ccd1745e40cc7
7
- data.tar.gz: b885c2572b5e50df0482fe30071cce5843d9654ac91623b0fd1993c75d0cb09f9587fa994e74eaf514cf90b3286c8b8739afeb916fd1b43982ef2533275d3e9f
6
+ metadata.gz: d8ccb605de0b6c670ffcd8cc83b3385e7a7837c7e780db305a1b7703297b0bbb85c13768e7183b16af4532770b71fe839abf8b84f4a2215380b232cd9986def1
7
+ data.tar.gz: a613a966d2c2c5000ade405eaf2b981a7068d62aad48993ba256ed68daa9d75d0e0f4b085c59a9f817ff7abe61c90618d2494fba9dd5d2933b8873e06f85074e
data/README.md CHANGED
@@ -30,6 +30,8 @@ The `_jamal.yml` file is used to configure the server. It contains the following
30
30
  - `password`: The password of the server.
31
31
  - `domains`: The domains of the website.
32
32
  - `local_path`: The path to the website on your local machine.
33
+ - `remote_dir`: Optional subdirectory of the site to deploy into.
34
+ - `remote_exclude`: Optional subdirectories to exclude when syncing.
33
35
 
34
36
  ## License
35
37
 
data/lib/jamal/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jamal
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.4"
5
5
  end
data/lib/jamal.rb CHANGED
@@ -178,6 +178,19 @@ module Jamal
178
178
  # Replace SSH-based rsync with daemon-based rsync
179
179
  local_path = config['local_path']
180
180
  local_path = "#{local_path}/" unless local_path.end_with?('/')
181
+
182
+ # Subdirectory of the site to sync into, e.g. 'en' for example.com/en
183
+ remote_dir = config['remote_dir'].to_s.strip.gsub(%r{\A/+|/+\z}, '')
184
+ remote_path = "/var/www/#{config['name']}#{"/" + remote_dir unless remote_dir.empty?}"
185
+
186
+ unless remote_dir.empty?
187
+ ssh.exec!("sudo mkdir -p #{remote_path}")
188
+ ssh.exec!("sudo chown -R #{config['user']}:#{config['user']} #{remote_path}")
189
+ ssh.exec!("sudo chmod -R 755 #{remote_path}")
190
+ end
191
+
192
+ # Directories left alone on the server: never uploaded, never deleted
193
+ excludes = Array(config['remote_exclude']).map { |dir| "--exclude=#{dir}" }
181
194
 
182
195
  # Create temporary password file for rsync
183
196
  temp_password_file = Tempfile.new('rsync_password')
@@ -192,8 +205,9 @@ module Jamal
192
205
  "--delete", # delete extraneous files
193
206
  "--out-format='%i | %n'", # simplified output format showing changes and filename
194
207
  "--password-file=#{temp_password_file.path}",
208
+ *excludes,
195
209
  local_path,
196
- "rsync://#{config['name']}@#{config['host']}/#{config['name']}/"
210
+ "rsync://#{config['name']}@#{config['host']}/#{config['name']}/#{remote_dir.empty? ? '' : remote_dir + '/'}"
197
211
  ].join(" ")
198
212
 
199
213
  # Execute rsync with better error handling
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jamal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mounir Ahmina
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-05-13 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: net-ssh
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
127
  - !ruby/object:Gem::Version
128
128
  version: '0'
129
129
  requirements: []
130
- rubygems_version: 3.6.6
130
+ rubygems_version: 4.0.18
131
131
  specification_version: 4
132
132
  summary: Deploy your static website to a remote server
133
133
  test_files: []