maestrano-connector-rails 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +41 -0
  3. data/.rubocop_todo.yml +180 -0
  4. data/.ruby-version +1 -1
  5. data/CODESHIP.md +3 -1
  6. data/Gemfile +16 -10
  7. data/Rakefile +12 -12
  8. data/VERSION +1 -1
  9. data/app/controllers/maestrano/account/group_users_controller.rb +5 -7
  10. data/app/controllers/maestrano/account/groups_controller.rb +5 -7
  11. data/app/controllers/maestrano/application_controller.rb +1 -1
  12. data/app/controllers/maestrano/auth/saml_controller.rb +5 -10
  13. data/app/controllers/maestrano/connec_controller.rb +12 -11
  14. data/app/controllers/maestrano/sessions_controller.rb +1 -1
  15. data/app/controllers/maestrano/synchronizations_controller.rb +7 -9
  16. data/app/controllers/version_controller.rb +9 -0
  17. data/app/helpers/maestrano/connector/rails/session_helper.rb +0 -2
  18. data/app/jobs/maestrano/connector/rails/all_synchronizations_job.rb +2 -2
  19. data/app/jobs/maestrano/connector/rails/push_to_connec_job.rb +8 -7
  20. data/app/jobs/maestrano/connector/rails/push_to_connec_worker.rb +6 -4
  21. data/app/jobs/maestrano/connector/rails/synchronization_job.rb +10 -9
  22. data/app/models/maestrano/connector/rails/complex_entity.rb +1 -1
  23. data/app/models/maestrano/connector/rails/concerns/complex_entity.rb +10 -12
  24. data/app/models/maestrano/connector/rails/concerns/connec_helper.rb +20 -25
  25. data/app/models/maestrano/connector/rails/concerns/connector_logger.rb +1 -1
  26. data/app/models/maestrano/connector/rails/concerns/entity.rb +63 -69
  27. data/app/models/maestrano/connector/rails/concerns/entity_base.rb +3 -3
  28. data/app/models/maestrano/connector/rails/concerns/external.rb +2 -2
  29. data/app/models/maestrano/connector/rails/concerns/sub_entity_base.rb +13 -15
  30. data/app/models/maestrano/connector/rails/connector_logger.rb +1 -1
  31. data/app/models/maestrano/connector/rails/entity.rb +1 -1
  32. data/app/models/maestrano/connector/rails/external.rb +1 -1
  33. data/app/models/maestrano/connector/rails/id_map.rb +1 -2
  34. data/app/models/maestrano/connector/rails/organization.rb +12 -14
  35. data/app/models/maestrano/connector/rails/sub_entity_base.rb +1 -1
  36. data/app/models/maestrano/connector/rails/synchronization.rb +17 -15
  37. data/app/models/maestrano/connector/rails/user.rb +1 -2
  38. data/app/models/maestrano/connector/rails/user_organization_rel.rb +1 -2
  39. data/config/routes.rb +4 -2
  40. data/lib/maestrano/connector/rails.rb +17 -2
  41. data/lib/maestrano_connector_rails.rb +1 -0
  42. data/maestrano-connector-rails.gemspec +32 -13
  43. data/release_notes.md +5 -0
  44. data/spec/controllers/version_controller_spec.rb +17 -0
  45. data/spec/dummy/config/application.rb +1 -1
  46. data/spec/jobs/push_to_connec_worker_spec.rb +16 -5
  47. data/spec/models/synchronization_spec.rb +9 -9
  48. data/spec/models/user_organization_rel_spec.rb +1 -1
  49. data/template/maestrano-connector-template.rb +2 -17
  50. metadata +90 -16
  51. data/lib/maestrano-connector-rails.rb +0 -1
data/release_notes.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 1.2.1
2
+
3
+ ### Features
4
+ * Add PushToConnecWorker that give the possibilty to do jobs sequentially for a given organization and entity
5
+
1
6
  ## 1.2.0
2
7
  /!\ For this version to work, you'll need to add `< Maestrano::Connector::Rails::EntityBase` to your `entity.rb` class
3
8
 
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe VersionController, type: :controller do
4
+ routes { Maestrano::Connector::Rails::Engine.routes }
5
+
6
+ describe 'index' do
7
+ subject { get :index, format: :json }
8
+ before {
9
+ allow(Gem).to receive(:loaded_specs).and_return({'maestrano-connector-rails' => Gem::Specification.new('maestrano-connector-rails', '1.2')})
10
+ }
11
+
12
+ it 'returns a version hash' do
13
+ subject
14
+ expect(JSON.parse(response.body)).to eql({"framework_version"=>"1.2"})
15
+ end
16
+ end
17
+ end
@@ -3,7 +3,7 @@ require File.expand_path('../boot', __FILE__)
3
3
  require 'rails/all'
4
4
 
5
5
  Bundler.require(*Rails.groups)
6
- require "maestrano-connector-rails"
6
+ require "maestrano_connector_rails"
7
7
 
8
8
  module Dummy
9
9
  class Application < Rails::Application
@@ -2,25 +2,36 @@ require 'spec_helper'
2
2
  require 'sidekiq/testing'
3
3
 
4
4
  describe Maestrano::Connector::Rails::PushToConnecWorker do
5
- describe 'class method' do
5
+ describe 'class methods' do
6
6
  let(:organization) { create(:organization) }
7
7
  subject { Maestrano::Connector::Rails::PushToConnecWorker }
8
8
 
9
9
  Sidekiq::Testing.fake!
10
10
  it 'perform_async add a new job' do
11
+ expect_any_instance_of(Maestrano::Connector::Rails::PushToConnecJob).to receive(:perform)
11
12
  expect {
12
- subject.perform_async(1, 2, 3)
13
+ subject.perform_async(organization.id, 2, 3)
13
14
  }.to change(subject.jobs, :size).by(1)
15
+
16
+ expect {
17
+ subject.drain
18
+ }.to change(subject.jobs, :size).by(-1)
19
+ end
20
+
21
+ it 'raise an error if the organization can t be found' do
22
+ subject.perform_async(-1, 2, 3)
23
+ expect {
24
+ subject.drain
25
+ }.to raise_error(ActiveRecord::RecordNotFound)
14
26
  end
15
27
 
28
+
16
29
  describe 'unique_args' do
17
30
  it do
18
31
  entities_hash = {entity_2: [{'id': 'id2'}, {'id': 'id1'}], entity_1: [{'id': 'id4'}, {'id': nil}, {'id': 'id3'}, {'id': 'id3'}]}
19
- expect(subject.unique_args([organization, entities_hash])).to eq([organization.id, [:entity_1, :entity_2]])
32
+ expect(subject.unique_args([organization.id, entities_hash])).to eq([organization.id, [:entity_1, :entity_2]])
20
33
  end
21
34
  end
22
35
  end
23
-
24
-
25
36
  end
26
37
 
@@ -26,19 +26,19 @@ describe Maestrano::Connector::Rails::Synchronization do
26
26
  end
27
27
 
28
28
  describe 'instance methods' do
29
- describe 'is_success?' do
30
- it { expect(Maestrano::Connector::Rails::Synchronization.new(status: 'SUCCESS').is_success?).to be(true) }
31
- it { expect(Maestrano::Connector::Rails::Synchronization.new(status: 'ERROR').is_success?).to be(false) }
29
+ describe 'success?' do
30
+ it { expect(Maestrano::Connector::Rails::Synchronization.new(status: 'SUCCESS').success?).to be(true) }
31
+ it { expect(Maestrano::Connector::Rails::Synchronization.new(status: 'ERROR').success?).to be(false) }
32
32
  end
33
33
 
34
- describe 'is_error?' do
35
- it { expect(Maestrano::Connector::Rails::Synchronization.new(status: 'ERROR').is_error?).to be(true) }
36
- it { expect(Maestrano::Connector::Rails::Synchronization.new(status: 'RUNNING').is_error?).to be(false) }
34
+ describe 'error?' do
35
+ it { expect(Maestrano::Connector::Rails::Synchronization.new(status: 'ERROR').error?).to be(true) }
36
+ it { expect(Maestrano::Connector::Rails::Synchronization.new(status: 'RUNNING').error?).to be(false) }
37
37
  end
38
38
 
39
- describe 'is_running?' do
40
- it { expect(Maestrano::Connector::Rails::Synchronization.new(status: 'RUNNING').is_running?).to be(true) }
41
- it { expect(Maestrano::Connector::Rails::Synchronization.new(status: 'ERROR').is_running?).to be(false) }
39
+ describe 'running?' do
40
+ it { expect(Maestrano::Connector::Rails::Synchronization.new(status: 'RUNNING').running?).to be(true) }
41
+ it { expect(Maestrano::Connector::Rails::Synchronization.new(status: 'ERROR').running?).to be(false) }
42
42
  end
43
43
 
44
44
  describe 'set_success' do
@@ -11,4 +11,4 @@ describe Maestrano::Connector::Rails::UserOrganizationRel do
11
11
  #Associations
12
12
  it { should belong_to(:user) }
13
13
  it { should belong_to(:organization) }
14
- end
14
+ end
@@ -33,29 +33,14 @@ if yes?("Use JRuby? [y/n]")
33
33
  run 'echo "ruby \'2.2.3\', :engine => \'jruby\', :engine_version => \'9.0.5.0\'" | cat - Gemfile > temp && mv temp Gemfile'
34
34
  end
35
35
 
36
- gem 'haml-rails'
37
- gem 'bootstrap-sass'
38
- gem 'autoprefixer-rails'
39
-
40
- gem 'rails', '4.2.4'
41
- gem 'turbolinks'
36
+ gem 'rails', '~> 4.2.6'
37
+ gem 'turbolinks', '~> 2.5'
42
38
  gem 'jquery-rails'
43
39
  gem 'puma'
44
- gem 'figaro'
45
40
  gem 'tzinfo-data', platforms: [:mingw, :mswin, :jruby]
46
41
  gem 'uglifier', '>= 1.3.0'
47
42
 
48
43
  gem 'maestrano-connector-rails'
49
- gem 'config'
50
- gem 'attr_encrypted', '~> 1.4.0'
51
-
52
- # Background jobs
53
- gem 'sinatra', :require => nil
54
- gem 'sidekiq'
55
- gem 'sidekiq-cron'
56
- # The missing unique jobs for sidekiq
57
- gem 'sidekiq-unique-jobs'
58
- gem 'slim'
59
44
 
60
45
  gem_group :production, :uat do
61
46
  gem 'activerecord-jdbcpostgresql-adapter', :platforms => :jruby
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maestrano-connector-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre Berard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-04 00:00:00.000000000 Z
11
+ date: 2016-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '4.0'
19
+ version: '4.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '4.0'
26
+ version: '4.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: maestrano-rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: sidekiq
56
+ name: haml-rails
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: sidekiq-unique-jobs
70
+ name: bootstrap-sass
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: haml-rails
84
+ name: autoprefixer-rails
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -95,7 +95,21 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: bootstrap-sass
98
+ name: attr_encrypted
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.4.0
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 1.4.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: config
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - ">="
@@ -109,7 +123,7 @@ dependencies:
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
- name: autoprefixer-rails
126
+ name: figaro
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
129
  - - ">="
@@ -123,21 +137,63 @@ dependencies:
123
137
  - !ruby/object:Gem::Version
124
138
  version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
- name: attr_encrypted
140
+ name: sidekiq
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
- - - "~>"
143
+ - - ">="
130
144
  - !ruby/object:Gem::Version
131
- version: 1.4.0
145
+ version: '0'
132
146
  type: :runtime
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
- - - "~>"
150
+ - - ">="
137
151
  - !ruby/object:Gem::Version
138
- version: 1.4.0
152
+ version: '0'
139
153
  - !ruby/object:Gem::Dependency
140
- name: config
154
+ name: sidekiq-unique-jobs
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: sinatra
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: sidekiq-cron
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: slim
141
197
  requirement: !ruby/object:Gem::Requirement
142
198
  requirements:
143
199
  - - ">="
@@ -276,6 +332,20 @@ dependencies:
276
332
  - - ">="
277
333
  - !ruby/object:Gem::Version
278
334
  version: '0'
335
+ - !ruby/object:Gem::Dependency
336
+ name: rubocop
337
+ requirement: !ruby/object:Gem::Requirement
338
+ requirements:
339
+ - - ">="
340
+ - !ruby/object:Gem::Version
341
+ version: '0'
342
+ type: :development
343
+ prerelease: false
344
+ version_requirements: !ruby/object:Gem::Requirement
345
+ requirements:
346
+ - - ">="
347
+ - !ruby/object:Gem::Version
348
+ version: '0'
279
349
  - !ruby/object:Gem::Dependency
280
350
  name: timecop
281
351
  requirement: !ruby/object:Gem::Requirement
@@ -301,6 +371,8 @@ extra_rdoc_files:
301
371
  - README.md
302
372
  files:
303
373
  - ".rspec"
374
+ - ".rubocop.yml"
375
+ - ".rubocop_todo.yml"
304
376
  - ".ruby-version"
305
377
  - CODESHIP.md
306
378
  - DEVELOPER.md
@@ -317,6 +389,7 @@ files:
317
389
  - app/controllers/maestrano/dependancies_controller.rb
318
390
  - app/controllers/maestrano/sessions_controller.rb
319
391
  - app/controllers/maestrano/synchronizations_controller.rb
392
+ - app/controllers/version_controller.rb
320
393
  - app/helpers/maestrano/connector/rails/session_helper.rb
321
394
  - app/jobs/maestrano/connector/rails/all_synchronizations_job.rb
322
395
  - app/jobs/maestrano/connector/rails/push_to_connec_job.rb
@@ -383,8 +456,8 @@ files:
383
456
  - lib/generators/connector/templates/synchronizations_controller.rb
384
457
  - lib/generators/connector/templates/synchronizations_controller_spec.rb
385
458
  - lib/generators/connector/templates/synchronizations_index.haml
386
- - lib/maestrano-connector-rails.rb
387
459
  - lib/maestrano/connector/rails.rb
460
+ - lib/maestrano_connector_rails.rb
388
461
  - maestrano-connector-rails.gemspec
389
462
  - maestrano.png
390
463
  - release_notes.md
@@ -393,6 +466,7 @@ files:
393
466
  - spec/controllers/group_users_controller_spec.rb
394
467
  - spec/controllers/groups_controller_spec.rb
395
468
  - spec/controllers/synchronizations_controller_spec.rb
469
+ - spec/controllers/version_controller_spec.rb
396
470
  - spec/dummy/README.md
397
471
  - spec/dummy/Rakefile
398
472
  - spec/dummy/app/assets/images/.keep
@@ -1 +0,0 @@
1
- require 'maestrano/connector/rails'