bloomed 1.1.0 → 1.2.0

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
  SHA256:
3
- metadata.gz: 527059343640b966e5fb66bd63bbee69553efc8179e6dc5dbcf488461358c010
4
- data.tar.gz: 35e947c41fab4771cbf58654b806cd984c054ef59764f46f4a44a9440d1f5d49
3
+ metadata.gz: 2b6cf13b8871f070a3a13518f1ce0a9c39315376a189b6136ec4e7f608de39be
4
+ data.tar.gz: 5997ea5717019848ac0f7785006129eca6a9c9b2de85cedf481586d9d077dd2e
5
5
  SHA512:
6
- metadata.gz: e3aecc9a6492e27649e18d79dd3331df0f1bc93b8e375c5307474d4786056eac58684f5645407ba1c4826c87909029093603f7b37fdba229de216558af602782
7
- data.tar.gz: 2633bc230b66f0d8240dbe75e4a3d0519690db6919383b03b7881524c3f1a58fea25f4e1b03931df6f0d0f2061b7c43986b1d51c0bc823a84e67749282baacb6
6
+ metadata.gz: 33067998aa831dd6a4f1d4d7c1d7b87e52a07c986506c323b609f08f0461d63cf19e8aeb89823666f760a1ae7096627c0cfceb7c80a26fe8e39e9a9885474a0d
7
+ data.tar.gz: 0d20e86028da7c0899d3e75645f2eeaf374c4d73556c65650fd3262135d39eb7d43f73ca30e507af49f7d0218d97c4f6de4d473d801a997639507be0542b8e34
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bloomed (1.0.0)
4
+ bloomed (1.1.0)
5
5
  bloomer (~> 1.0)
6
6
  msgpack
7
7
 
@@ -54,7 +54,7 @@ GEM
54
54
  rspec-mocks (~> 3.8.0)
55
55
  rspec-core (3.8.0)
56
56
  rspec-support (~> 3.8.0)
57
- rspec-expectations (3.8.1)
57
+ rspec-expectations (3.8.2)
58
58
  diff-lcs (>= 1.2.0, < 2.0)
59
59
  rspec-support (~> 3.8.0)
60
60
  rspec-mocks (3.8.0)
@@ -80,4 +80,4 @@ DEPENDENCIES
80
80
  rspec_junit_formatter
81
81
 
82
82
  BUNDLED WITH
83
- 1.16.4
83
+ 1.16.5
@@ -0,0 +1,70 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %w(app lib config test spec features) \
6
+ # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
+
8
+ ## Note: if you are using the `directories` clause above and you are not
9
+ ## watching the project directory ('.'), then you will want to move
10
+ ## the Guardfile to a watched dir and symlink it back, e.g.
11
+ #
12
+ # $ mkdir config
13
+ # $ mv Guardfile config/
14
+ # $ ln -s config/Guardfile .
15
+ #
16
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
+
18
+ # Note: The cmd option is now required due to the increasing number of ways
19
+ # rspec may be run, below are examples of the most common uses.
20
+ # * bundler: 'bundle exec rspec'
21
+ # * bundler binstubs: 'bin/rspec'
22
+ # * spring: 'bin/rspec' (This will use spring if running and you have
23
+ # installed the spring binstubs per the docs)
24
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
25
+ # * 'just' rspec: 'rspec'
26
+
27
+ guard :rspec, cmd: "bundle exec rspec" do
28
+ require "guard/rspec/dsl"
29
+ dsl = Guard::RSpec::Dsl.new(self)
30
+
31
+ # Feel free to open issues for suggestions and improvements
32
+
33
+ # RSpec files
34
+ rspec = dsl.rspec
35
+ watch(rspec.spec_helper) { rspec.spec_dir }
36
+ watch(rspec.spec_support) { rspec.spec_dir }
37
+ watch(rspec.spec_files)
38
+
39
+ # Ruby files
40
+ ruby = dsl.ruby
41
+ dsl.watch_spec_files_for(ruby.lib_files)
42
+
43
+ # Rails files
44
+ rails = dsl.rails(view_extensions: %w(erb haml slim))
45
+ dsl.watch_spec_files_for(rails.app_files)
46
+ dsl.watch_spec_files_for(rails.views)
47
+
48
+ watch(rails.controllers) do |m|
49
+ [
50
+ rspec.spec.call("routing/#{m[1]}_routing"),
51
+ rspec.spec.call("controllers/#{m[1]}_controller"),
52
+ rspec.spec.call("acceptance/#{m[1]}")
53
+ ]
54
+ end
55
+
56
+ # Rails config changes
57
+ watch(rails.spec_helper) { rspec.spec_dir }
58
+ watch(rails.routes) { "#{rspec.spec_dir}/routing" }
59
+ watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
60
+
61
+ # Capybara features specs
62
+ watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
63
+ watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
64
+
65
+ # Turnip features and steps
66
+ watch(%r{^spec/acceptance/(.+)\.feature$})
67
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
68
+ Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
69
+ end
70
+ end
data/Rakefile CHANGED
@@ -1,21 +1,8 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
- require_relative 'lib/seeder'
4
3
 
5
4
  RSpec::Core::RakeTask.new(:spec)
6
5
 
7
6
  task :default => :spec
8
7
 
9
- task :download do
10
- unless File.exist? "pwned-passwords-ordered-by-count.txt"
11
- `curl -O https://downloads.pwnedpasswords.com/passwords/pwned-passwords-ordered-by-count.7z; 7za e pwned-passwords-ordered-by-count.7z; rm pwned-passwords-ordered-by-count.7z;`
12
- end
13
- end
14
-
15
- task :seed, [:all] => [:download] do |_, args|
16
- Seeder.seed all: args[:all]
17
- end
18
-
19
- task :seed_here, [:all] => [:download] do |_, args|
20
- Seeder.seed all: args[:all], cache_dir: Dir.getwd
21
- end
8
+ import "./lib/tasks/seed.rake"
@@ -3,6 +3,8 @@ require_relative "bloomed/msg_packable"
3
3
  require "bloomer"
4
4
  require "bloomer/msgpackable"
5
5
 
6
+ require_relative 'railtie' if defined?(Rails)
7
+
6
8
  module Bloomed
7
9
  class PW
8
10
  include MsgPackable::Bloomed
@@ -68,7 +70,7 @@ module Bloomed
68
70
  end
69
71
 
70
72
  def write_cache(b)
71
- File.write(filename, b.to_msgpack)
73
+ File.open(filename, 'wb') { |f| f.write b.to_msgpack }
72
74
  b
73
75
  end
74
76
  end
@@ -1,3 +1,3 @@
1
1
  module Bloomed
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -0,0 +1,7 @@
1
+ module Bloomed
2
+ class Railtie < Rails::Railtie
3
+ rake_tasks do
4
+ load File.join(File.dirname(__FILE__), "tasks/seed.rake")
5
+ end
6
+ end
7
+ end
@@ -1,8 +1,9 @@
1
- require "./lib/bloomed"
1
+ require "bloomed"
2
2
 
3
3
  KB = 2 ** 10
4
4
 
5
5
  module Seeder
6
+
6
7
  def self.seed(all: false, cache_dir: nil)
7
8
  ps = [0.01, 0.001, 0.0001]
8
9
  cs = [1E4, 1E5]
@@ -0,0 +1,19 @@
1
+ require File.join(File.dirname(__FILE__), "../seeder")
2
+
3
+ namespace :bloomed do
4
+ desc "Download the latest password list from pwnedpasswords.com. Warning! It's more than 22GB and will take a while."
5
+ task :download do
6
+ unless File.exist? "pwned-passwords-ordered-by-count.txt"
7
+ `curl -O https://downloads.pwnedpasswords.com/passwords/pwned-passwords-ordered-by-count.7z; 7za e pwned-passwords-ordered-by-count.7z; rm pwned-passwords-ordered-by-count.7z;`
8
+ end
9
+ end
10
+
11
+ task :seed_gem_dir, [:large] => [:download] do |_, args|
12
+ Seeder.seed all: args[:large]
13
+ end
14
+
15
+ desc "Generate stanard binary bloom filters. Default is top 10.000 and 100.000 with 0.01, 0.001 and 0.0001. Using [large] will add top 1M, 10M and 100M."
16
+ task :seed, [:large] => [:download] do |_, args|
17
+ Seeder.seed all: args[:large], cache_dir: Dir.getwd
18
+ end
19
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bloomed
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Søren Skovsbøll
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-15 00:00:00.000000000 Z
11
+ date: 2018-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bloomer
@@ -138,6 +138,7 @@ files:
138
138
  - CODE_OF_CONDUCT.md
139
139
  - Gemfile
140
140
  - Gemfile.lock
141
+ - Guardfile
141
142
  - LICENSE.txt
142
143
  - README.md
143
144
  - Rakefile
@@ -153,7 +154,9 @@ files:
153
154
  - lib/dump/pwned_top_10000_one_in_100.msgpk
154
155
  - lib/dump/pwned_top_10000_one_in_1000.msgpk
155
156
  - lib/dump/pwned_top_10000_one_in_10000.msgpk
157
+ - lib/railtie.rb
156
158
  - lib/seeder.rb
159
+ - lib/tasks/seed.rake
157
160
  homepage: https://github.com/skovsboll/bloomed
158
161
  licenses:
159
162
  - MIT
@@ -174,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
177
  version: '0'
175
178
  requirements: []
176
179
  rubyforge_project:
177
- rubygems_version: 2.7.6
180
+ rubygems_version: 2.7.7
178
181
  signing_key:
179
182
  specification_version: 4
180
183
  summary: Bloom filter check for pwned passwords