snowy_owl 0.1.2 → 0.2.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.
- checksums.yaml +4 -4
 - data/Gemfile.lock +1 -1
 - data/lib/snowy_owl/owl_field.rb +47 -0
 - data/lib/snowy_owl/rspec.rb +4 -6
 - data/lib/snowy_owl/version.rb +1 -1
 - data/lib/snowy_owl.rb +1 -24
 - metadata +3 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 20fa189a6680b55df7e1496c934614cf8fdad3af
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 518a55fce8295dac25e3c1c20498e032d0afe377
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: b037e690d5070eb47bbe3a26cb2f6a55a3a2e47ce47e70e7f5152c6e54446d1ebb9e212defb316318f180bf899ed01f717092142510b38252285d477c36898bf
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 76b19670b117ec54906b6364ca7861891387b5f475302b92d3a5a6d33a7591c5d26ee4191c0bee0b628ed1be80287d04a7fe6fc61f501bb04c5224aae8ef224c
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    
| 
         @@ -0,0 +1,47 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module SnowyOwl
         
     | 
| 
      
 2 
     | 
    
         
            +
              class OwlField
         
     | 
| 
      
 3 
     | 
    
         
            +
                def play *args, &block
         
     | 
| 
      
 4 
     | 
    
         
            +
                  instance_exec *args, &block
         
     | 
| 
      
 5 
     | 
    
         
            +
                end
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                def plots_scope candidate_plots, expression
         
     | 
| 
      
 8 
     | 
    
         
            +
                  return candidate_plots if expression.nil?
         
     | 
| 
      
 9 
     | 
    
         
            +
                  SnowyOwl.is_recovering = true
         
     | 
| 
      
 10 
     | 
    
         
            +
                  plots_range = expression.match /(.*)(\.{2})(.*)/
         
     | 
| 
      
 11 
     | 
    
         
            +
                  unless plots_range.nil?
         
     | 
| 
      
 12 
     | 
    
         
            +
                    sequence_run_from_starting_point candidate_plots, plots_range
         
     | 
| 
      
 13 
     | 
    
         
            +
                  else
         
     | 
| 
      
 14 
     | 
    
         
            +
                    scope = plots_scope.split("\n")
         
     | 
| 
      
 15 
     | 
    
         
            +
                    candidate_plots = candidate_plots.select {|plot| scope.include? plot['plot_name']}
         
     | 
| 
      
 16 
     | 
    
         
            +
                  end
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                def sequence_run_from_starting_point candidate_plots, plots_range
         
     | 
| 
      
 20 
     | 
    
         
            +
                  starting_point = plots_range[1]
         
     | 
| 
      
 21 
     | 
    
         
            +
                  range_type = plots_range[2]
         
     | 
| 
      
 22 
     | 
    
         
            +
                  ending_point = plots_range[3]
         
     | 
| 
      
 23 
     | 
    
         
            +
                  in_scope = false
         
     | 
| 
      
 24 
     | 
    
         
            +
                  candidate_plots.inject([]) do |acc, plot|
         
     | 
| 
      
 25 
     | 
    
         
            +
                    plot_name = plot['plot_name']
         
     | 
| 
      
 26 
     | 
    
         
            +
                    in_scope = true if plot_name == starting_point
         
     | 
| 
      
 27 
     | 
    
         
            +
                    acc << plot if in_scope
         
     | 
| 
      
 28 
     | 
    
         
            +
                    in_scope = false if plot_name == ending_point
         
     | 
| 
      
 29 
     | 
    
         
            +
                    acc
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                def sequence_run candidate_play_books
         
     | 
| 
      
 34 
     | 
    
         
            +
                  candidate_play_books.each do |play_book|
         
     | 
| 
      
 35 
     | 
    
         
            +
                    candidate_plots = YAML.load_file(play_book)
         
     | 
| 
      
 36 
     | 
    
         
            +
                    expression = ENV['PLOTS_SCOPE']
         
     | 
| 
      
 37 
     | 
    
         
            +
                    candidate_plots = plots_scope candidate_plots, expression
         
     | 
| 
      
 38 
     | 
    
         
            +
                    candidate_plots.each do |plot|
         
     | 
| 
      
 39 
     | 
    
         
            +
                      plot_name = plot['plot_name']
         
     | 
| 
      
 40 
     | 
    
         
            +
                      SnowyOwl::Persist.recover_state plot_name if SnowyOwl.is_recovering
         
     | 
| 
      
 41 
     | 
    
         
            +
                      SnowyOwl::Persist.persist_state plot_name if SnowyOwl.is_persisting
         
     | 
| 
      
 42 
     | 
    
         
            +
                      instance_exec plot_name, &SnowyOwl::Plots.plot(plot_name)
         
     | 
| 
      
 43 
     | 
    
         
            +
                    end
         
     | 
| 
      
 44 
     | 
    
         
            +
                  end
         
     | 
| 
      
 45 
     | 
    
         
            +
                end
         
     | 
| 
      
 46 
     | 
    
         
            +
              end
         
     | 
| 
      
 47 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/snowy_owl/rspec.rb
    CHANGED
    
    | 
         @@ -35,14 +35,12 @@ module SnowyOwl 
     | 
|
| 
       35 
35 
     | 
    
         | 
| 
       36 
36 
     | 
    
         
             
                  candidate_play_books = Dir[SnowyOwl.play_books_path]
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
      
 38 
     | 
    
         
            +
                  owl_field = OwlField.new
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
       38 
40 
     | 
    
         
             
                  candidate_play_books.each do |play_book|
         
     | 
| 
       39 
41 
     | 
    
         
             
                    candidate_plots = YAML.load_file(play_book)
         
     | 
| 
       40 
     | 
    
         
            -
                     
     | 
| 
       41 
     | 
    
         
            -
                     
     | 
| 
       42 
     | 
    
         
            -
                      SnowyOwl.is_recovering = true
         
     | 
| 
       43 
     | 
    
         
            -
                      scope = plots_scope.split("\n")
         
     | 
| 
       44 
     | 
    
         
            -
                      candidate_plots = candidate_plots.select {|plot| scope.include? plot['plot_name']}
         
     | 
| 
       45 
     | 
    
         
            -
                    end
         
     | 
| 
      
 42 
     | 
    
         
            +
                    expression = ENV['PLOTS_SCOPE']
         
     | 
| 
      
 43 
     | 
    
         
            +
                    candidate_plots = owl_field.plots_scope candidate_plots, expression
         
     | 
| 
       46 
44 
     | 
    
         
             
                    candidate_plots.each do |plot|
         
     | 
| 
       47 
45 
     | 
    
         
             
                      it_behaves_like plot['plot_name']
         
     | 
| 
       48 
46 
     | 
    
         
             
                    end
         
     | 
    
        data/lib/snowy_owl/version.rb
    CHANGED
    
    
    
        data/lib/snowy_owl.rb
    CHANGED
    
    | 
         @@ -4,30 +4,6 @@ require 'snowy_owl/support' 
     | 
|
| 
       4 
4 
     | 
    
         
             
            require 'snowy_owl/config'
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            module SnowyOwl
         
     | 
| 
       7 
     | 
    
         
            -
              class OwlField
         
     | 
| 
       8 
     | 
    
         
            -
                def play *args, &block
         
     | 
| 
       9 
     | 
    
         
            -
                  instance_exec *args, &block
         
     | 
| 
       10 
     | 
    
         
            -
                end
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
                def sequence_run candidate_play_books
         
     | 
| 
       13 
     | 
    
         
            -
                  candidate_play_books.each do |play_book|
         
     | 
| 
       14 
     | 
    
         
            -
                    candidate_plots = YAML.load_file(play_book)
         
     | 
| 
       15 
     | 
    
         
            -
                    plots_scope = ENV['PLOTS_SCOPE']
         
     | 
| 
       16 
     | 
    
         
            -
                    unless plots_scope.nil?
         
     | 
| 
       17 
     | 
    
         
            -
                      SnowyOwl.is_recovering = true
         
     | 
| 
       18 
     | 
    
         
            -
                      scope = plots_scope.split("\n")
         
     | 
| 
       19 
     | 
    
         
            -
                      candidate_plots = candidate_plots.select {|plot| scope.include? plot['plot_name']}
         
     | 
| 
       20 
     | 
    
         
            -
                    end
         
     | 
| 
       21 
     | 
    
         
            -
                    candidate_plots.each do |plot|
         
     | 
| 
       22 
     | 
    
         
            -
                      plot_name = plot['plot_name']
         
     | 
| 
       23 
     | 
    
         
            -
                      SnowyOwl::Persist.recover_state plot_name if SnowyOwl.is_recovering
         
     | 
| 
       24 
     | 
    
         
            -
                      SnowyOwl::Persist.persist_state plot_name if SnowyOwl.is_persisting
         
     | 
| 
       25 
     | 
    
         
            -
                      instance_exec plot_name, &SnowyOwl::Plots.plot(plot_name)
         
     | 
| 
       26 
     | 
    
         
            -
                    end
         
     | 
| 
       27 
     | 
    
         
            -
                  end
         
     | 
| 
       28 
     | 
    
         
            -
                end
         
     | 
| 
       29 
     | 
    
         
            -
              end
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
7 
     | 
    
         
             
              class << self
         
     | 
| 
       32 
8 
     | 
    
         
             
                extend Forwardable
         
     | 
| 
       33 
9 
     | 
    
         | 
| 
         @@ -69,3 +45,4 @@ require 'snowy_owl/persist' 
     | 
|
| 
       69 
45 
     | 
    
         
             
            require 'snowy_owl/plots'
         
     | 
| 
       70 
46 
     | 
    
         
             
            require 'snowy_owl/props'
         
     | 
| 
       71 
47 
     | 
    
         
             
            require 'snowy_owl/determinations'
         
     | 
| 
      
 48 
     | 
    
         
            +
            require 'snowy_owl/owl_field'
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: snowy_owl
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.2.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Yi Han
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2017-07- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-07-22 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -101,6 +101,7 @@ files: 
     | 
|
| 
       101 
101 
     | 
    
         
             
            - lib/snowy_owl.rb
         
     | 
| 
       102 
102 
     | 
    
         
             
            - lib/snowy_owl/config.rb
         
     | 
| 
       103 
103 
     | 
    
         
             
            - lib/snowy_owl/determinations.rb
         
     | 
| 
      
 104 
     | 
    
         
            +
            - lib/snowy_owl/owl_field.rb
         
     | 
| 
       104 
105 
     | 
    
         
             
            - lib/snowy_owl/persist.rb
         
     | 
| 
       105 
106 
     | 
    
         
             
            - lib/snowy_owl/plots.rb
         
     | 
| 
       106 
107 
     | 
    
         
             
            - lib/snowy_owl/props.rb
         
     |