rubyment 0.6.25540736 → 0.6.25540755

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rubyment.rb +162 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c3bd78fbf756579a1acaf4d66c0b0304b19ccd9
4
- data.tar.gz: f552296199c8c07387418f165ec96cde9c9cebd4
3
+ metadata.gz: 4d7e5232afb80166f144c6deef8349087ad0b8a8
4
+ data.tar.gz: b852c8e48c92af06cd196056402d6e8f49d0be7c
5
5
  SHA512:
6
- metadata.gz: b3f62542a4c676f4092a896a722aff4ed87cdfa20c7c382c57abc649179f5e15dd3b839626fe67fb36dcab88a0f6ee3609a886d59208a0115ddb2181d38b0f93
7
- data.tar.gz: d7301f117c410b34304ae6da16cf2edd1b6d133940c51116efd2749de629f6783f092a249d14d582fbf7045f53beb5b8f986b7480d199ef6fbf7fa5e01db1006
6
+ metadata.gz: aa724cbb4a1060920877986d62023e5ad8eb8c47f98b537d7374b6a0d36631aa5c333f32f0ed9a9b8e5869219b0a2af95433e69eacc5264aac683f1bc1f60baf
7
+ data.tar.gz: 78d104d0846530046d4bfb6ef4e455bcb7fd28961c7425e536728fa656e0c07fa308a02c22f01a83606039ba0841fad76188d8d3ec9eeaf7d639a078cd989c4b
data/lib/rubyment.rb CHANGED
@@ -2065,7 +2065,8 @@ require '#{gem_name}'
2065
2065
  gem_is_current_file && (
2066
2066
  FileUtils.mkdir_p 'lib'
2067
2067
  file_backup "lib/#{gem_name}.rb", "lib/"
2068
- # FIX ME: accept true
2068
+ # quick hack for backwards compatibility
2069
+ gem_is_current_file = gem_is_current_file.kind_of?(TrueClass) && __FILE__ || gem_is_current_file
2069
2070
  save_file gem_is_current_file, "lib/#{gem_name}.rb"
2070
2071
  )
2071
2072
 
@@ -2120,6 +2121,19 @@ require '#{gem_name}'
2120
2121
  `#{command}`
2121
2122
  end
2122
2123
 
2124
+ # gem_install_force_from_remote
2125
+ def gem_install_remote args=[]
2126
+ stderr = @memory[:stderr]
2127
+ system_user_is_super = @memory[:system_user_is_super]
2128
+ gem_spec, user_install, quiet = args
2129
+ quiet = quiet.nne
2130
+ debug = quiet.negate_me
2131
+ user_install ||= (!system_user_is_super) && "--user-install" || ""
2132
+ command="gem install -r #{user_install} #{gem_spec}"
2133
+ debug && (stderr.puts "command=#{command}")
2134
+ `#{command}`
2135
+ end
2136
+
2123
2137
  # gem_push
2124
2138
  # args:
2125
2139
  # [gem_spec (String)]
@@ -2166,6 +2180,8 @@ require '#{gem_name}'
2166
2180
  command="gem uninstall #{all} -x #{user_install} #{gem_spec}"
2167
2181
  debug && (stderr.puts "command=#{command}")
2168
2182
  `#{command}`
2183
+ #stdin, stdout, stderr, wait_thr = Open3.popen3(":;" + command)
2184
+ #stdout
2169
2185
  end
2170
2186
 
2171
2187
  # gem_list
@@ -2615,6 +2631,65 @@ require '#{gem_name}'
2615
2631
  end
2616
2632
 
2617
2633
 
2634
+ =begin
2635
+ # documentation_begin
2636
+ # short_desc = "tests the function #test__http_response__redirect"
2637
+ @memory[:documentation].push = {
2638
+ :function => :test__http_response__redirect,
2639
+ :short_desc => short_desc,
2640
+ :description => "",
2641
+ :params => [
2642
+ {
2643
+ :name => :args,
2644
+ :description => "list of parameters",
2645
+ :duck_type => Array,
2646
+ :default_behavior => "interpreted as empty array",
2647
+ :params => [
2648
+ {
2649
+ :name => :reserved,
2650
+ :duck_type => Object,
2651
+ :default_behavior => "interpreted as nil",
2652
+ :description => "for future use",
2653
+ },
2654
+ ],
2655
+ },
2656
+ ],
2657
+ }
2658
+ # documentation_end
2659
+ =end
2660
+ def test__http_response__redirect args = []
2661
+ location,
2662
+ code,
2663
+ version,
2664
+ debug,
2665
+ eol,
2666
+ reserved = args
2667
+ stderr = @memory[:stderr]
2668
+ debug = debug.nne
2669
+ debug.nne && (stderr.puts "#{__method__} starting")
2670
+ debug.nne && (stderr.puts args.inspect)
2671
+ payload ||= ""
2672
+ payload = nil
2673
+ content_type = nil
2674
+ version ||= "1.1"
2675
+ code ||= "302 Found"
2676
+ eol ||= "\r\n"
2677
+ rv = http_response_base [
2678
+ :payload.to_nil,
2679
+ :content_type.to_nil,
2680
+ code,
2681
+ version,
2682
+ :keep_alive.to_nil,
2683
+ debug,
2684
+ eol,
2685
+ location,
2686
+ ]
2687
+ debug.nne && (stderr.puts "#{__method__} returning")
2688
+ rv
2689
+ end
2690
+
2691
+
2692
+
2618
2693
  # returns an HTTP response (1.1 200 OK by default)
2619
2694
  # @param [Array] +args+, an +Array+ whose elements are expected to be:
2620
2695
  # +response+:: [String, nil] response payload (default empty)
@@ -3550,6 +3625,92 @@ n8mFEtUKobsK
3550
3625
  end
3551
3626
 
3552
3627
 
3628
+ # tests test__tcp_ssl_server__io_method, creating two
3629
+ # servers, one ssl and another plain, redirecting to
3630
+ # the ssl one. then, opens a client thread with a client
3631
+ # connecting to the root document of the plain server
3632
+ # (and in the end being served by the root document of
3633
+ # the ssl server).
3634
+ # another thread for the client
3635
+ def test__tcp_ssl_server__get_root__plain_redirect args = ARGV
3636
+ stderr = @memory[:stderr]
3637
+ tcp_ssl_server_method,
3638
+ http_processing_method,
3639
+ http_processing_method_args,
3640
+ http_server_port,
3641
+ http_ip_addr,
3642
+ priv_pemfile,
3643
+ cert_pem_file,
3644
+ extra_cert_pem_files,
3645
+ ssl_cert_pkey_chain_method,
3646
+ debug_tcp_ssl_server_method,
3647
+ happy_with_request,
3648
+ io_method,
3649
+ io_method_debug,
3650
+ domain,
3651
+ admit_non_ssl,
3652
+ no_debug_client,
3653
+ reserved = args
3654
+ tcp_ssl_server_method = tcp_ssl_server_method.nne :test__tcp_ssl_server__io_method
3655
+ domain = domain.nne "localhost"
3656
+ http_server_port = http_server_port.nne 8003
3657
+ no_debug_client = no_debug_client.nne
3658
+ ssl_server_thread = send tcp_ssl_server_method,
3659
+ [
3660
+ http_processing_method,
3661
+ http_processing_method_args,
3662
+ http_server_port,
3663
+ http_ip_addr,
3664
+ priv_pemfile,
3665
+ cert_pem_file,
3666
+ extra_cert_pem_files,
3667
+ ssl_cert_pkey_chain_method,
3668
+ debug_tcp_ssl_server_method,
3669
+ happy_with_request,
3670
+ io_method,
3671
+ io_method_debug,
3672
+ admit_non_ssl,
3673
+ ]
3674
+
3675
+ plain_http_processing_method ||= plain_http_processing_method.nne
3676
+ plain_http_processing_method_args ||= plain_http_processing_method_args.nne
3677
+ plain_http_server_port ||= plain_http_server_port.nne
3678
+ plain_http_ip_addr ||= plain_http_ip_addr.nne
3679
+
3680
+ plain_server_thread = send tcp_ssl_server_method,
3681
+ [
3682
+ plain_http_processing_method,
3683
+ plain_http_processing_method_args,
3684
+ plain_http_server_port,
3685
+ plain_http_ip_addr,
3686
+ :priv_pemfile.to_nil,
3687
+ :cert_pem_file.to_nil,
3688
+ :extra_cert_pem_files.to_nil,
3689
+ :ssl_cert_pkey_chain_method.to_nil,
3690
+ :debug_tcp_ssl_server_method.to_nil,
3691
+ happy_with_request,
3692
+ plain_io_method,
3693
+ plain_io_method_debug,
3694
+ :admit_non_ssl,
3695
+ ]
3696
+
3697
+ thread_2 = Thread.new {
3698
+ loop {
3699
+ response = test__file_read__uri_root [
3700
+ domain,
3701
+ http_server_port,
3702
+ admit_non_ssl,
3703
+ no_debug_client.negate_me,
3704
+ ]
3705
+ sleep 2
3706
+ }
3707
+ }
3708
+ server_thread.first.join
3709
+
3710
+ true
3711
+ end
3712
+
3713
+
3553
3714
  # tests test__tcp_ssl_server__io_method and opens
3554
3715
  # another thread for the client
3555
3716
  def test__tcp_ssl_server__get_root args = ARGV
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyment
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.25540736
4
+ version: 0.6.25540755
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribamar Santarosa