maestrano-connector-rails 2.0.2.pre.RC6 → 2.0.2.pre.RC7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +6 -0
  3. data/DEVELOPER.md +1 -4
  4. data/Gemfile +2 -32
  5. data/Rakefile +6 -30
  6. data/app/models/maestrano/connector/rails/concerns/entity.rb +12 -0
  7. data/app/models/maestrano/connector/rails/concerns/sub_entity_base.rb +3 -2
  8. data/app/models/maestrano/connector/rails/id_map.rb +1 -0
  9. data/app/models/maestrano/connector/rails/services/data_consolidator.rb +4 -4
  10. data/db/migrate/20170315032224_add_metadata_to_id_map.rb +5 -0
  11. data/lib/maestrano/connector/rails/version.rb +7 -0
  12. data/lib/maestrano_connector_rails/factories.rb +1 -0
  13. data/maestrano-connector-rails.gemspec +44 -308
  14. metadata +13 -151
  15. data/VERSION +0 -1
  16. data/spec/controllers/connec_controller_spec.rb +0 -179
  17. data/spec/controllers/dependancies_controller_spec.rb +0 -31
  18. data/spec/controllers/group_users_controller_spec.rb +0 -39
  19. data/spec/controllers/groups_controller_spec.rb +0 -36
  20. data/spec/controllers/synchronizations_controller_spec.rb +0 -211
  21. data/spec/controllers/version_controller_spec.rb +0 -17
  22. data/spec/dummy/README.md +0 -1
  23. data/spec/dummy/Rakefile +0 -6
  24. data/spec/dummy/app/assets/images/.keep +0 -0
  25. data/spec/dummy/app/assets/javascripts/application.js +0 -13
  26. data/spec/dummy/app/assets/stylesheets/application.css +0 -15
  27. data/spec/dummy/app/controllers/application_controller.rb +0 -8
  28. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  29. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  30. data/spec/dummy/app/mailers/.keep +0 -0
  31. data/spec/dummy/app/models/.keep +0 -0
  32. data/spec/dummy/app/models/concerns/.keep +0 -0
  33. data/spec/dummy/app/models/entities/.keep +0 -0
  34. data/spec/dummy/app/views/home/index.html.erb +0 -1
  35. data/spec/dummy/app/views/layouts/application.html.erb +0 -14
  36. data/spec/dummy/bin/bundle +0 -3
  37. data/spec/dummy/bin/rails +0 -4
  38. data/spec/dummy/bin/rake +0 -4
  39. data/spec/dummy/bin/setup +0 -29
  40. data/spec/dummy/config.ru +0 -4
  41. data/spec/dummy/config/application.rb +0 -26
  42. data/spec/dummy/config/boot.rb +0 -5
  43. data/spec/dummy/config/database.yml +0 -25
  44. data/spec/dummy/config/environment.rb +0 -5
  45. data/spec/dummy/config/environments/development.rb +0 -41
  46. data/spec/dummy/config/environments/production.rb +0 -79
  47. data/spec/dummy/config/environments/test.rb +0 -39
  48. data/spec/dummy/config/initializers/assets.rb +0 -11
  49. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  50. data/spec/dummy/config/initializers/cookies_serializer.rb +0 -3
  51. data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  52. data/spec/dummy/config/initializers/inflections.rb +0 -16
  53. data/spec/dummy/config/initializers/maestrano.rb +0 -2
  54. data/spec/dummy/config/initializers/mime_types.rb +0 -4
  55. data/spec/dummy/config/initializers/session_store.rb +0 -3
  56. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  57. data/spec/dummy/config/locales/en.yml +0 -23
  58. data/spec/dummy/config/routes.rb +0 -9
  59. data/spec/dummy/config/secrets.yml +0 -22
  60. data/spec/dummy/config/settings.yml +0 -2
  61. data/spec/dummy/config/settings/development.yml +0 -12
  62. data/spec/dummy/config/settings/production.yml +0 -1
  63. data/spec/dummy/config/settings/test.yml +0 -12
  64. data/spec/dummy/config/settings/uat.yml +0 -1
  65. data/spec/dummy/db/schema.rb +0 -102
  66. data/spec/dummy/lib/assets/.keep +0 -0
  67. data/spec/dummy/log/.keep +0 -0
  68. data/spec/dummy/public/404.html +0 -67
  69. data/spec/dummy/public/422.html +0 -67
  70. data/spec/dummy/public/500.html +0 -66
  71. data/spec/dummy/public/favicon.ico +0 -0
  72. data/spec/dummy/tmp/cache/.gitkeep +0 -0
  73. data/spec/integration/complex_id_references_spec.rb +0 -249
  74. data/spec/integration/complex_naming_spec.rb +0 -192
  75. data/spec/integration/complex_spec.rb +0 -578
  76. data/spec/integration/connec_to_external_spec.rb +0 -327
  77. data/spec/integration/external_to_connec_spec.rb +0 -159
  78. data/spec/integration/id_references_spec.rb +0 -584
  79. data/spec/integration/singleton_spec.rb +0 -297
  80. data/spec/jobs/all_synchronizations_job_spec.rb +0 -24
  81. data/spec/jobs/push_to_connec_job_spec.rb +0 -111
  82. data/spec/jobs/push_to_connec_worker_spec.rb +0 -37
  83. data/spec/jobs/synchronization_job_spec.rb +0 -216
  84. data/spec/models/complex_entity_spec.rb +0 -407
  85. data/spec/models/connec_helper_spec.rb +0 -588
  86. data/spec/models/connector_logger_spec.rb +0 -26
  87. data/spec/models/entity_base_spec.rb +0 -20
  88. data/spec/models/entity_spec.rb +0 -1078
  89. data/spec/models/external_spec.rb +0 -27
  90. data/spec/models/id_map_spec.rb +0 -12
  91. data/spec/models/organization_spec.rb +0 -243
  92. data/spec/models/sub_entity_base_spec.rb +0 -155
  93. data/spec/models/synchronization_spec.rb +0 -106
  94. data/spec/models/user_organization_rel_spec.rb +0 -14
  95. data/spec/models/user_spec.rb +0 -15
  96. data/spec/routing/connec_routing_spec.rb +0 -12
  97. data/spec/spec_helper.rb +0 -34
  98. data/template/Procfile +0 -2
  99. data/template/application-sample.yml +0 -13
  100. data/template/database.yml +0 -31
  101. data/template/gitignore +0 -23
  102. data/template/maestrano.rb +0 -2
  103. data/template/maestrano_connector_template.rb +0 -135
  104. data/template/routes.rb +0 -25
  105. data/template/rubocop.yml +0 -55
  106. data/template/settings/development.yml +0 -0
  107. data/template/settings/production.yml +0 -0
  108. data/template/settings/settings.yml +0 -2
  109. data/template/settings/test.yml +0 -0
  110. data/template/settings/uat.yml +0 -0
  111. data/template/sidekiq.rb +0 -9
  112. data/template/sidekiq.yml +0 -4
  113. data/template/spec_helper.rb +0 -24
@@ -1,14 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Maestrano::Connector::Rails::UserOrganizationRel do
4
-
5
- # Attributes
6
-
7
- # Indexes
8
- it { should have_db_index(:user_id) }
9
- it { should have_db_index(:organization_id) }
10
-
11
- #Associations
12
- it { should belong_to(:user) }
13
- it { should belong_to(:organization) }
14
- end
@@ -1,15 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Maestrano::Connector::Rails::User do
4
-
5
- # Attributes
6
- it { should validate_presence_of(:email) }
7
- it { should validate_presence_of(:tenant) }
8
-
9
- # Indexes
10
- it { should have_db_index([:uid, :tenant]) }
11
-
12
- #Associations
13
- it { should have_many(:user_organization_rels) }
14
- it { should have_many(:organizations) }
15
- end
@@ -1,12 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Maestrano::ConnecController, type: :controller do
4
- routes { Maestrano::Connector::Rails::Engine.routes }
5
-
6
- describe "routing" do
7
-
8
- it "routes to #notifications" do
9
- expect(:post => '/maestrano/connec/notifications/default').to route_to("maestrano/connec#notifications", tenant: 'default')
10
- end
11
- end
12
- end
data/spec/spec_helper.rb DELETED
@@ -1,34 +0,0 @@
1
- ENV['RAILS_ENV'] ||= 'test'
2
-
3
- require File.expand_path('../dummy/config/environment.rb', __FILE__)
4
- require 'rspec/rails'
5
- require 'factory_girl_rails'
6
- require 'shoulda/matchers'
7
- require 'simplecov'
8
- require 'timecop'
9
- require 'maestrano_connector_rails/factories.rb'
10
- require 'webmock/rspec'
11
- SimpleCov.start
12
-
13
- Rails.backtrace_cleaner.remove_silencers!
14
-
15
- # Load support files
16
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
17
-
18
- RSpec.configure do |config|
19
- config.mock_with :rspec
20
- config.use_transactional_fixtures = true
21
- config.infer_base_class_for_anonymous_controllers = false
22
- config.order = 'random'
23
- config.include FactoryGirl::Syntax::Methods
24
- config.include Maestrano::Connector::Rails::Engine.routes.url_helpers
25
-
26
- config.before(:each) do
27
- allow(Maestrano::Connector::Rails::External).to receive(:external_name).and_return('External app')
28
- allow(Maestrano::Connector::Rails::External).to receive(:get_client).and_return(Object.new)
29
- allow(Maestrano::Connector::Rails::External).to receive(:entities_list).and_return(%w(entity1 entity2))
30
- stub_request(:get, %r(#{Maestrano['default'].param('api.host')}/api/v1/account/groups/[\w-]*)).
31
- to_return({status: 200, body: "{}", headers: {}})
32
- Rails.cache.clear
33
- end
34
- end
data/template/Procfile DELETED
@@ -1,2 +0,0 @@
1
- web: bin/puma -t 5:5 -p $PORT -e $RACK_ENV
2
- worker: bin/sidekiq
@@ -1,13 +0,0 @@
1
- encryption_key1: ''
2
- encryption_key2: ''
3
-
4
- SIDEKIQ_USERNAME: admin
5
- SIDEKIQ_PASSWORD: password
6
-
7
- REDIS_URL: redis://localhost:6379/0/connector-myapp
8
-
9
- MNO_DEVPL_HOST: https://developer.maestrano.com
10
- MNO_DEVPL_API_PATH: /api/config/v1/marketplaces
11
- MNO_DEVPL_ENV_NAME: connector-myapp
12
- MNO_DEVPL_ENV_KEY:
13
- MNO_DEVPL_ENV_SECRET:
@@ -1,31 +0,0 @@
1
- # SQLite version 3.x
2
- # gem 'activerecord-jdbcsqlite3-adapter'
3
- #
4
- # Configure Using Gemfile
5
- # gem 'activerecord-jdbcsqlite3-adapter'
6
- #
7
- default: &default
8
- adapter: sqlite3
9
-
10
- development:
11
- <<: *default
12
- database: db/development.sqlite3
13
-
14
- # Warning: The database defined as "test" will be erased and
15
- # re-generated from your development database when you run "rake".
16
- # Do not set this db to the same as development or production.
17
- test:
18
- <<: *default
19
- database: db/test.sqlite3
20
-
21
- production:
22
- adapter: mysql2
23
- url: <%= ENV['DATABASE_URL'] %>
24
- encoding: utf8
25
- pool: 5
26
-
27
- uat:
28
- adapter: mysql2
29
- url: <%= ENV['DATABASE_URL'] %>
30
- encoding: utf8
31
- pool: 5
data/template/gitignore DELETED
@@ -1,23 +0,0 @@
1
- # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
- #
3
- # If you find yourself ignoring temporary files generated by your text editor
4
- # or operating system, you probably want to add a global ignore instead:
5
- # git config --global core.excludesfile '~/.gitignore_global'
6
-
7
- # Ignore bundler config.
8
- /.bundle
9
-
10
- # Ignore the default SQLite database.
11
- /db/*.sqlite3
12
- /db/*.sqlite3-journal
13
-
14
- # Ignore all logfiles and tempfiles.
15
- /log/*
16
- !/log/.keep
17
- /tmp
18
-
19
- # Ignore application.yml
20
- config/application.yml
21
-
22
- # Ignore coverage files
23
- coverage/
@@ -1,2 +0,0 @@
1
- Maestrano.auto_configure unless Rails.env.test?
2
- Maestrano.configure { |config| config.environment = 'production' } if Rails.env.test?
@@ -1,135 +0,0 @@
1
- def current_directory
2
- @current_directory ||=
3
- if __FILE__ =~ %r{\Ahttps?://}
4
- tempdir = Dir.mktmpdir('maestrano-connector-rails-')
5
- at_exit { FileUtils.remove_entry(tempdir) }
6
- git clone: "--quiet https://github.com/maestrano/maestrano-connector-rails/ #{tempdir}"
7
-
8
- "#{tempdir}/template"
9
- else
10
- File.expand_path(File.dirname(__FILE__))
11
- end
12
- end
13
-
14
- # def current_directory
15
- # File.expand_path(File.dirname(__FILE__))
16
- # end
17
-
18
- # Add the current directory to the path Thor uses
19
- # to look up files
20
- def source_paths
21
- Array(super) + [current_directory]
22
- end
23
-
24
- #
25
- # Rebuild the Gemfile from scratch
26
- #
27
- remove_file 'Gemfile'
28
- run 'touch Gemfile'
29
-
30
- add_source 'https://rubygems.org'
31
- if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
32
- run 'echo "ruby \'2.3.1\', :engine => \'jruby\', :engine_version => \'9.1.5.0\'" | cat - Gemfile > temp && mv temp Gemfile'
33
- end
34
-
35
- gem 'rails', '~> 4.2'
36
- gem 'turbolinks', '~> 2.5'
37
- gem 'jquery-rails'
38
- gem 'tzinfo-data', platforms: [:mingw, :mswin, :jruby]
39
- gem 'uglifier', '>= 1.3.0'
40
-
41
- gem 'puma', require: false
42
- gem 'sinatra', require: false
43
- gem 'sidekiq'
44
- gem 'sidekiq-cron'
45
-
46
- gem 'maestrano-connector-rails'
47
-
48
- gem_group :production, :uat do
49
- gem 'activerecord-jdbcmysql-adapter', platforms: :jruby
50
- gem 'mysql2', platforms: :ruby
51
- gem 'rails_12factor'
52
- end
53
-
54
- gem_group :test, :development do
55
- gem 'activerecord-jdbcsqlite3-adapter', platforms: :jruby
56
- gem 'sqlite3', platforms: :ruby
57
- gem 'rubocop'
58
- end
59
-
60
- gem_group :test do
61
- gem 'simplecov'
62
- gem 'rspec-rails'
63
- gem 'factory_girl_rails'
64
- gem 'shoulda-matchers'
65
- gem 'timecop'
66
- end
67
-
68
- remove_file '.gitignore'
69
- copy_file 'gitignore', '.gitignore'
70
- copy_file 'rubocop.yml', '.rubocop.yml'
71
-
72
- #
73
- # Cleanup
74
- #
75
- after_bundle do
76
- remove_dir 'app/mailers'
77
- remove_dir 'test'
78
- remove_file 'app/views/layouts/application.html.erb'
79
- remove_file 'app/assets/stylesheets/application.css'
80
- remove_file 'config/routes.rb'
81
- copy_file 'spec_helper.rb', 'spec/spec_helper.rb'
82
- copy_file 'routes.rb', 'config/routes.rb'
83
-
84
- # Heroku and uat
85
- copy_file 'Procfile', 'Procfile'
86
- run 'cp config/environments/production.rb config/environments/uat.rb'
87
- remove_file 'config/database.yml'
88
- copy_file 'database.yml', 'config/database.yml'
89
- run 'echo \'uat:
90
- secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>\' >> config/secrets.yml'
91
-
92
- # Sidekiq
93
- copy_file 'sidekiq.yml', 'config/sidekiq.yml'
94
- copy_file 'sidekiq.rb', 'config/initializers/sidekiq.rb'
95
-
96
- # Settings
97
- run 'bundle exec rails g config:install'
98
- remove_dir 'config/settings'
99
- remove_file 'config/settings.yml'
100
- run 'mkdir config/settings'
101
- %w(development production test uat).each do |file|
102
- copy_file "settings/#{file}.yml", "config/settings/#{file}.yml"
103
- end
104
- copy_file 'settings/settings.yml', 'config/settings.yml'
105
-
106
- copy_file 'application-sample.yml', 'config/application-sample.yml'
107
- copy_file 'application-sample.yml', 'config/application.yml', force: true
108
-
109
- application do
110
- <<-RUBY
111
- config.generators do |g|
112
- g.test_framework :rspec, fixture: false
113
- g.view_specs false
114
- g.helper_specs false
115
- end
116
- RUBY
117
- end
118
-
119
- run 'bundle exec rails g connector:install'
120
- run 'bundle exec figaro install'
121
- run 'bundle exec rake railties:install:migrations'
122
- run 'bundle exec rake db:migrate'
123
-
124
- run 'bundler binstubs puma --force'
125
- run 'bundler binstubs sidekiq --force'
126
- run 'bundler binstubs rake --force'
127
-
128
- remove_file 'config/initializers/maestrano.rb'
129
- copy_file 'maestrano.rb', 'config/initializers/maestrano.rb'
130
-
131
- # Init repo and commit
132
- git :init
133
- git add: '.'
134
- git commit: "-a -m 'Initial commit'"
135
- end
data/template/routes.rb DELETED
@@ -1,25 +0,0 @@
1
- Rails.application.routes.draw do
2
- mount Maestrano::Connector::Rails::Engine, at: '/'
3
-
4
- # Default Connector pages
5
- root 'home#index'
6
- get 'home/index' => 'home#index'
7
- get 'home/redirect_to_external' => 'home#redirect_to_external'
8
- get 'home/index' => 'home#index'
9
- put 'home/update' => 'home#update'
10
- post 'home/synchronize' => 'home#synchronize'
11
- get 'synchronizations/index' => 'synchronizations#index'
12
- get 'shared_entities/index' => 'shared_entities#index'
13
-
14
- # OAuth workflow pages
15
- match 'auth/:provider/request', to: 'oauth#create_omniauth', via: [:get, :post]
16
- match 'signout_omniauth', to: 'oauth#destroy_omniauth', as: 'signout_omniauth', via: [:get, :post]
17
- post 'auth/auth', to: 'auth#auth'
18
-
19
- # Sidekiq Admin
20
- require 'sidekiq/web'
21
- Sidekiq::Web.use Rack::Auth::Basic do |username, password|
22
- username == ENV['SIDEKIQ_USERNAME'] && password == ENV['SIDEKIQ_PASSWORD']
23
- end
24
- mount Sidekiq::Web => '/sidekiq'
25
- end
data/template/rubocop.yml DELETED
@@ -1,55 +0,0 @@
1
- Rails:
2
- Enabled: true
3
-
4
- AllCops:
5
- TargetRubyVersion: 2.3
6
- Exclude:
7
- - 'db/schema.rb'
8
- - 'db/migrate/*'
9
- - 'db/seeds.rb'
10
- - 'bin/*'
11
- - 'Gemfile'
12
- - 'Rakefile'
13
- - 'config.ru'
14
- - 'spec/**/*'
15
- - 'config/**/*'
16
- - 'app/helpers/application_helper.rb'
17
- - 'app/controllers/application_controller.rb'
18
-
19
- # Enabled disabled Cops
20
- Style/CollectionMethods:
21
- Enabled: true
22
-
23
- Metrics/LineLength:
24
- Max: 320
25
-
26
- Style/IndentationConsistency:
27
- EnforcedStyle: rails
28
-
29
- # Missing top-level class documentation comment
30
- Style/Documentation:
31
- Enabled: false
32
-
33
- Style/ClassAndModuleChildren:
34
- Enabled: false
35
-
36
- # Space inside braces => only for blocks (not for literal)
37
- Style/SpaceInsideHashLiteralBraces:
38
- EnforcedStyle: no_space
39
-
40
- # Checks for unused block arguments
41
- Lint/UnusedBlockArgument:
42
- Enabled: false
43
-
44
- # Checks for unused method arguments.
45
- Lint/UnusedMethodArgument:
46
- Enabled: false
47
-
48
- Metrics/AbcSize:
49
- # The ABC size is a calculated magnitude, so this number can be a Fixnum or
50
- # a Float.
51
- Max: 27
52
-
53
- # RSpec/FilePath:
54
- # Exclude:
55
- # - 'spec/routing/**/*_routing_spec.rb'
File without changes
File without changes
@@ -1,2 +0,0 @@
1
- encryption_key1: <%= ENV['encryption_key1'] %>
2
- encryption_key2: <%= ENV['encryption_key2'] %>
File without changes
File without changes
data/template/sidekiq.rb DELETED
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'sidekiq/web'
3
-
4
- Sidekiq::Cron::Job.create(name: 'AllSynchronizationsJob runs every hour', cron: '0 * * * *', class: 'Maestrano::Connector::Rails::AllSynchronizationsJob')
5
-
6
- # Sidekiq Admin
7
- Sidekiq::Web.use Rack::Auth::Basic do |username, password|
8
- username == ENV['SIDEKIQ_USERNAME'] && password == ENV['SIDEKIQ_PASSWORD']
9
- end
data/template/sidekiq.yml DELETED
@@ -1,4 +0,0 @@
1
- ---
2
- :queues:
3
- - default
4
- :concurrency: 5
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'simplecov'
3
- SimpleCov.start
4
-
5
- ENV['RAILS_ENV'] ||= 'test'
6
-
7
- require File.expand_path('../../config/environment', __FILE__)
8
- require 'rspec/rails'
9
- require 'factory_girl_rails'
10
- require 'shoulda/matchers'
11
- require 'maestrano_connector_rails/factories.rb'
12
-
13
- Rails.backtrace_cleaner.remove_silencers!
14
-
15
- # Load support files
16
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
17
-
18
- RSpec.configure do |config|
19
- config.mock_with :rspec
20
- config.use_transactional_fixtures = true
21
- config.infer_base_class_for_anonymous_controllers = false
22
- config.order = 'random'
23
- config.include FactoryGirl::Syntax::Methods
24
- end