rhack 1.2.0 → 1.2.1

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
  SHA1:
3
- metadata.gz: f28c3cb05c65018360d52ba98547da0bff2c3a66
4
- data.tar.gz: 431e6835d84fecbaf1f6c236a7862da94dd02db7
3
+ metadata.gz: c009239c6fbd460ac03d66f1d5c9120625bd444e
4
+ data.tar.gz: 20a9a3b468d1cb046a5cc8f570e8e5bb4fe3538d
5
5
  SHA512:
6
- metadata.gz: dfdd4a627e508816fb3df12b3fcbb088dddbd947e469bae035ca6a9a28370a0f5e37f8e13d164e7ec4dc8d70ed79283cfe9d0a682377b9e2d27a06ec7f15e67e
7
- data.tar.gz: 6af36ff47a3acfdd9cc47ee979dcfbd4c8b1d4a5a993070198a6b6754db83dd2f50eaacb11d90f12cbdd1599b8e59971de56eb4ad562dc96a367b122e2c56438
6
+ metadata.gz: 765f9ad74e11d35c647498eb7e42e6a4a8ba8f15d0a11a1be8e2611b0fb26213b9f8265172c126b4dbeb69c9e26a194b84283f585e6faea1e49c23144164027a
7
+ data.tar.gz: 08b87a49dde4b46bf372545a348f2f4dfa0d282c55e5c4a1589d9d4ff9a9105315193c1d5926558be1f33522536c0a37b11b74acf8eed3c3a02e252a4ae3922f
@@ -1,4 +1,4 @@
1
- # By default, Scout uses randomly chosen ua (string from specified fiel)
1
+ # By default, Scout uses randomly chosen ua (string from specified file)
2
2
  # for User-Agent header
3
3
  useragents:
4
4
  desktop: config/uas.txt
@@ -23,19 +23,19 @@ scout:
23
23
  # Defaults to a file @ RAILS_PATH/config/RAILS_ENV.yml
24
24
  # Rhack is intended to use a database only for caching,
25
25
  # so I've came to a conclusion that Redis is the most suitable choice
26
- # redis.conf can be generated using `rake redis:config`
27
- # Delete this block to disable Redis connection at all
28
- db:
29
- redis:
30
- configfilename: config/redis.conf
31
- socket: tmp/sockets/redis.socket
32
- pidfile: tmp/pids/redis.pid
33
- port: 0
34
- hostname: localhost
35
- dbfilename: db/redis-dump.rdb
36
- db: 0
37
- save:
38
- # "run BGSAVE every minute if anything have changed"
39
- - 60 1
40
- # You can change it to whatever you want and just use Redis#bgsave before exit Ruby
26
+ # redis.conf can be generated using `rake redis:config` from this gem dir
27
+ # Unomment this block to enable Redis connection
28
+ #db:
29
+ # redis:
30
+ # configfilename: config/redis.conf
31
+ # socket: tmp/sockets/redis.socket
32
+ # pidfile: tmp/pids/redis.pid
33
+ # port: 0
34
+ # hostname: localhost
35
+ # dbfilename: db/redis-dump.rdb
36
+ # db: 0
37
+ # save:
38
+ # # "run BGSAVE every minute if anything have changed"
39
+ # - 60 1
40
+ # # You can change it to whatever you want and just use Redis#bgsave before exit Ruby
41
41
 
@@ -0,0 +1,11 @@
1
+ module Rhack
2
+ module Generators
3
+ class ConfigGenerator < Rails::Generators::Base
4
+ source_root File.expand_path('../config', __FILE__)
5
+
6
+ def generate_config
7
+ copy_file "rhack.yml.template", "config/rhack.yml"
8
+ end
9
+ end
10
+ end
11
+ end
@@ -9,7 +9,14 @@ module RHACK
9
9
  attr_accessor :f
10
10
  alias_constant :URI
11
11
 
12
- def initialize(service, frame=nil, *args)
12
+ def self.inherited(child)
13
+ child.class_eval {
14
+ include RHACK
15
+ __init__
16
+ }
17
+ end
18
+
19
+ def initialize(service=:api, frame=nil, *args)
13
20
  @service = service
14
21
  # first argument should be a string so that frame won't be static
15
22
  @f = frame || Frame(URI(service) || URI(:login), *args)
@@ -40,6 +40,7 @@ module Curl
40
40
  # until main thread has sleep a bit, $CarierThread will have status "run",
41
41
  # no matter whether it's idling or performing requests
42
42
  sleep 0.001
43
+ true
43
44
  end
44
45
  end
45
46
  alias :run :execute
data/lib/rhack/scout.rb CHANGED
@@ -238,14 +238,16 @@ module RHACK
238
238
  # в сорцах on_failure не вызывается по коду 0, это какой-то глюк
239
239
  # в любом случае такой поворот не означает ошибки
240
240
  L.warn "Got Curl::Err::CurlOK, response was: #{c.res}"
241
+ load!
241
242
  else
242
- @http.on_complete &Proc::NULL
243
243
  c.outdate!
244
244
  if retry? e
245
245
  L.debug "#{e[0]} -> reloading scout"
246
246
  #load uri, headers, not_redir, relvl, &callback
247
247
  load! # all params including post_body are still set
248
+ # DO they include `on_complete'?
248
249
  else
250
+ @http.on_complete &Proc::NULL
249
251
  L.debug "#{e[0]} -> not reloading scout"
250
252
  raise *e if @raise_err
251
253
  end
data/lib/rhack/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RHACK
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.1'
3
3
  end
data/rhack.gemspec CHANGED
@@ -17,12 +17,12 @@ Gem::Specification.new do |spec|
17
17
  spec.require_paths = ["lib"]
18
18
 
19
19
  spec.add_runtime_dependency "activesupport"
20
- spec.add_runtime_dependency "redis"
21
- spec.add_runtime_dependency "rmtools", ">= 1.3.3"
20
+ #spec.add_runtime_dependency "redis"
21
+ spec.add_runtime_dependency "rmtools", ">= 2.3.0"
22
22
  spec.add_runtime_dependency "libxml-ruby"
23
23
 
24
24
  spec.extensions << 'ext/curb/extconf.rb'
25
25
 
26
- spec.add_development_dependency "bundler", "~> 1.3"
26
+ spec.add_development_dependency "bundler"
27
27
  spec.add_development_dependency "rake"
28
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rhack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Baev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-20 00:00:00.000000000 Z
11
+ date: 2014-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -24,34 +24,20 @@ dependencies:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: redis
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '>='
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '>='
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: rmtools
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - '>='
46
32
  - !ruby/object:Gem::Version
47
- version: 1.3.3
33
+ version: 2.3.0
48
34
  type: :runtime
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
38
  - - '>='
53
39
  - !ruby/object:Gem::Version
54
- version: 1.3.3
40
+ version: 2.3.0
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: libxml-ruby
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -70,16 +56,16 @@ dependencies:
70
56
  name: bundler
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
- - - ~>
59
+ - - '>='
74
60
  - !ruby/object:Gem::Version
75
- version: '1.3'
61
+ version: '0'
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
- - - ~>
66
+ - - '>='
81
67
  - !ruby/object:Gem::Version
82
- version: '1.3'
68
+ version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: rake
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -142,6 +128,7 @@ files:
142
128
  - ext/curb/curb_upload.c
143
129
  - ext/curb/curb_upload.h
144
130
  - ext/curb/extconf.rb
131
+ - lib/generators/rhack/config_generator.rb
145
132
  - lib/rhack.rb
146
133
  - lib/rhack/clients.rb
147
134
  - lib/rhack/clients/base.rb