crabfarm 0.7.4 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/crabfarm/base_navigator.rb +4 -3
- data/lib/crabfarm/cli.rb +8 -1
- data/lib/crabfarm/engines/async_state_manager.rb +1 -1
- data/lib/crabfarm/state_store.rb +7 -7
- data/lib/crabfarm/support/gli.rb +9 -0
- data/lib/crabfarm/templates/boot.rb.erb +0 -4
- data/lib/crabfarm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: decb87d9ee1082ce675625f82fdb1dce0dd20d5c
|
4
|
+
data.tar.gz: ac81524ae0eb2fb78e3a7a5396523762a10d70c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5b6e947935dae0b5d45a671bbc81cfd56382bd478155e7ca7c5b9a7fd7499b08c801207167984ec749586dadedd5324f7b4e27c2e8965263ab2e6159450a73d
|
7
|
+
data.tar.gz: fd65c4389e29b14daeeff2f1014da06eca70cce791e92660127bbbd07332b12b5d3a6defffae3480c40a539f6b91f157aa021a6bfd777921045655a7774435a5
|
@@ -9,17 +9,18 @@ module Crabfarm
|
|
9
9
|
include Base
|
10
10
|
include Assertion::Context
|
11
11
|
include Live::Interactable
|
12
|
-
extend Forwardable
|
13
12
|
|
14
13
|
attr_reader :params
|
15
14
|
|
16
|
-
def_delegators '@context.store', :get, :fetch
|
17
|
-
|
18
15
|
def initialize(_context, _params)
|
19
16
|
@context = _context
|
20
17
|
@params = _params
|
21
18
|
end
|
22
19
|
|
20
|
+
def session
|
21
|
+
@context.store
|
22
|
+
end
|
23
|
+
|
23
24
|
def navigate(_name, _params={})
|
24
25
|
TransitionService.transition(@context, _name, params.merge(_params))
|
25
26
|
end
|
data/lib/crabfarm/cli.rb
CHANGED
@@ -18,6 +18,7 @@ module Crabfarm
|
|
18
18
|
c.action do |global_options,options,args|
|
19
19
|
next puts "This command can only be ran inside a crabfarm application" unless Crabfarm.inside_crawler_app?
|
20
20
|
|
21
|
+
Support::GLI.setup_autoload
|
21
22
|
Crabfarm.config.set Support::GLI.parse_options options
|
22
23
|
|
23
24
|
Crabfarm.with_context options[:memento] do |context|
|
@@ -32,6 +33,8 @@ module Crabfarm
|
|
32
33
|
c.action do |global_options,options,args|
|
33
34
|
next puts "This command can only be ran inside a crabfarm application" unless Crabfarm.inside_crawler_app?
|
34
35
|
|
36
|
+
Support::GLI.setup_autoload
|
37
|
+
|
35
38
|
require "crabfarm/modes/live"
|
36
39
|
Crabfarm::Modes::Live.start_watch
|
37
40
|
end
|
@@ -64,7 +67,11 @@ module Crabfarm
|
|
64
67
|
|
65
68
|
Crabfarm.config.set Support::GLI.parse_options options
|
66
69
|
|
67
|
-
|
70
|
+
if options[:reload]
|
71
|
+
Support::GLI.setup_autoload
|
72
|
+
else
|
73
|
+
Support::GLI.require_all
|
74
|
+
end
|
68
75
|
|
69
76
|
server_options = {}
|
70
77
|
server_options[:Host] = options[:host] unless options[:host].nil?
|
@@ -105,7 +105,7 @@ module Crabfarm
|
|
105
105
|
if @working
|
106
106
|
begin
|
107
107
|
logger.info "Transitioning state: #{@next_state_name}"
|
108
|
-
ActiveSupport::Dependencies.clear
|
108
|
+
ActiveSupport::Dependencies.clear if defined? ActiveSupport::Dependencies
|
109
109
|
ts = TransitionService.transition(@context, @next_state_name, @next_state_params)
|
110
110
|
@elapsed = ts.elapsed
|
111
111
|
@doc = ts.document
|
data/lib/crabfarm/state_store.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
module Crabfarm
|
2
|
-
class StateStore
|
2
|
+
class StateStore < Hash
|
3
3
|
|
4
4
|
def initialize
|
5
|
-
|
5
|
+
super
|
6
6
|
end
|
7
7
|
|
8
|
-
def
|
9
|
-
|
8
|
+
def set(_key, _value=true)
|
9
|
+
self[_key] = _value
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
13
|
-
|
12
|
+
def is?(_key)
|
13
|
+
!!fetch(_key, false)
|
14
14
|
end
|
15
15
|
|
16
16
|
def reset
|
17
|
-
|
17
|
+
clear
|
18
18
|
end
|
19
19
|
|
20
20
|
end
|
data/lib/crabfarm/support/gli.rb
CHANGED
@@ -10,6 +10,15 @@ module Crabfarm
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
+
def self.setup_autoload
|
14
|
+
require 'active_support/dependencies'
|
15
|
+
ActiveSupport::Dependencies.autoload_paths += Dir.glob File.join(CF_PATH, 'app', '**')
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.require_all
|
19
|
+
Dir.glob(File.join(CF_PATH, 'app', '**/*.rb')).each { |p| require p }
|
20
|
+
end
|
21
|
+
|
13
22
|
def self.parse_options(_options)
|
14
23
|
config_overrides = {}
|
15
24
|
Configuration::OPTIONS.each do |opt|
|
@@ -7,10 +7,6 @@ Bundler.setup
|
|
7
7
|
|
8
8
|
CF_PATH = File.expand_path('../', __FILE__)
|
9
9
|
|
10
|
-
# Setup code autoloading
|
11
|
-
require 'active_support/dependencies'
|
12
|
-
ActiveSupport::Dependencies.autoload_paths += Dir.glob File.join(CF_PATH, 'app', '**')
|
13
|
-
|
14
10
|
# Load crabfarm framework and configuration
|
15
11
|
require 'crabfarm'
|
16
12
|
Crabfarm.read_crabfile File.join(CF_PATH, 'Crabfile')
|
data/lib/crabfarm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crabfarm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ignacio Baixas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|