nestene 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: facb710eaed00cad18394e4f33e88e7415b4a011
4
- data.tar.gz: 1cf8975444de2dd5856fcf5a6b38184f8062ca23
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MTFkNDM5MzQ3Yzc5NjRhY2ZmNzMwZWFhMDdjMmNlYzU3N2I0ZTA3NQ==
5
+ data.tar.gz: !binary |-
6
+ NDliYzIzNTMwMjA2MWE3MWY4NTkxZWE2Njc2MTQ0ZWZiYTMzN2EyYg==
5
7
  SHA512:
6
- metadata.gz: 0e3cc0fd36d888de1aaa58206bc0d2fa5715035a6242a815664a242f79ff6b91e77e40690b0784e8feee0ad49a9b2905c541554673f609e1cdc525d17ad2f574
7
- data.tar.gz: 299a41329592441bf4808db484f81759b406911b73a960678ca394aa0fe7fc71973e4663ef0b2b24197574f8eb466d697ee91139671001a9d93b292ff3ebc04d
8
+ metadata.gz: !binary |-
9
+ NzNlODA0ODA4ZGRkNmU5MWEwMTg4NjNhYmY0OGFiMWIzNzA0ZGEwM2FjMGU0
10
+ ZmJkZGNiYmY3MTY0ODUwZTk3MmNlMjBkMjhkYjIwOTdmNDRhYjJlYzBjZTEx
11
+ NzgxYjlhMzJmMzBiNTZhYmM2MGViN2M3YmFmYzJhYTJmODRjMWQ=
12
+ data.tar.gz: !binary |-
13
+ MGIwZDUyMDg2MzE1MDBjNjNjYWI5OGQ1NGIwNzI2M2M5N2E0YzJlMDY0NTE5
14
+ MGNlODkzZTYwYWJkNzg3YTc2M2U2MjU5ZmJiZTA4MzllNGNmMmM2ZjQ5N2Ey
15
+ YjBiMTc4OTE0MDZlNjMxNTE4NTZkYjVhMjE3ZjQxZTNiMzdmMzQ=
data/TODO.txt CHANGED
@@ -1,4 +1,5 @@
1
1
  todo:
2
+ - List/Registry of available auton types
2
3
  - Create Auton with specific ID
3
4
  - Create Auton with wrong type -> error message
4
5
 
@@ -1,6 +1,5 @@
1
1
  Feature: Api Create Auton
2
2
 
3
- @wip
4
3
  Scenario:
5
4
  When request creation of an auton with an existing type
6
5
  Then the API should respond with status code 201 and auton's ID
@@ -0,0 +1,6 @@
1
+ Feature: list of auton types
2
+
3
+ Scenario: List of auton types
4
+ Given I have one auton
5
+ When I get the API list of auton types
6
+ Then result should contain the auton type
@@ -0,0 +1,20 @@
1
+ Given(/^I have one auton$/) do
2
+
3
+ class EmptyAuton
4
+ include StructureMapper::Hash
5
+
6
+ attribute foo: String
7
+ end
8
+ Nestene::Registry.register_auton(EmptyAuton)
9
+ end
10
+
11
+ When(/^I get the API list of auton types$/) do
12
+ get '/auton_types'
13
+ end
14
+
15
+ Then(/^result should contain the auton type$/) do
16
+ expect(last_response.status).to be(200)
17
+ response = JSON.parse(last_response.body)
18
+ expect(response).to include('EmptyAuton')
19
+
20
+ end
@@ -6,6 +6,10 @@ module Nestene
6
6
  module Ui
7
7
  class App < Sinatra::Base
8
8
 
9
+ get '/auton_types' do
10
+ content_type :json
11
+ Nestene::Registry.registered_autons.to_json
12
+ end
9
13
 
10
14
  get '/autons.json' do
11
15
  content_type :json
@@ -3,6 +3,10 @@ var window_location = window.location.pathname
3
3
 
4
4
  var nestene = angular.module('nestene', ['JSONedit']);
5
5
 
6
+ nestene.service('AutonTypes', function($http, $q) {
7
+ this.types = $http.get('/auton_types');
8
+ });
9
+
6
10
  nestene.controller('AutonsController', function($scope, $http, $timeout) {
7
11
  $scope.autons=[];
8
12
 
@@ -28,7 +32,7 @@ nestene.controller('AutonsController', function($scope, $http, $timeout) {
28
32
 
29
33
  });
30
34
 
31
- nestene.controller('CreateAutonFormController', function($scope,$http) {
35
+ nestene.controller('CreateAutonFormController', function($scope,$http, AutonTypes) {
32
36
  $scope.autonType = '';
33
37
  $scope.createAuton = function() {
34
38
  var postPromise = $http.post(window_location + "autons",{auton_type: $scope.autonType});
@@ -39,6 +43,12 @@ nestene.controller('CreateAutonFormController', function($scope,$http) {
39
43
  $.bootstrapGrowl("Could not create Auton: "+data['message'], { type: 'error' });
40
44
  });
41
45
  };
46
+ $scope.auton_types = [];
47
+ AutonTypes.types.success(function(data, status, headers, config) {
48
+ console.log('auton_types:' + data);
49
+ $scope.auton_types = data;
50
+ });
51
+
42
52
  });
43
53
 
44
54
  nestene.controller('CredentialsController', function($scope,$http) {
@@ -20,7 +20,9 @@
20
20
  %form{role: 'form'}
21
21
  .form-group
22
22
  %label{for: 'auton_type'} Auton Type
23
- %input#auton_type.form-control{type: 'text', placeholder: 'Type', 'ng-model' => 'autonType', 'required' => true}
23
+ %input#auton_type.form-control{type: 'text', placeholder: 'Type', 'ng-model' => 'autonType', 'required' => true, list: 'auton_types'}
24
+ %datalist#auton_types
25
+ %option{'ng-repeat' => 'option in auton_types', 'ng-value' => 'option'}
24
26
  %button#create.btn.btn-default{type: 'submit', 'ng-click' => 'createAuton()'}Create
25
27
  %div.tab-pane.fade#credentials{'ng-controller' => 'CredentialsController'}
26
28
  .panel.panel-default
@@ -1,3 +1,3 @@
1
1
  module Nestene
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
data/lib/nestene.rb CHANGED
@@ -19,6 +19,31 @@ require 'nestene/ui/app'
19
19
 
20
20
  module Nestene
21
21
 
22
+ class Registry
23
+
24
+ def self.register_auton(type)
25
+ @registered_autons ||= []
26
+ @registered_autons << type unless @registered_autons.include?(type)
27
+ end
28
+
29
+
30
+ def self.registered_autons
31
+ (@registered_autons || []).map(&:to_s)
32
+ end
33
+
34
+ end
35
+
36
+ class FooAuton
37
+ include StructureMapper::Hash
38
+
39
+ def do_foo
40
+ end
41
+
42
+ attribute foo: String
43
+ end
44
+
45
+ Registry.register_auton(FooAuton)
46
+
22
47
  class SelfValue
23
48
  def value
24
49
  self
metadata CHANGED
@@ -1,223 +1,223 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nestene
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dragan Milic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-19 00:00:00.000000000 Z
11
+ date: 2014-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.7'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: cucumber
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - ! '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - ! '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: pry
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - ! '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - ! '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: pry-debugger
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - ! '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - ! '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: timecop
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - ! '>='
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - ! '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: capybara
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - ! '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - ! '>='
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rack-test
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - ! '>='
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - ! '>='
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: poltergeist
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ">="
143
+ - - ! '>='
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ">="
150
+ - - ! '>='
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: sinatra
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ">="
157
+ - - ! '>='
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ">="
164
+ - - ! '>='
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: celluloid
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - ">="
171
+ - - ! '>='
172
172
  - !ruby/object:Gem::Version
173
173
  version: '0'
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - ">="
178
+ - - ! '>='
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: structure_mapper
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - ">="
185
+ - - ! '>='
186
186
  - !ruby/object:Gem::Version
187
187
  version: '0'
188
188
  type: :runtime
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
- - - ">="
192
+ - - ! '>='
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: haml
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
- - - ">="
199
+ - - ! '>='
200
200
  - !ruby/object:Gem::Version
201
201
  version: '0'
202
202
  type: :runtime
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
- - - ">="
206
+ - - ! '>='
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: puma
211
211
  requirement: !ruby/object:Gem::Requirement
212
212
  requirements:
213
- - - ">="
213
+ - - ! '>='
214
214
  - !ruby/object:Gem::Version
215
215
  version: '0'
216
216
  type: :runtime
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
- - - ">="
220
+ - - ! '>='
221
221
  - !ruby/object:Gem::Version
222
222
  version: '0'
223
223
  description: Nestene Automation Framework
@@ -228,8 +228,8 @@ executables:
228
228
  extensions: []
229
229
  extra_rdoc_files: []
230
230
  files:
231
- - ".gitignore"
232
- - ".rspec"
231
+ - .gitignore
232
+ - .rspec
233
233
  - Gemfile
234
234
  - LICENSE.txt
235
235
  - README.md
@@ -241,6 +241,7 @@ files:
241
241
  - config.ru
242
242
  - features/api/api_create_auton.feature
243
243
  - features/api/api_credentials.feature
244
+ - features/api/api_list_of_auton_types.feature
244
245
  - features/api/api_list_of_autons.feature
245
246
  - features/callback.feature
246
247
  - features/create_auton.feature
@@ -250,6 +251,7 @@ files:
250
251
  - features/schedule_steps.feature
251
252
  - features/step_definitions/api/api_create_auton_steps.rb
252
253
  - features/step_definitions/api/api_credentials_steps.rb
254
+ - features/step_definitions/api/api_list_of_auton_types_steps.rb
253
255
  - features/step_definitions/api/api_list_of_autons_steps.rb
254
256
  - features/step_definitions/callback_steps.rb
255
257
  - features/step_definitions/create_auton_steps.rb
@@ -323,12 +325,12 @@ require_paths:
323
325
  - lib
324
326
  required_ruby_version: !ruby/object:Gem::Requirement
325
327
  requirements:
326
- - - ">="
328
+ - - ! '>='
327
329
  - !ruby/object:Gem::Version
328
330
  version: '0'
329
331
  required_rubygems_version: !ruby/object:Gem::Requirement
330
332
  requirements:
331
- - - ">="
333
+ - - ! '>='
332
334
  - !ruby/object:Gem::Version
333
335
  version: '0'
334
336
  requirements: []
@@ -340,6 +342,7 @@ summary: Nestene Automation Framework
340
342
  test_files:
341
343
  - features/api/api_create_auton.feature
342
344
  - features/api/api_credentials.feature
345
+ - features/api/api_list_of_auton_types.feature
343
346
  - features/api/api_list_of_autons.feature
344
347
  - features/callback.feature
345
348
  - features/create_auton.feature
@@ -349,6 +352,7 @@ test_files:
349
352
  - features/schedule_steps.feature
350
353
  - features/step_definitions/api/api_create_auton_steps.rb
351
354
  - features/step_definitions/api/api_credentials_steps.rb
355
+ - features/step_definitions/api/api_list_of_auton_types_steps.rb
352
356
  - features/step_definitions/api/api_list_of_autons_steps.rb
353
357
  - features/step_definitions/callback_steps.rb
354
358
  - features/step_definitions/create_auton_steps.rb