neetob 0.5.13 → 0.5.14

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: 4ece2e273c87d505a4847def37fdde461c3128f4a62f4a5b700de4731e264ddd
4
- data.tar.gz: a18bceaca59015a0d051cb03e8bde205d35a76c6d50ad2b1555b574f7a6e9aa2
3
+ metadata.gz: ba3c208ac7f1da0b1593dee29b8ee0a7a0b5b98c8957b287164ebc9bbbddf371
4
+ data.tar.gz: 9b19df41c3ae723562fb147336a6895200019085225701d16e3dc1c28b5ffd37
5
5
  SHA512:
6
- metadata.gz: ad56720947b4df853b92437d62cd3d3ecfc59bed705e59bda46af3ba66ae21f98cd68dc5249ceee086ccbd8d19a0d29c350e224b27f44b53487fe2cdf4cb0488
7
- data.tar.gz: 6902abc809e2a0b4efbd7cd2b8812c3d3eed1628f331fc133aa33dff68032f8b5ccfef180595fdd54bedea2c6e05b6f3445909e55e6c019366c4e2385d43ae90
6
+ metadata.gz: ca02040e0da97e6d32219ecd5594835293d99d919830ebf463873ca734d53c1f4b35745347e93ae94f8dc15a5dd07b4ac7afcae5e8aa035ec80c4f03058430e1
7
+ data.tar.gz: eb886f8ef5a4dd01bf77400907f131d8c352bf9427c950e2c2b33cb94517e3ccde2df664a9762f6aa75bc85454acd06fd9eb89830d79f3fe0f8292b7ce2da814
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- neetob (0.5.13)
4
+ neetob (0.5.14)
5
5
  brakeman (~> 5.0)
6
6
  chronic
7
7
  dotenv (~> 2.8.1)
data/README.md CHANGED
@@ -293,6 +293,16 @@ Authenticate through your browser and update your Github access token by utilizi
293
293
  neetob github login
294
294
  ```
295
295
 
296
+ ## Working with Redirections
297
+
298
+ ### Check
299
+
300
+ The `redirections check` command can check if redirection from a given source URL to a given destination URL is working properly.
301
+
302
+ ```
303
+ neetob redirections check -s https://academy.bigbinary.com -d https://bigbinaryacademy.com
304
+ ```
305
+
296
306
  ## Working with Heroku
297
307
 
298
308
  Utilize the `help` command to list all the available subcommands under the Heroku module for interacting with the Heroku resources.
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neetob
4
+ class CLI
5
+ module Redirections
6
+ class Check < CLI::Base
7
+ attr_accessor :sandbox, :source, :destination
8
+
9
+ def initialize(source, destination, sandbox = false)
10
+ super()
11
+ @source = source
12
+ @destination = destination
13
+ @sandbox = sandbox
14
+ end
15
+
16
+ def run
17
+ source_url = URI.parse(source)
18
+ destination_url = URI.parse(destination)
19
+
20
+ response = Net::HTTP.get_response(source_url)
21
+
22
+ if response.code.in? %w(301 302 308)
23
+ if response["location"].chomp("/") == destination.chomp("/")
24
+ ui.success("The redirection from #{source} to #{destination} is working properly.")
25
+ else
26
+ ui.error("The redirection from #{source} to #{destination} is not working properly.")
27
+ end
28
+ else
29
+ ui.error("The redirection from #{source} to #{destination} is not working properly.")
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "thor"
4
+ require_relative "check"
5
+
6
+ module Neetob
7
+ class CLI
8
+ module Redirections
9
+ class Commands < Thor
10
+ desc "check", "Check whether one URL is redirecting to another URL"
11
+ option :source, type: :string, aliases: "-s", required: true, desc: "Source URL. Example: https://academy.bigbinary.com"
12
+ option :destination, type: :string, aliases: "-d", required: true, desc: "Destination URL. Example: https://bigbinaryacademy.com"
13
+
14
+ def check
15
+ Check.new(options[:source], options[:destination], options[:sandbox]).run
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
data/lib/neetob/cli.rb CHANGED
@@ -13,6 +13,7 @@ module Neetob
13
13
  require_relative "cli/local/commands"
14
14
  require_relative "cli/code/commands"
15
15
  require_relative "cli/neeto_deploy/commands"
16
+ require_relative "cli/redirections/commands"
16
17
 
17
18
  class_option :sandbox,
18
19
  {
@@ -48,6 +49,9 @@ module Neetob
48
49
  desc "code", "Interact with code base of neeto products"
49
50
  subcommand "code", Code::Commands
50
51
 
52
+ desc "redirections", "Check whether the redirections are working properly"
53
+ subcommand "redirections", Redirections::Commands
54
+
51
55
  desc "make_repos_uptodate", "Uptodate all neeto repos"
52
56
  option :repos, type: :array, aliases: "-r", default: ["*"],
53
57
  desc: "Github repo names. Can be matched using the '*' wildcard. Example: \"neeto*\" \"neeto-cal-web\", also providing \"all\" as value matches all neeto repos. Note: The default value is \"*\", hence all neeto repos would be affected."
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Neetob
4
- VERSION = "0.5.13"
4
+ VERSION = "0.5.14"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neetob
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.13
4
+ version: 0.5.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Udai Gupta
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-29 00:00:00.000000000 Z
11
+ date: 2024-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -233,6 +233,8 @@ files:
233
233
  - lib/neetob/cli/neeto_deploy/config_vars/remove.rb
234
234
  - lib/neetob/cli/neeto_deploy/config_vars/upsert.rb
235
235
  - lib/neetob/cli/neeto_deploy/scheduled_exports.rb
236
+ - lib/neetob/cli/redirections/check.rb
237
+ - lib/neetob/cli/redirections/commands.rb
236
238
  - lib/neetob/cli/sre/base.rb
237
239
  - lib/neetob/cli/sre/check_essential_env.rb
238
240
  - lib/neetob/cli/sre/checklist.rb