automock 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +11 -0
  5. data/CODE_OF_CONDUCT.md +49 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +21 -0
  8. data/LISENCE.txt +22 -0
  9. data/README.md +110 -0
  10. data/Rakefile +11 -0
  11. data/automock/data/test.json +1 -0
  12. data/automock/data/test2.json +1 -0
  13. data/automock.gemspec +27 -0
  14. data/bin/console +14 -0
  15. data/bin/server +3 -0
  16. data/bin/setup +13 -0
  17. data/lib/automock/response_mock.rb +55 -0
  18. data/lib/automock/rspec.rb +11 -0
  19. data/lib/automock/version.rb +3 -0
  20. data/lib/automock.rb +24 -0
  21. data/lib/tasks/automock.rake +31 -0
  22. data/server/.babelrc +3 -0
  23. data/server/.eslintrc +104 -0
  24. data/server/.flowconfig +11 -0
  25. data/server/.gitignore +4 -0
  26. data/server/app/db/database.json +10 -0
  27. data/server/app/db/sequelize.js +4 -0
  28. data/server/app/index.js +75 -0
  29. data/server/app/models/selected_file.js +11 -0
  30. data/server/app/proxy_server.js +50 -0
  31. data/server/assets/index.html +12 -0
  32. data/server/assets/javascripts/actions/mock_files_actions.js +18 -0
  33. data/server/assets/javascripts/actions/selected_files_actions.js +46 -0
  34. data/server/assets/javascripts/components/file_list.react.js +23 -0
  35. data/server/assets/javascripts/components/select_buttons.react.js +18 -0
  36. data/server/assets/javascripts/components/selectable_lists.react.js +44 -0
  37. data/server/assets/javascripts/containers/app.react.js +56 -0
  38. data/server/assets/javascripts/index.js +23 -0
  39. data/server/assets/javascripts/reducers/index.js +7 -0
  40. data/server/assets/javascripts/reducers/mock_files.js +11 -0
  41. data/server/assets/javascripts/reducers/selected_files.js +15 -0
  42. data/server/assets/stylesheets/application.scss +4 -0
  43. data/server/assets/stylesheets/components/_file_list.scss +9 -0
  44. data/server/assets/stylesheets/components/_select_buttons.scss +6 -0
  45. data/server/assets/stylesheets/components/_selectable_list.scss +3 -0
  46. data/server/bin/server +13 -0
  47. data/server/gulpfile.coffee +35 -0
  48. data/server/migrations/20160101185711-add-selected-files.js +15 -0
  49. data/server/migrations/20160102233558-add-columns-to-selected-files.js +17 -0
  50. data/server/package.json +58 -0
  51. data/server/test/fixtures/mock/api/v1/api_test.json +1 -0
  52. data/server/test/fixtures/mock/test.json +1 -0
  53. data/server/test/request/common_hooks.js +20 -0
  54. data/server/test/request/mock_files_test.js +34 -0
  55. data/server/test/request/selected_files_test.js +63 -0
  56. metadata +182 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 37d437b11b0f119b81e778eeebc0b545eca51343
4
+ data.tar.gz: 06ea82d3917a6bfd050337eb3316f628cf398ae6
5
+ SHA512:
6
+ metadata.gz: 52df14de3e03fb8b013b3952cba9bc859a1d709bb7e8f891847903b17db8fb36cee466f8635e8197c32bf0661dcf1e70273d0ce3bd2e5b1c2872c2f84c4755ca
7
+ data.tar.gz: 7778f6516f9dc6b9248e24e3c381f5dd2ee88e9d8c39d41ed0744102533ae835fa63c3d0d278c4609d793776126578dc69bfe4ad56cef30e7251cbb833c26049
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ .bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /spec/fixtures/data
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.0
4
+ sudo: false
5
+ before_install: gem install bundler -v 1.11.2
6
+ before_install: nvm install 4.2.3
7
+ install:
8
+ - ./bin/setup
9
+ script:
10
+ - bundle exec rake spec
11
+ - cd server && npm test
@@ -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 joe.tialtngo@gmail.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,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in automock.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 joe-re
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/LISENCE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2016 Masato Noguchi
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,110 @@
1
+ # Automock
2
+
3
+ Generate WebAPI mocking response data from your rails application's request-spec.
4
+
5
+ And run proxy server for mocking response.
6
+
7
+ Inspired by [autodoc](https://github.com/r7kamura/autodoc).
8
+
9
+ ## Installation
10
+
11
+ Add this line to your rails application's Gemfile:
12
+
13
+ ```ruby
14
+ gem "automock", group: :test
15
+ ```
16
+
17
+ Download and install by running:
18
+
19
+ ```
20
+ $ bundle install
21
+ ```
22
+
23
+ And setup mocking server.
24
+
25
+ ```
26
+ $ rake automock:setup
27
+ ```
28
+
29
+ This generate `automock` directory under your rails root.
30
+ Mocking server is inside it.
31
+ I recommend adding automock directory to .gitignore;
32
+
33
+ Then run mocking server.
34
+
35
+ ```
36
+ $ rake automock:server
37
+ ```
38
+
39
+ By default, proxy server use 8001 port and target application using 3000 port.
40
+ Mocking management server use 8000 port.
41
+ Now you can access it, localhost:8000.
42
+ And access localhost:8001, you can receive response by proxy;
43
+
44
+ ## Usage
45
+
46
+ ### Generate data for mocking response
47
+ Run rspec with AUTOMOCK=1 to generate mocking data for your request-specs tagged with :automock.
48
+
49
+ ```
50
+ AUTOMOCK=1 rspec
51
+ ```
52
+
53
+ #### Example
54
+
55
+ ```ruby
56
+ RSpec.describe 'users', type: :request do
57
+ describe 'GET /api/v1/users', automock: true do
58
+ before do
59
+ get '/api/v1/users'
60
+ end
61
+ it 'receives 200 and users json' do
62
+ expect(response.status).to eq 200
63
+ end
64
+ # and more example...
65
+ end
66
+ end
67
+ ```
68
+
69
+ ### Mocking response
70
+
71
+ You can manage mocking data, on or off, by mocking response management server.
72
+ By default, mocking management server use 8000 port.
73
+ So you can access it.
74
+
75
+ ![management_server_screenshot](https://cloud.githubusercontent.com/assets/4954534/12078401/3621c93c-b254-11e5-9f7e-21bd075bed2e.png)
76
+
77
+ Selected mocking data is used by proxy.
78
+ Unselected api is passed through normally.
79
+
80
+ ### Configration
81
+
82
+ You can change automock's using port by rake args.
83
+
84
+ - automock_port
85
+ - rails_port
86
+ - proxy_port
87
+
88
+ Example:
89
+ ```
90
+ $ rake automock:server automock_port=3001 rails_port=3002 proxy_port=3003
91
+ ```
92
+ ## Development
93
+
94
+ After checking out the repo, run `bin/setup` to install dependencies.
95
+ If you run mocking server, run `bin/server` to start it;
96
+
97
+ ### spec
98
+
99
+ Then, run `rake spec` to run the tests for ruby code.
100
+ And change directory to `server`, then run `npm run test` to run the tests for mocking server.
101
+ If you want to update mock data for specs, run `bundle exec rake update_mockdata_fixtures` command.
102
+
103
+ ## Contributing
104
+
105
+ Bug reports and pull requests are welcome on GitHub at https://github.com/joe-re/automock. 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.
106
+
107
+
108
+ ## License
109
+
110
+ 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,11 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
7
+ task :update_mockdata_fixtures do
8
+ system('rm -rf spec/dummy/automock')
9
+ system('AUTOMOCK=1 bundle exec rspec spec/dummy/spec/requests/dummy_api.rb')
10
+ FileUtils.cp_r('spec/dummy/automock/data', 'spec/fixtures/', remove_destination: true)
11
+ end
@@ -0,0 +1 @@
1
+ {"description":"1 receives 200 and users json","method":"GET","uri":"/api/v1/users","status":200,"response_header":{"X-Frame-Options":"SAMEORIGIN","X-XSS-Protection":"1; mode=block","X-Content-Type-Options":"nosniff","Content-Type":"application/json; charset=utf-8","ETag":"W/\"e224cce5657514dd4f022471dc9261c6\"","Cache-Control":"max-age=0, private, must-revalidate","X-Request-Id":"dc872bfa-ebc0-447e-ad5c-4c7932897bb2","X-Runtime":"0.008449","Content-Length":"42"},"response_body":"{\"users\":[{\"user\":{\"name\":\"dummy user\"}}]}"}
@@ -0,0 +1 @@
1
+ {"description":"2 receives 200 and users json","method":"GET","uri":"/api/v1/users2","status":200,"response_header":{"X-Frame-Options":"SAMEORIGIN","X-XSS-Protection":"1; mode=block","X-Content-Type-Options":"nosniff","Content-Type":"application/json; charset=utf-8","ETag":"W/\"e224cce5657514dd4f022471dc9261c6\"","Cache-Control":"max-age=0, private, must-revalidate","X-Request-Id":"dc872bfa-ebc0-447e-ad5c-4c7932897bb2","X-Runtime":"0.008449","Content-Length":"42"},"response_body":"{\"users\":[{\"user\":{\"name\":\"dummy user\"}}]}"}
data/automock.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'automock/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'automock'
8
+ spec.version = Automock::VERSION
9
+ spec.authors = ['joe-re']
10
+ spec.email = ['joe.tialtngo@gmail.com']
11
+
12
+ spec.summary = 'Auto-generate mock_data of JSON API response from your request-specs.'
13
+ spec.homepage = 'https://github.com/joe-re/automock'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = 'exe'
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ['lib']
20
+ spec.add_dependency 'rspec', '~> 3.0'
21
+ spec.add_dependency 'rails', '~> 4.0'
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.11'
24
+ spec.add_development_dependency 'rake', '~> 10.0'
25
+ spec.add_development_dependency 'rspec-rails'
26
+ spec.add_development_dependency 'sqlite3'
27
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "automock"
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/server ADDED
@@ -0,0 +1,3 @@
1
+ export AUTOMOCK_DATA_PATH=${PWD}/automock/data
2
+ cd server
3
+ node app/index.js
data/bin/setup ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install --path vendor/bundle
7
+ bundle exec rake update_mockdata_fixtures
8
+
9
+ # Do any other automated setup that you need to do here
10
+ cd server
11
+ npm install
12
+ npm run build
13
+ node node_modules/db-migrate/bin/db-migrate up --config app/db/database.json -e dev
@@ -0,0 +1,55 @@
1
+ require 'pathname'
2
+
3
+ module Automock
4
+ class ResponseMock
5
+ def initialize(context, example)
6
+ @context = context
7
+ @example = example
8
+ end
9
+
10
+ def description
11
+ @example.description
12
+ end
13
+
14
+ def method
15
+ @context.request.method
16
+ end
17
+
18
+ def uri
19
+ @context.request.env['PATH_INFO']
20
+ end
21
+
22
+ def response_header
23
+ @context.response.try(:header)
24
+ end
25
+
26
+ def status
27
+ @context.response.try(:status)
28
+ end
29
+
30
+ def response_body
31
+ @context.response.try(:body)
32
+ end
33
+
34
+ def filename
35
+ "#{method}_#{description.gsub(/\s/, '_').gsub(/[?"\\\<>*|]/, '')}.json"
36
+ end
37
+
38
+ def mock_data
39
+ {
40
+ description: description,
41
+ method: method,
42
+ uri: uri,
43
+ status: status,
44
+ response_header: response_header,
45
+ response_body: response_body
46
+ }.to_json
47
+ end
48
+
49
+ def write
50
+ pathname = Pathname.new("#{Rails.root}/automock/data/#{uri}/#{filename}")
51
+ pathname.parent.mkpath
52
+ pathname.open('w') { |file| file << mock_data }
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,11 @@
1
+ require 'rspec'
2
+
3
+ RSpec.configure do |c|
4
+ c.after(:each, automock: true) do |example|
5
+ Automock.append(self, example)
6
+ end
7
+
8
+ c.after(:suite) do
9
+ Automock.write
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module Automock
2
+ VERSION = "0.0.1"
3
+ end
data/lib/automock.rb ADDED
@@ -0,0 +1,24 @@
1
+ require 'rails'
2
+ require 'automock/version'
3
+ require 'automock/response_mock'
4
+ require 'automock/rspec'
5
+
6
+ module Automock
7
+ class << self
8
+ def append(context, example)
9
+ return unless ENV["AUTOMOCK"]
10
+ @mocks ||= []
11
+ @mocks << ResponseMock.new(context.clone, example.clone)
12
+ end
13
+
14
+ def write
15
+ @mocks && @mocks.each(&:write)
16
+ end
17
+ end
18
+
19
+ class Railtie < ::Rails::Railtie
20
+ rake_tasks do
21
+ load 'tasks/automock.rake'
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,31 @@
1
+ require 'pathname'
2
+ require 'fileutils'
3
+
4
+ namespace :automock do
5
+ desc 'Setup automock'
6
+ task :setup, :options do |_, _args|
7
+ dist = Pathname.new('automock')
8
+ dist.mkpath
9
+ src = [
10
+ "#{File.dirname(__FILE__)}/../../server"
11
+ ]
12
+ FileUtils.cp_r(src, dist, remove_destination: true)
13
+ puts "created #{dist}"
14
+ Rake::Task['automock:install'].execute
15
+ end
16
+
17
+ task :install, :options do |_, _args|
18
+ Dir.chdir "#{Rails.root}/automock/server"
19
+ sh 'npm install && npm run build'
20
+ sh 'node node_modules/db-migrate/bin/db-migrate up --config app/db/database.json -e dev'
21
+ end
22
+
23
+ task :server, :options do |_, _args|
24
+ ap = ENV['automock_port'] || 8000
25
+ rp = ENV['rails_port'] || 3000
26
+ pp = ENV['proxy_port'] || 8001
27
+ mock_data_path = "#{Rails.root}/automock/data"
28
+ Dir.chdir "#{Rails.root}/automock/server"
29
+ sh "./bin/server #{mock_data_path} #{ap} #{rp} #{pp}"
30
+ end
31
+ end
data/server/.babelrc ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ presets: [ 'es2015', 'react' ]
3
+ }
data/server/.eslintrc ADDED
@@ -0,0 +1,104 @@
1
+ {
2
+ "parser": "babel-eslint",
3
+ "env": {
4
+ "browser": true,
5
+ "node": false
6
+ },
7
+ "ecmaFeatures": {
8
+ "jsx": true
9
+ },
10
+ "plugins": [
11
+ "react"
12
+ ],
13
+ "rules": {
14
+ "strict": 0,
15
+
16
+ "comma-dangle": 2,
17
+ "comma-style": [2, "last"],
18
+ "comma-spacing": [2, {"before": false, "after": true}],
19
+ "semi": [2, "always"],
20
+ "indent": [2, 2],
21
+ "key-spacing": [0],
22
+ "quotes": [2, "single", "avoid-escape"],
23
+ "brace-style": [2, "1tbs", { "allowSingleLine": false }],
24
+ "curly": 2,
25
+ "object-curly-spacing": [2, "always"],
26
+ "array-bracket-spacing": [2, "always"],
27
+ "dot-location": [2, "object"],
28
+ "camelcase": [2, {"properties": "never"}],
29
+ "dot-notation": 2,
30
+ "yoda": [2, "never", { "exceptRange": true }],
31
+
32
+ "no-alert": 2,
33
+ "no-array-constructor": 2,
34
+ "no-caller": 2,
35
+ "no-catch-shadow": 2,
36
+ "no-dupe-args": 2,
37
+ "no-else-return": 2,
38
+ "no-empty-label": 2,
39
+ "no-eval": 2,
40
+ "no-extend-native": 2,
41
+ "no-extra-bind": 2,
42
+ "no-implied-eval": 2,
43
+ "no-iterator": 2,
44
+ "no-label-var": 2,
45
+ "no-labels": 2,
46
+ "no-lone-blocks": 2,
47
+ "no-lonely-if": 2,
48
+ "no-loop-func": 2,
49
+ "no-multi-spaces": [2, {
50
+ "exceptions":{
51
+ "Property": true,
52
+ "ImportDeclaration": true,
53
+ "VariableDeclarator": true,
54
+ "AssignmentExpression": true
55
+ }
56
+ }],
57
+ "no-multi-str": 2,
58
+ "no-multiple-empty-lines": [2, {max: 2}],
59
+ "no-native-reassign": 2,
60
+ "no-nested-ternary": 2,
61
+ "no-new": 0,
62
+ "no-new-func": 2,
63
+ "no-new-object": 2,
64
+ "no-new-wrappers": 2,
65
+ "no-octal-escape": 2,
66
+ "no-process-exit": 2,
67
+ "no-proto": 2,
68
+ "no-return-assign": 2,
69
+ "no-script-url": 2,
70
+ "no-sequences": 2,
71
+ "no-shadow": 2,
72
+ "no-shadow-restricted-names": 2,
73
+ "no-spaced-func": 2,
74
+ "no-throw-literal": 2,
75
+ "no-trailing-spaces": 2,
76
+ "no-undef": 0,
77
+ "no-undef-init": 2,
78
+ "no-underscore-dangle": 2,
79
+ "no-unneeded-ternary": 2,
80
+ "no-unused-expressions": 2,
81
+ "no-unused-vars": [2, {"vars": "all", "args": "all", "argsIgnorePattern": "^_"}],
82
+ "no-use-before-define": 2,
83
+ "no-void": 2,
84
+ "no-with": 2,
85
+
86
+ "max-len": [1, 120, 2],
87
+ "max-params": [1, 3],
88
+ "max-depth": [1, 3],
89
+ "max-statements": [1, 50],
90
+
91
+ "new-cap": 0,
92
+ "eqeqeq": 2,
93
+
94
+ "no-var": 2,
95
+ "object-shorthand": [2, "always"],
96
+ "prefer-const": 2,
97
+ "constructor-super": 2,
98
+ "no-this-before-super": 2,
99
+ "space-after-keywords": 2,
100
+ "arrow-spacing": 2,
101
+
102
+ "react/jsx-uses-vars": 1
103
+ }
104
+ }
@@ -0,0 +1,11 @@
1
+ [ignore]
2
+ .*/node_modules/.*/node_modules/.*
3
+ .*/node_modules/babel-core/lib/.*
4
+
5
+ [include]
6
+ ./node_modules/
7
+
8
+
9
+ [libs]
10
+
11
+ [options]
data/server/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ /app/assets/
2
+ /node_modules/
3
+ /npm-debug.log
4
+ /*.db
@@ -0,0 +1,10 @@
1
+ {
2
+ "dev": {
3
+ "driver": "sqlite3",
4
+ "filename": "automock.db"
5
+ },
6
+ "test": {
7
+ "driver": "sqlite3",
8
+ "filename": "automock_test.db"
9
+ }
10
+ }
@@ -0,0 +1,4 @@
1
+ const Sequelize = require('sequelize');
2
+ const storage = process.env.NODE_ENV === 'test' ? './automock_test.db' : './automock.db';
3
+ const sequelize = new Sequelize('automock', '', '', { dialect:'sqlite', storage });
4
+ module.exports = sequelize;