capistrano-simple-htaccess 0.1.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35139b12b49d409ca16b35e3fbd18586dba5659bb1b7016149e7be005b787475
4
- data.tar.gz: d0944982eb9e035609e829d6ba65489ddb5687a78b8145e9df28e01cc7993e6d
3
+ metadata.gz: 6ddc60528f1bed0b05195d15e22c42455be872af1a0a938cb94e340588672bf3
4
+ data.tar.gz: d8a6a396a4e4ea89fede3af95fb9999d5124728d320263fd72750384a945f22f
5
5
  SHA512:
6
- metadata.gz: a000b6575f48434523d09c19566fe4b0a6fd03172aebe57abcbac906cdcbf58856c205b7067fd488b56e4b9fc3d485210bbfe9ac3d891c958a74a766f66d163b
7
- data.tar.gz: 7179b543039b2f6060b57b4a3ddd77f37734fa3d8f88e688b796fca500226744abeb92dd559ed33760feeb20573b069e57c7b112b54a6381c3cd8399387a6048
6
+ metadata.gz: 37b051405bbf85f447e89971bcb86ddd1f353f30e186c9facbcfb3f06127b97599188074f50bbdb35a35a2989207ed30bffd54ac8bc0fda34fe311441b689bd1
7
+ data.tar.gz: 14247d574c48e9410dc0e183375e1668c7232bfb38d6dfcf71472edf4ae4824dd8013460fc3763c17af0a3719e82f85e3c3653c64b882202e3266499d8c75d0a
data/.gitignore CHANGED
@@ -1,19 +1,9 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- /vendor/ruby
19
- .idea
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ .idea
@@ -0,0 +1,7 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.5
3
+ DisplayStyleGuide: true
4
+ NewCops: enable
5
+
6
+ Layout/LineLength:
7
+ Max: 120
@@ -2,6 +2,12 @@
2
2
 
3
3
  ### master
4
4
 
5
+ ### v1.0.0, 2020-11-10
6
+
7
+ - Refactor default `.htaccess` file to externally redirect out of capistrano's 'current' directory
8
+ - This requires setting a new `:document_root` variable so the new `.htaccess` file can function
9
+ - `:document_root` should be set to what your Apache's `DocumentRoot` is set to. The rake task will use this to dynamically build the `.htaccess`
10
+
5
11
  ### v0.1.1, 2020-03-17
6
12
 
7
13
  - Run Rubocop formatters on source
data/Gemfile CHANGED
@@ -1,3 +1,8 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
2
 
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in test-gem.gemspec
3
6
  gemspec
7
+
8
+ gem 'rake', '~> 13.0'
@@ -0,0 +1,58 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ capistrano-simple-htaccess (1.0.0)
5
+ capistrano (~> 3.14)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ airbrussh (1.4.0)
11
+ sshkit (>= 1.6.1, != 1.7.0)
12
+ ast (2.4.1)
13
+ capistrano (3.14.1)
14
+ airbrussh (>= 1.0.0)
15
+ i18n
16
+ rake (>= 10.0.0)
17
+ sshkit (>= 1.9.0)
18
+ concurrent-ruby (1.1.7)
19
+ i18n (1.8.5)
20
+ concurrent-ruby (~> 1.0)
21
+ net-scp (3.0.0)
22
+ net-ssh (>= 2.6.5, < 7.0.0)
23
+ net-ssh (6.1.0)
24
+ parallel (1.20.0)
25
+ parser (2.7.2.0)
26
+ ast (~> 2.4.1)
27
+ rainbow (3.0.0)
28
+ rake (13.0.1)
29
+ regexp_parser (1.8.2)
30
+ rexml (3.2.4)
31
+ rubocop (1.2.0)
32
+ parallel (~> 1.10)
33
+ parser (>= 2.7.1.5)
34
+ rainbow (>= 2.2.2, < 4.0)
35
+ regexp_parser (>= 1.8)
36
+ rexml
37
+ rubocop-ast (>= 1.0.1)
38
+ ruby-progressbar (~> 1.7)
39
+ unicode-display_width (>= 1.4.0, < 2.0)
40
+ rubocop-ast (1.1.1)
41
+ parser (>= 2.7.1.5)
42
+ ruby-progressbar (1.10.1)
43
+ sshkit (1.21.0)
44
+ net-scp (>= 1.1.2)
45
+ net-ssh (>= 2.8.0)
46
+ unicode-display_width (1.7.0)
47
+
48
+ PLATFORMS
49
+ ruby
50
+
51
+ DEPENDENCIES
52
+ bundler (~> 2.1)
53
+ capistrano-simple-htaccess!
54
+ rake (~> 13.0)
55
+ rubocop (>= 1.2)
56
+
57
+ BUNDLED WITH
58
+ 2.1.4
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019 DaMoo
3
+ Copyright (c) 2020 DaMoo
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -38,17 +38,29 @@ Found as a HEREDOC string in `lib/capistrano/tasks/simple_htaccess.rake`, but al
38
38
  Options +FollowSymLinks
39
39
 
40
40
  RewriteEngine On
41
- RewriteCond %{REQUEST_URI} !/current/
42
- RewriteRule ^(.*)$ current/$1 [L]
41
+ RewriteBase "%<base>s"
42
+ RewriteRule ^current(.*) %<base>s$1 [NC,R,END]
43
+ RewriteRule ^((?!current/).*)$ current/$1 [NC,END]
43
44
  </IfModule>
44
45
  ```
45
46
 
47
+ The `%<base>s` template strings are replaced with the value of your `:deploy_to` directory, with the `:document_root` variable removed from the string's prefix. This creates a base directory string.
48
+
49
+ Ex:
50
+
51
+ ```ruby
52
+ set :deploy_to, '/var/www/html/example1/public'
53
+ set :document_root, '/var/www/html'
54
+
55
+ # %<base>s would then be replaced with: /example1/public
56
+ ```
57
+
46
58
  ## Configuration
47
59
 
48
60
  If you want a different .htaccess uploaded, just change the `:HTACCESS` variable as part of your deploy config. Ex:
49
61
 
50
62
  ```ruby
51
- set(:HTACCESS), <<HTACCESS
63
+ set :HTACCESS, <<HTACCESS
52
64
  # Put your .htaccess config here
53
65
  HTACCESS
54
66
  ```
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'capistrano/simple_htaccess'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path('lib', __dir__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'capistrano/simple_htaccess/version'
3
+ require_relative 'lib/capistrano/simple_htaccess/version'
6
4
 
7
5
  Gem::Specification.new do |spec|
8
6
  spec.name = 'capistrano-simple-htaccess'
@@ -13,15 +11,24 @@ Gem::Specification.new do |spec|
13
11
  spec.summary = 'Capistrano task for including a simple apache .htaccess file for redirects on deploy'
14
12
  spec.homepage = 'https://github.com/da-moo/capistrano-simple-htaccess'
15
13
  spec.license = 'MIT'
14
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.5')
16
15
 
17
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
16
+ spec.metadata['homepage_uri'] = spec.homepage
17
+ spec.metadata['source_code_uri'] = 'https://github.com/da-moo/capistrano-simple-htaccess'
18
+ spec.metadata['changelog_uri'] = 'https://github.com/da-moo/capistrano-simple-htaccess/blob/master/CHANGELOG.md'
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
18
23
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
24
  end
25
+ spec.bindir = 'exe'
20
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
27
  spec.require_paths = ['lib']
22
28
 
23
- spec.add_dependency 'capistrano', '~> 3.12'
29
+ spec.add_dependency 'capistrano', '~> 3.14'
24
30
 
25
31
  spec.add_development_dependency 'bundler', '~> 2.1'
26
32
  spec.add_development_dependency 'rake', '>= 12.3.3'
33
+ spec.add_development_dependency 'rubocop', '>= 1.2'
27
34
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Capistrano
4
4
  module SimpleHtaccess
5
- VERSION = '0.1.1'
5
+ VERSION = '1.0.0'
6
6
  end
7
7
  end
@@ -3,13 +3,15 @@
3
3
  namespace :load do
4
4
  task :defaults do
5
5
  set :redirect_OK, false
6
+ set :document_root, '/var/www/html'
6
7
  set :HTACCESS, <<~HTACCESS
7
8
  <IfModule mod_rewrite.c>
8
9
  Options +FollowSymLinks
9
10
 
10
11
  RewriteEngine On
11
- RewriteCond %{REQUEST_URI} !/current/
12
- RewriteRule ^(.*)$ current/$1 [L]
12
+ RewriteBase "%<base>s"
13
+ RewriteRule ^current(.*) %<base>s$1 [NC,R,END]
14
+ RewriteRule ^((?!current/).*)$ current/$1 [NC,END]
13
15
  </IfModule>
14
16
 
15
17
  HTACCESS
@@ -20,9 +22,10 @@ namespace :deploy do
20
22
  namespace :simple_htaccess do
21
23
  task :create_htaccess do
22
24
  on roles :web do
23
- unless fetch(:redirect_OK)
24
- upload! StringIO.new(fetch(:HTACCESS)), "#{deploy_to}/.htaccess"
25
- end
25
+ document_root = fetch :document_root
26
+ base_dir = deploy_to.delete_prefix(document_root)
27
+ filled_template = format(fetch(:HTACCESS), base: base_dir)
28
+ upload! StringIO.new(filled_template), "#{deploy_to}/.htaccess" unless fetch(:redirect_OK)
26
29
  end
27
30
  end
28
31
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-simple-htaccess
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - DaMoo
8
- autorequire:
9
- bindir: bin
8
+ autorequire:
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-17 00:00:00.000000000 Z
11
+ date: 2020-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.12'
19
+ version: '3.14'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.12'
26
+ version: '3.14'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,7 +52,21 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 12.3.3
55
- description:
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '1.2'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '1.2'
69
+ description:
56
70
  email:
57
71
  - git@damoo.zone
58
72
  executables: []
@@ -60,11 +74,15 @@ extensions: []
60
74
  extra_rdoc_files: []
61
75
  files:
62
76
  - ".gitignore"
77
+ - ".rubocop.yml"
63
78
  - CHANGELOG.md
64
79
  - Gemfile
80
+ - Gemfile.lock
65
81
  - LICENSE
66
82
  - README.md
67
83
  - Rakefile
84
+ - bin/console
85
+ - bin/setup
68
86
  - capistrano-simple-htaccess.gemspec
69
87
  - lib/capistrano/simple_htaccess.rb
70
88
  - lib/capistrano/simple_htaccess/version.rb
@@ -72,8 +90,11 @@ files:
72
90
  homepage: https://github.com/da-moo/capistrano-simple-htaccess
73
91
  licenses:
74
92
  - MIT
75
- metadata: {}
76
- post_install_message:
93
+ metadata:
94
+ homepage_uri: https://github.com/da-moo/capistrano-simple-htaccess
95
+ source_code_uri: https://github.com/da-moo/capistrano-simple-htaccess
96
+ changelog_uri: https://github.com/da-moo/capistrano-simple-htaccess/blob/master/CHANGELOG.md
97
+ post_install_message:
77
98
  rdoc_options: []
78
99
  require_paths:
79
100
  - lib
@@ -81,15 +102,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
102
  requirements:
82
103
  - - ">="
83
104
  - !ruby/object:Gem::Version
84
- version: '0'
105
+ version: '2.5'
85
106
  required_rubygems_version: !ruby/object:Gem::Requirement
86
107
  requirements:
87
108
  - - ">="
88
109
  - !ruby/object:Gem::Version
89
110
  version: '0'
90
111
  requirements: []
91
- rubygems_version: 3.1.2
92
- signing_key:
112
+ rubygems_version: 3.1.4
113
+ signing_key:
93
114
  specification_version: 4
94
115
  summary: Capistrano task for including a simple apache .htaccess file for redirects
95
116
  on deploy