snowy_owl 0.3.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a2cda9d116073fa7f2a3077f04b15601f8e1de8
4
- data.tar.gz: 2f7c8fd431635eab7f2a814b3cf2a60859067005
3
+ metadata.gz: 71d6cff44bdadfc1ea858206eba483efec48c9e6
4
+ data.tar.gz: 304217feb2b8cae915c93d6f5ce14a3d239720d7
5
5
  SHA512:
6
- metadata.gz: 72893bc9063fdd463e0927f6952aa13caaefeb368c6c7d27f9f4b735653c53fc0cce16cf8b98eb9d92e9a8ff4f490de67070b33fd638af28188e718ac2bcdb19
7
- data.tar.gz: d2174104a82ef6cd780cd9b69e2053b7a17672c7ca18c1869322ad762b288c94478e61f08b1b363a2720bb1071a8438ebd73bc2ab9e80e271ba54ef3ed5aad21
6
+ metadata.gz: 6b7c610de9073b5e29096c93da35d94e90c9e3a4c25f903c16175601052683ca7779d4ee0d76f66bc642e06e9586571831e2c3f540b67aa745d3bb654c728486
7
+ data.tar.gz: 30ac7a23c7de9256763bce2003cdba4bacf29f80935fa5c7254dc12a047bf14fdb5cb57b4d70cabf653f8ad44eb40766c86ddbab4268232fbd30567673cba50e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snowy_owl (0.3.0)
4
+ snowy_owl (0.4.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/Rakefile CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'bundler/gem_tasks'
2
2
  require 'rspec/core/rake_task'
3
+ require 'snowy_owl/tasks'
3
4
 
4
5
  RSpec::Core::RakeTask.new(:spec)
5
6
 
@@ -22,13 +22,16 @@ module SnowyOwl
22
22
  def build_plays(candidate_play_books)
23
23
  @play_hash = {}
24
24
  @starting_node = nil
25
- candidate_play_books.each do |play_book|
26
- candidate_plots = YAML.load_file(play_book)
27
- generate_full_path_digest(candidate_plots)
28
- end
25
+ candidate_play_books.each { |play_book| generate_digest_for_play_book play_book }
29
26
  generate_deep_first_plays
30
27
  end
31
28
 
29
+ def generate_digest_for_play_book play_book
30
+ @play_hash ||= {}
31
+ candidate_plots = YAML.load_file(play_book)
32
+ generate_full_path_digest(candidate_plots)
33
+ end
34
+
32
35
  def generate_deep_first_plays
33
36
  plays = []
34
37
  deep_stack = [@starting_node.digest]
@@ -0,0 +1,20 @@
1
+ require 'rake'
2
+ require_relative '../snowy_owl'
3
+
4
+ namespace :snowy_owl do
5
+ desc 'generate digest for entire play books'
6
+ task :generate_digest, [:play_book] do |task, args|
7
+ play_book = args[:play_book]
8
+ candidate_plots = SnowyOwl::Plays.generate_digest_for_play_book play_book
9
+ output_result = candidate_plots.map do |plot|
10
+ res = { 'plot_name' => plot['plot_name'],
11
+ 'digest' => plot['digest'],
12
+ }
13
+ res['parent'] = plot['parent'] if !plot['parent'].nil? && !plot['parent'].empty?
14
+ res
15
+ end
16
+ File.open(play_book, 'w+') do |file|
17
+ file.write output_result.to_yaml
18
+ end
19
+ end
20
+ end
@@ -1,3 +1,3 @@
1
1
  module SnowyOwl
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.4.0'.freeze
3
3
  end
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.3.0
4
+ version: 0.4.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-08-18 00:00:00.000000000 Z
11
+ date: 2017-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -111,6 +111,7 @@ files:
111
111
  - lib/snowy_owl/rspec.rb
112
112
  - lib/snowy_owl/rspec/rerun.rb
113
113
  - lib/snowy_owl/support.rb
114
+ - lib/snowy_owl/tasks.rb
114
115
  - lib/snowy_owl/version.rb
115
116
  - snowy_owl.gemspec
116
117
  homepage: https://github.com/hanystudy/snowy_owl