crabfarm 0.7.4 → 0.7.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e99bdbdcdc84bfc65410c5230050dbb27bef9b10
4
- data.tar.gz: 3be489d2f27a2fa1dd701fc8e56bfef6df2aa093
3
+ metadata.gz: decb87d9ee1082ce675625f82fdb1dce0dd20d5c
4
+ data.tar.gz: ac81524ae0eb2fb78e3a7a5396523762a10d70c1
5
5
  SHA512:
6
- metadata.gz: f02b42dc55ede5aabfa3ced6047072ce3b75bd7e612bb75ca5cbe82bc6c7a981c26387ec648830eb4c061bf764e0dcf8dfbc289d584db25f08d6d771551d0449
7
- data.tar.gz: 03ac85efb8ca6caab57fda20b0f29b47118266c2a6a712bfe6b08ccaf5912af68c9b7ad55a37f3b344322dc8debcfe22aa7bf488f0ae12db8c2ae81da3edfc02
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
@@ -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
- ActiveSupport::Dependencies.mechanism = :require unless options[:reload]
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
@@ -1,20 +1,20 @@
1
1
  module Crabfarm
2
- class StateStore
2
+ class StateStore < Hash
3
3
 
4
4
  def initialize
5
- reset
5
+ super
6
6
  end
7
7
 
8
- def fetch(key, &block)
9
- @data.fetch(key.to_sym, &block)
8
+ def set(_key, _value=true)
9
+ self[_key] = _value
10
10
  end
11
11
 
12
- def set(key, value)
13
- @data[key.to_sym] = value
12
+ def is?(_key)
13
+ !!fetch(_key, false)
14
14
  end
15
15
 
16
16
  def reset
17
- @data = Hash.new
17
+ clear
18
18
  end
19
19
 
20
20
  end
@@ -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')
@@ -1,3 +1,3 @@
1
1
  module Crabfarm
2
- VERSION = "0.7.4"
2
+ VERSION = "0.7.5"
3
3
  end
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
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-10-30 00:00:00.000000000 Z
11
+ date: 2015-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport