whisk-rails 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 04e262794922e151102b03b3b07b8673a689f328
4
+ data.tar.gz: 779bc4493a2ce0b26d0af9adec5b4882f242e6eb
5
+ SHA512:
6
+ metadata.gz: 0d6aa683654d7b8dbbb73218a9f014826c988207ac6bda9f547e01db5d6ba533fbc952a793029c8819c8d3f0bc5f69e59c5d0030adb35387f5c3239919daa209
7
+ data.tar.gz: 703b09af92aa960f5198cdc0cdda1e9b4731780856b0a0df1a9d97e842cf65347927dce4f6eaa1fde12a8a22c3db73a8ad3a2f643dabf5e488bdfda2ff2d4494
data/.drone.yml ADDED
@@ -0,0 +1,15 @@
1
+ cache:
2
+ mount:
3
+ - bundler
4
+ build:
5
+ image: ruby:$$RUBY_VERSION
6
+ cache:
7
+ - bundler
8
+ commands:
9
+ - bundle install --jobs $(nproc) --path bundler
10
+ - bundle exec appraisal
11
+ - bundle exec appraisal rspec
12
+ matrix:
13
+ RUBY_VERSION:
14
+ - 1.9.3
15
+ - 2.2.3
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ /spec/fixtures/log/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,54 @@
1
+ Documentation:
2
+ Enabled: false
3
+
4
+ AllCops:
5
+ Include:
6
+ - '**/Rakefile'
7
+ - '**/config.ru'
8
+ Exclude:
9
+ - 'db/**/*'
10
+ - 'tmp/**/*'
11
+ - 'vendor/**/*'
12
+ - 'bin/**/*'
13
+ - 'log/**/*'
14
+
15
+ Rails:
16
+ Enabled: true
17
+
18
+ Style/LineLength:
19
+ Max: 145
20
+ Metrics/AbcSize:
21
+ Max: 15
22
+ Metrics/BlockNesting:
23
+ Max: 3
24
+ Metrics/ClassLength:
25
+ CountComments: false # count full line comments?
26
+ Max: 100
27
+ Metrics/CyclomaticComplexity:
28
+ Max: 6
29
+ Metrics/LineLength:
30
+ Max: 80
31
+ AllowURI: true
32
+ URISchemes:
33
+ - http
34
+ - https
35
+
36
+ Style/ClassAndModuleChildren:
37
+ Enabled: false
38
+
39
+ Metrics/MethodLength:
40
+ CountComments: false # count full line comments?
41
+ Max: 13
42
+
43
+ Metrics/ParameterLists:
44
+ Max: 5
45
+ CountKeywordArgs: true
46
+
47
+ Metrics/PerceivedComplexity:
48
+ Max: 7
49
+
50
+ StringLiterals:
51
+ EnforcedStyle: single_quotes
52
+
53
+ Style/ClassAndModuleChildren:
54
+ EnforcedStyle: nested
data/Appraisals ADDED
@@ -0,0 +1,10 @@
1
+ rails_versions = ['~> 3.2.14', '~> 4.0.0']
2
+ devise_version = "~> 3.5.6"
3
+
4
+ rails_versions.each do |rails_version|
5
+ appraise "rails#{rails_version.slice(/\d+\.\d+/)}" do
6
+ gem "rails", rails_version
7
+ gem "sqlite3"
8
+ gem "devise", devise_version
9
+ end
10
+ end
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at dunya@hoppinger.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'appraisal', '~> 2.1.0'
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Dunya Kirkali
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # Whisk::Rails
2
+
3
+ [![Build Status](http://drone.hoppinger.com/api/badges/hoppinger/hvc-kringloopenergie/status.svg)](http://drone.hoppinger.com/hoppinger/hvc-kringloopenergie)
4
+ [![Ruby](https://img.shields.io/badge/Ruby-2.2.3-green.svg)](http://ruby-doc.org/core-2.2.3/)
5
+ [![Ruby](https://img.shields.io/badge/Ruby-1.9.3-green.svg)](http://ruby-doc.org/core-1.9.3/)
6
+ [![Rails](https://img.shields.io/badge/Rails-3.2.22.2-green.svg)](https://rubygems.org/gems/rails/versions/3.2.22.2)
7
+ [![Rails](https://img.shields.io/badge/Rails-4.0.0-green.svg)](https://rubygems.org/gems/rails/versions/4.0.0)
8
+
9
+ Welcome to whisk.
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'whisk-rails'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install whisk-rails
26
+
27
+ ## Usage
28
+
29
+ Create a `.whisk.yml` in the root of your project. Use this file to configure Whisk.
30
+
31
+ ```yaml
32
+ models:
33
+ user: # The model you want to scramble in.
34
+ email: 'internet/email' # The field and fakerclass/method you want to scramble with
35
+ admin:
36
+ email: 'internet/user_name'
37
+ ```
38
+
39
+ You're set. Run `[bundle exec] whisk scramble rails` to scramble your rails application.
40
+
41
+ ## Development
42
+
43
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
44
+
45
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
46
+
47
+ TODO
48
+ ----
49
+ * Drupal supported
50
+ * Wordpress support
51
+
52
+ ## Testing
53
+
54
+ First prepare appraisal
55
+
56
+ $ appraisal install
57
+
58
+ Then you can run the tests
59
+
60
+ $ appraisal rspec
61
+
62
+ ## Contributing
63
+
64
+ Bug reports and pull requests are welcome on GitHub at https://github.com/hoppinger/whisk-rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
65
+
66
+ ## Hoppinger
67
+
68
+ This gem was created by [Hoppinger](http://www.hoppinger.com)
69
+
70
+ [![forthebadge](http://forthebadge.com/images/badges/built-with-ruby.svg)](http://www.hoppinger.com)
71
+
72
+
73
+ ## License
74
+
75
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'appraisal'
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'whisk'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require 'pry'
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/bin/whisk ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'whisk/odinson'
5
+
6
+ Whisk::Odinson.start(ARGV)
@@ -0,0 +1,10 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "~> 2.1.0"
6
+ gem "rails", "~> 3.2.14"
7
+ gem "sqlite3"
8
+ gem "devise", "~> 3.5.6"
9
+
10
+ gemspec :path => "../"
@@ -0,0 +1,149 @@
1
+ PATH
2
+ remote: ../
3
+ specs:
4
+ whisk-rails (0.2.0)
5
+ faker (~> 1.6.3)
6
+ mime-types (< 3.0)
7
+ thor (~> 0.19.1)
8
+ thor-rails (~> 0.0.1)
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ actionmailer (3.2.22.2)
14
+ actionpack (= 3.2.22.2)
15
+ mail (~> 2.5.4)
16
+ actionpack (3.2.22.2)
17
+ activemodel (= 3.2.22.2)
18
+ activesupport (= 3.2.22.2)
19
+ builder (~> 3.0.0)
20
+ erubis (~> 2.7.0)
21
+ journey (~> 1.0.4)
22
+ rack (~> 1.4.5)
23
+ rack-cache (~> 1.2)
24
+ rack-test (~> 0.6.1)
25
+ sprockets (~> 2.2.1)
26
+ activemodel (3.2.22.2)
27
+ activesupport (= 3.2.22.2)
28
+ builder (~> 3.0.0)
29
+ activerecord (3.2.22.2)
30
+ activemodel (= 3.2.22.2)
31
+ activesupport (= 3.2.22.2)
32
+ arel (~> 3.0.2)
33
+ tzinfo (~> 0.3.29)
34
+ activeresource (3.2.22.2)
35
+ activemodel (= 3.2.22.2)
36
+ activesupport (= 3.2.22.2)
37
+ activesupport (3.2.22.2)
38
+ i18n (~> 0.6, >= 0.6.4)
39
+ multi_json (~> 1.0)
40
+ appraisal (2.1.0)
41
+ bundler
42
+ rake
43
+ thor (>= 0.14.0)
44
+ arel (3.0.3)
45
+ bcrypt (3.1.11)
46
+ builder (3.0.4)
47
+ devise (3.5.7)
48
+ bcrypt (~> 3.0)
49
+ orm_adapter (~> 0.1)
50
+ railties (>= 3.2.6, < 5)
51
+ responders
52
+ thread_safe (~> 0.1)
53
+ warden (~> 1.2.3)
54
+ diff-lcs (1.2.5)
55
+ docile (1.1.5)
56
+ erubis (2.7.0)
57
+ faker (1.6.3)
58
+ i18n (~> 0.5)
59
+ hike (1.2.3)
60
+ i18n (0.7.0)
61
+ journey (1.0.4)
62
+ json (1.8.3)
63
+ mail (2.5.4)
64
+ mime-types (~> 1.16)
65
+ treetop (~> 1.4.8)
66
+ mime-types (1.25.1)
67
+ multi_json (1.11.2)
68
+ orm_adapter (0.5.0)
69
+ polyglot (0.3.5)
70
+ rack (1.4.7)
71
+ rack-cache (1.6.1)
72
+ rack (>= 0.4)
73
+ rack-ssl (1.3.4)
74
+ rack
75
+ rack-test (0.6.3)
76
+ rack (>= 1.0)
77
+ rails (3.2.22.2)
78
+ actionmailer (= 3.2.22.2)
79
+ actionpack (= 3.2.22.2)
80
+ activerecord (= 3.2.22.2)
81
+ activeresource (= 3.2.22.2)
82
+ activesupport (= 3.2.22.2)
83
+ bundler (~> 1.0)
84
+ railties (= 3.2.22.2)
85
+ railties (3.2.22.2)
86
+ actionpack (= 3.2.22.2)
87
+ activesupport (= 3.2.22.2)
88
+ rack-ssl (~> 1.3.2)
89
+ rake (>= 0.8.7)
90
+ rdoc (~> 3.4)
91
+ thor (>= 0.14.6, < 2.0)
92
+ rake (10.5.0)
93
+ rdoc (3.12.2)
94
+ json (~> 1.4)
95
+ responders (1.1.2)
96
+ railties (>= 3.2, < 4.2)
97
+ rspec (3.4.0)
98
+ rspec-core (~> 3.4.0)
99
+ rspec-expectations (~> 3.4.0)
100
+ rspec-mocks (~> 3.4.0)
101
+ rspec-core (3.4.4)
102
+ rspec-support (~> 3.4.0)
103
+ rspec-expectations (3.4.0)
104
+ diff-lcs (>= 1.2.0, < 2.0)
105
+ rspec-support (~> 3.4.0)
106
+ rspec-mocks (3.4.1)
107
+ diff-lcs (>= 1.2.0, < 2.0)
108
+ rspec-support (~> 3.4.0)
109
+ rspec-support (3.4.1)
110
+ simplecov (0.11.2)
111
+ docile (~> 1.1.0)
112
+ json (~> 1.8)
113
+ simplecov-html (~> 0.10.0)
114
+ simplecov-html (0.10.0)
115
+ sprockets (2.2.3)
116
+ hike (~> 1.2)
117
+ multi_json (~> 1.0)
118
+ rack (~> 1.0)
119
+ tilt (~> 1.1, != 1.3.0)
120
+ sqlite3 (1.3.11)
121
+ thor (0.19.1)
122
+ thor-rails (0.0.1)
123
+ rails
124
+ thor
125
+ thread_safe (0.3.5)
126
+ tilt (1.4.1)
127
+ treetop (1.4.15)
128
+ polyglot
129
+ polyglot (>= 0.3.1)
130
+ tzinfo (0.3.49)
131
+ warden (1.2.6)
132
+ rack (>= 1.0)
133
+
134
+ PLATFORMS
135
+ ruby
136
+
137
+ DEPENDENCIES
138
+ appraisal (~> 2.1.0)
139
+ bundler
140
+ devise (~> 3.5.6)
141
+ rails (~> 3.2.14)
142
+ rake (~> 10.0)
143
+ rspec (~> 3.0)
144
+ simplecov
145
+ sqlite3
146
+ whisk-rails!
147
+
148
+ BUNDLED WITH
149
+ 1.11.2
@@ -0,0 +1,10 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "~> 2.1.0"
6
+ gem "rails", "~> 4.0.0"
7
+ gem "sqlite3"
8
+ gem "devise", "~> 3.5.6"
9
+
10
+ gemspec :path => "../"
@@ -0,0 +1,142 @@
1
+ PATH
2
+ remote: ../
3
+ specs:
4
+ whisk-rails (0.2.0)
5
+ faker (~> 1.6.3)
6
+ mime-types (< 3.0)
7
+ thor (~> 0.19.1)
8
+ thor-rails (~> 0.0.1)
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ actionmailer (4.0.0)
14
+ actionpack (= 4.0.0)
15
+ mail (~> 2.5.3)
16
+ actionpack (4.0.0)
17
+ activesupport (= 4.0.0)
18
+ builder (~> 3.1.0)
19
+ erubis (~> 2.7.0)
20
+ rack (~> 1.5.2)
21
+ rack-test (~> 0.6.2)
22
+ activemodel (4.0.0)
23
+ activesupport (= 4.0.0)
24
+ builder (~> 3.1.0)
25
+ activerecord (4.0.0)
26
+ activemodel (= 4.0.0)
27
+ activerecord-deprecated_finders (~> 1.0.2)
28
+ activesupport (= 4.0.0)
29
+ arel (~> 4.0.0)
30
+ activerecord-deprecated_finders (1.0.4)
31
+ activesupport (4.0.0)
32
+ i18n (~> 0.6, >= 0.6.4)
33
+ minitest (~> 4.2)
34
+ multi_json (~> 1.3)
35
+ thread_safe (~> 0.1)
36
+ tzinfo (~> 0.3.37)
37
+ appraisal (2.1.0)
38
+ bundler
39
+ rake
40
+ thor (>= 0.14.0)
41
+ arel (4.0.2)
42
+ bcrypt (3.1.11)
43
+ builder (3.1.4)
44
+ devise (3.5.7)
45
+ bcrypt (~> 3.0)
46
+ orm_adapter (~> 0.1)
47
+ railties (>= 3.2.6, < 5)
48
+ responders
49
+ thread_safe (~> 0.1)
50
+ warden (~> 1.2.3)
51
+ diff-lcs (1.2.5)
52
+ docile (1.1.5)
53
+ erubis (2.7.0)
54
+ faker (1.6.3)
55
+ i18n (~> 0.5)
56
+ hike (1.2.3)
57
+ i18n (0.7.0)
58
+ json (1.8.3)
59
+ mail (2.5.4)
60
+ mime-types (~> 1.16)
61
+ treetop (~> 1.4.8)
62
+ mime-types (1.25.1)
63
+ minitest (4.7.5)
64
+ multi_json (1.11.2)
65
+ orm_adapter (0.5.0)
66
+ polyglot (0.3.5)
67
+ rack (1.5.5)
68
+ rack-test (0.6.3)
69
+ rack (>= 1.0)
70
+ rails (4.0.0)
71
+ actionmailer (= 4.0.0)
72
+ actionpack (= 4.0.0)
73
+ activerecord (= 4.0.0)
74
+ activesupport (= 4.0.0)
75
+ bundler (>= 1.3.0, < 2.0)
76
+ railties (= 4.0.0)
77
+ sprockets-rails (~> 2.0.0)
78
+ railties (4.0.0)
79
+ actionpack (= 4.0.0)
80
+ activesupport (= 4.0.0)
81
+ rake (>= 0.8.7)
82
+ thor (>= 0.18.1, < 2.0)
83
+ rake (10.5.0)
84
+ responders (1.1.2)
85
+ railties (>= 3.2, < 4.2)
86
+ rspec (3.4.0)
87
+ rspec-core (~> 3.4.0)
88
+ rspec-expectations (~> 3.4.0)
89
+ rspec-mocks (~> 3.4.0)
90
+ rspec-core (3.4.4)
91
+ rspec-support (~> 3.4.0)
92
+ rspec-expectations (3.4.0)
93
+ diff-lcs (>= 1.2.0, < 2.0)
94
+ rspec-support (~> 3.4.0)
95
+ rspec-mocks (3.4.1)
96
+ diff-lcs (>= 1.2.0, < 2.0)
97
+ rspec-support (~> 3.4.0)
98
+ rspec-support (3.4.1)
99
+ simplecov (0.11.2)
100
+ docile (~> 1.1.0)
101
+ json (~> 1.8)
102
+ simplecov-html (~> 0.10.0)
103
+ simplecov-html (0.10.0)
104
+ sprockets (2.12.4)
105
+ hike (~> 1.2)
106
+ multi_json (~> 1.0)
107
+ rack (~> 1.0)
108
+ tilt (~> 1.1, != 1.3.0)
109
+ sprockets-rails (2.0.1)
110
+ actionpack (>= 3.0)
111
+ activesupport (>= 3.0)
112
+ sprockets (~> 2.8)
113
+ sqlite3 (1.3.11)
114
+ thor (0.19.1)
115
+ thor-rails (0.0.1)
116
+ rails
117
+ thor
118
+ thread_safe (0.3.5)
119
+ tilt (1.4.1)
120
+ treetop (1.4.15)
121
+ polyglot
122
+ polyglot (>= 0.3.1)
123
+ tzinfo (0.3.49)
124
+ warden (1.2.6)
125
+ rack (>= 1.0)
126
+
127
+ PLATFORMS
128
+ ruby
129
+
130
+ DEPENDENCIES
131
+ appraisal (~> 2.1.0)
132
+ bundler
133
+ devise (~> 3.5.6)
134
+ rails (~> 4.0.0)
135
+ rake (~> 10.0)
136
+ rspec (~> 3.0)
137
+ simplecov
138
+ sqlite3
139
+ whisk-rails!
140
+
141
+ BUNDLED WITH
142
+ 1.11.2
@@ -0,0 +1,39 @@
1
+ require 'whisk'
2
+ require 'thor'
3
+ require 'thor/rails'
4
+ require 'yaml'
5
+
6
+ module Whisk
7
+ class Odinson < Thor
8
+ include Thor::Rails
9
+
10
+ class_option :dry, type: :boolean
11
+
12
+ # TODO: (dunyakirkali) function too long
13
+ desc 'scramble [engine]', 'Scrambles data for engine (defaults to rails)'
14
+ def scramble(engine = 'rails')
15
+ klass = "Whisk::#{engine.capitalize}".constantize
16
+ # TODO: (dunyakirkali) better variable names
17
+ conf['models'].each do |model|
18
+ bowl = model.first
19
+ eggs = faker_map(model)
20
+ klass.scramble(bowl, eggs) unless options[:dry]
21
+ end
22
+ end
23
+
24
+ private
25
+
26
+ def faker_map(model)
27
+ model.last.map do |key, value|
28
+ vals = value.split('/')
29
+ { field: key.to_sym, faker_class: "Faker::#{vals.first.capitalize}", method: vals.last }
30
+ end
31
+ end
32
+
33
+ def conf
34
+ YAML.load_file("#{ENV['RAILS_ENV'] == 'test' ? 'spec/fixtures/' : '' }.whisk.yml")
35
+ rescue
36
+ raise Errno::ENOENT, '.whisk.yml not found'
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,6 @@
1
+ module Whisk
2
+ module Rails
3
+ class Railtie < ::Rails::Railtie
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,28 @@
1
+ module Whisk
2
+ module Rails
3
+ class << self
4
+ def scramble(model, fields = [])
5
+ klass = model.classify.constantize
6
+ klass.unscoped.each do |instance|
7
+ scramble_fields_for(instance, fields)
8
+ end
9
+ end
10
+
11
+ private
12
+
13
+ def scramble_fields_for(object, fields)
14
+ fields.each do |field|
15
+ begin
16
+ faker_klass = field[:faker_class].constantize
17
+ rescue
18
+ raise NotImplementedError, 'Faker class is not supported'
19
+ end
20
+ val = faker_klass.send(field[:method])
21
+ object.update_column(field[:field], val)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+
28
+ require_relative 'rails/railtie' if defined?(Rails)
@@ -0,0 +1,3 @@
1
+ module Whisk
2
+ VERSION = '0.2.0'
3
+ end
data/lib/whisk.rb ADDED
@@ -0,0 +1,7 @@
1
+ require 'faker'
2
+
3
+ require 'whisk/rails'
4
+ require 'whisk/version'
5
+
6
+ module Whisk
7
+ end
@@ -0,0 +1,33 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'whisk/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.platform = Gem::Platform::RUBY
8
+ spec.name = "whisk-rails"
9
+ spec.version = Whisk::VERSION
10
+ spec.authors = ["Dunya Kirkali", "Wouter van der Meulen"]
11
+ spec.email = ["dunya@hoppinger.com", "w.s.van.der.meulen@gmail.com"]
12
+ spec.date = Time.now.strftime('%Y-%m-%d')
13
+
14
+ spec.summary = %q{A tool we user @ Hoppinger to scramble}
15
+ spec.description = %q{A tool we user @ Hoppinger to scramble user data. It is meant to use in conjunction with the devise gem}
16
+ spec.homepage = "https://www.hoppinger.com"
17
+ spec.license = "MIT"
18
+
19
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ spec.executables << 'whisk'
21
+
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_runtime_dependency "faker", "~> 1.6.3"
25
+ spec.add_runtime_dependency 'thor', '~> 0.19.1'
26
+ spec.add_runtime_dependency 'thor-rails', '~> 0.0.1'
27
+ spec.add_runtime_dependency "mime-types", "< 3.0"
28
+
29
+ spec.add_development_dependency "bundler"
30
+ spec.add_development_dependency "rake", "~> 10.0"
31
+ spec.add_development_dependency "rspec", "~> 3.0"
32
+ spec.add_development_dependency "simplecov"
33
+ end
metadata ADDED
@@ -0,0 +1,183 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: whisk-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Dunya Kirkali
8
+ - Wouter van der Meulen
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2016-04-26 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: faker
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: 1.6.3
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: 1.6.3
28
+ - !ruby/object:Gem::Dependency
29
+ name: thor
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: 0.19.1
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 0.19.1
42
+ - !ruby/object:Gem::Dependency
43
+ name: thor-rails
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: 0.0.1
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: 0.0.1
56
+ - !ruby/object:Gem::Dependency
57
+ name: mime-types
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "<"
61
+ - !ruby/object:Gem::Version
62
+ version: '3.0'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "<"
68
+ - !ruby/object:Gem::Version
69
+ version: '3.0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: bundler
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rake
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '10.0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '10.0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: rspec
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: '3.0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '3.0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: simplecov
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ description: A tool we user @ Hoppinger to scramble user data. It is meant to use
127
+ in conjunction with the devise gem
128
+ email:
129
+ - dunya@hoppinger.com
130
+ - w.s.van.der.meulen@gmail.com
131
+ executables:
132
+ - whisk
133
+ extensions: []
134
+ extra_rdoc_files: []
135
+ files:
136
+ - ".drone.yml"
137
+ - ".gitignore"
138
+ - ".rspec"
139
+ - ".rubocop.yml"
140
+ - Appraisals
141
+ - CODE_OF_CONDUCT.md
142
+ - Gemfile
143
+ - LICENSE.txt
144
+ - README.md
145
+ - Rakefile
146
+ - bin/console
147
+ - bin/setup
148
+ - bin/whisk
149
+ - gemfiles/rails3.2.gemfile
150
+ - gemfiles/rails3.2.gemfile.lock
151
+ - gemfiles/rails4.0.gemfile
152
+ - gemfiles/rails4.0.gemfile.lock
153
+ - lib/whisk.rb
154
+ - lib/whisk/odinson.rb
155
+ - lib/whisk/rails.rb
156
+ - lib/whisk/rails/railtie.rb
157
+ - lib/whisk/version.rb
158
+ - whisk-rails.gemspec
159
+ homepage: https://www.hoppinger.com
160
+ licenses:
161
+ - MIT
162
+ metadata: {}
163
+ post_install_message:
164
+ rdoc_options: []
165
+ require_paths:
166
+ - lib
167
+ required_ruby_version: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - ">="
170
+ - !ruby/object:Gem::Version
171
+ version: '0'
172
+ required_rubygems_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ requirements: []
178
+ rubyforge_project:
179
+ rubygems_version: 2.4.5.1
180
+ signing_key:
181
+ specification_version: 4
182
+ summary: A tool we user @ Hoppinger to scramble
183
+ test_files: []