gwrubysectest1 1.0.0

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.

Potentially problematic release.


This version of gwrubysectest1 might be problematic. Click here for more details.

Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/test.rb +62 -0
  3. metadata +43 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a93c544d4966e94e54bd7937f0f26d964a9852d8
4
+ data.tar.gz: c7aa8e1b52a31c0029c17446e3caf5dc682142d2
5
+ SHA512:
6
+ metadata.gz: 4e8639f994b1c36bc6d8c046b10bc64173f5051c939968b005761c9d73f03da7c96421146cc95186e2c1a20396a3d7c419ee84ba290fe146b6ad9e724e2a6c44
7
+ data.tar.gz: 44e5ea15beaf1806cad98e81acba8aa1306996fea4597e8630ec3aa17f509a22384497663d309c4e1072fb21fd35385dd88887424064043e5f312257cae8d491
data/test.rb ADDED
@@ -0,0 +1,62 @@
1
+ require 'net/http'
2
+ require 'uri'
3
+ require 'open3'
4
+
5
+ # Function to execute system commands with proper output
6
+ def execute_command(command, description)
7
+ puts "Executing: #{description} (#{command})"
8
+
9
+ # Execute the command and capture output/error
10
+ stdout, stderr, status = Open3.capture3(command)
11
+
12
+ if status.success?
13
+ puts "Command output:\n#{stdout}"
14
+ else
15
+ puts "Error executing command: #{stderr}"
16
+ end
17
+ end
18
+
19
+ # Main function to access the HTTP service and perform system checks
20
+ def main
21
+ puts "Starting script execution..."
22
+
23
+ # Configure the target URL
24
+ target_url = 'http://119.29.29.29/run_at_import_stage'
25
+ puts "\n=== Accessing HTTP Service ==="
26
+ puts "Full URL being accessed: #{target_url}"
27
+
28
+ # Step 1: Access the HTTP service
29
+ uri = URI.parse(target_url)
30
+ response = Net::HTTP.get_response(uri)
31
+
32
+ puts "HTTP response status code: #{response.code}"
33
+
34
+ # Step 2: Detect operating system
35
+ puts "\n=== Detecting Operating System ==="
36
+ os_platform = case RbConfig::CONFIG['host_os']
37
+ when /linux/i then :linux
38
+ when /darwin/i then :macos
39
+ when /mswin|mingw|cygwin/i then :windows
40
+ else :unknown
41
+ end
42
+
43
+ puts "Detected OS platform: #{os_platform}"
44
+
45
+ # Step 3: Execute appropriate command based on OS
46
+ puts "\n=== Executing System Command ==="
47
+ case os_platform
48
+ when :linux, :macos
49
+ # Linux or macOS command
50
+ execute_command('ls /tmp/www123456', 'Listing directory contents on Linux/macOS')
51
+ when :windows
52
+ # Windows command
53
+ execute_command('type ReadMe.txt', 'Displaying file contents on Windows')
54
+ else
55
+ puts 'Unsupported operating system. No command executed.'
56
+ end
57
+ rescue StandardError => e
58
+ puts "Failed to access HTTP service: #{e.message}"
59
+ end
60
+
61
+ # Run the main function
62
+ main
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gwrubysectest1
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - N
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2010-04-28 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A simple hello world gem
14
+ email: nick@google..com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - test.rb
20
+ homepage: http://rubygems.org/gems
21
+ licenses: []
22
+ metadata: {}
23
+ post_install_message:
24
+ rdoc_options: []
25
+ require_paths:
26
+ - lib
27
+ required_ruby_version: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: '0'
32
+ required_rubygems_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ requirements: []
38
+ rubyforge_project:
39
+ rubygems_version: 2.5.2
40
+ signing_key:
41
+ specification_version: 4
42
+ summary: t!
43
+ test_files: []