lurker 0.6.8 → 0.6.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e604c784c2ea3ac2872a5317a5565894f0085fe
4
- data.tar.gz: a5d2eb6535c700fe1c0916062b2699b08697af59
3
+ metadata.gz: 9643afaa53257cb69053c126c15700b8d763332e
4
+ data.tar.gz: 54247852acb557093f2bde400adf1deffc8b6da9
5
5
  SHA512:
6
- metadata.gz: ad02702231dd5445dde644e0d98c81302d95d51f6d7e1f90379d942b9b6de03986adcea25a2196817fc817210442808d8244c13f08613ca95454b6fe534680d6
7
- data.tar.gz: 13c23cac89fea2961d911d7e5ccaf8d07186949ca57b79ce20571686db1a5a5dde2ebfe82df8562c7200ab01cdfeed63996ab256e1d4ec6b984bc14a538b00a9
6
+ metadata.gz: 79d5676e91e53272c072ca3ca2caf5b307cce5f82c299e1e61d6e7d0cfb9369f7ee8547f53607f8d6adf6b530fab63bbdd2099e7a14dfa8f6740dbb561598ca9
7
+ data.tar.gz: fababb8b949417a403726a0b8901fde3c48c9b600f3db35fc72e284f07f094af06fdc83627d00485d7fc62cb6b1d90322ba2a8094d44bf87221c05e96de34515
@@ -1,2 +1,2 @@
1
- �C��J�B�9m �~�ɾ�BA���)V@Q��B<��jʭ ��O��#�9j�#��M��� =U]�n�E4��9���
2
- �č�K�k��eM�t|������,lj2nD`_XH#4�K�>ؙ�� �������̻k1����8�35�`�v�Բ�k�HN�u�?t�u=�3*�_r�9�^����i�:j���5$��� ��:��SN�|�,Y��g�C�P�xF}}�����b�M� �D���
1
+ hs{}�֗�sn�{��#Hǥ$�B3��Ը�{8F2�O)���c�����6�� ��OvK���}*1���ߑ�཮u]�8�W��?L[��S��݌V]�!{�}�]��'J�DQ��=��%�J�� ��vD��R�y2g�Ϳ�2��Q`:Uig�Z�3����&5ʸ�=d�'�M��T|+�O><�)�]�~d����Ɯ�mx��'�܀�j���l
2
+ �������j��MLl،��x�gy_��mp0(
data.tar.gz.sig CHANGED
@@ -1,3 +1,2 @@
1
- UIu�>�D
2
- ����:D:�yCߋ��W�,[(���XZ��EKFD n��9����B%^�b����~�����X�w}~��Oj�J_h��
3
- :S^� ߋġ��ӭ?d"Y���U��9�YH��c5:���' O�x��m��\�D�EL�C�W����H�ۺ4�%`�#�O},+Q��po����r:�D�6N�q-�u�W��IKzt�k b��=5�Q��+���/���G>5�543ҹ���>��� ?�&hx2/b
1
+ t�. a�*���?�i��of���rdC���H��f�zXCf���c<8�?�P�%8`%��^f[
2
+ ���R=m~l*��ZJ����F���5u�_��,0�4���P�i�ЩG���S����8�k�5��x�c>� \�u�l��v��+\Ƿ��V l\�8����0����GFY����F��,��=+��T'j]` Xa�ƪ��41�P���<t���~i������PY���+�]MRؖS3�?/�
data/.hound.yml CHANGED
@@ -1,80 +1,6 @@
1
- AllCops:
2
- Exclude:
3
- - 'tmp/**/*'
4
- - 'templates/rails32_http_patch_support.rb'
1
+ ruby:
2
+ config_file: .rubocop.yml
5
3
 
6
- TrailingBlankLines:
7
- Enabled: false
8
-
9
- StringLiterals:
10
- Enabled: false
11
-
12
- SignalException:
13
- Enabled: false
14
-
15
- AlignParameters:
16
- Enabled: false
17
-
18
- MultilineTernaryOperator:
19
- Enabled: false
20
-
21
- LineLength:
22
- Enabled: false
23
-
24
- RedundantSelf:
25
- Enabled: false
26
-
27
- GuardClause:
28
- Enabled: false
29
-
30
- Next:
31
- Enabled: false
32
-
33
- SpaceAroundEqualsInParameterDefault:
34
- Enabled: false
35
-
36
- AssignmentInCondition:
37
- Enabled: false
38
-
39
- Documentation:
40
- Enabled: false
41
-
42
- HashSyntax:
43
- Enabled: false
44
-
45
- PercentLiteralDelimiters:
46
- Enabled: false
47
-
48
- UnneededPercentQ:
49
- Enabled: false
50
-
51
- Blocks:
52
- Enabled: false
53
-
54
- DoubleNegation:
55
- Enabled: false
56
-
57
- CaseEquality:
58
- Enabled: false
59
-
60
- SpecialGlobalVars:
61
- Enabled: false
62
-
63
- UnusedMethodArgument:
64
- Enabled: false
65
-
66
- UnusedBlockArgument:
67
- Enabled: false
68
-
69
- CollectionMethods:
70
- Enabled: false
71
-
72
- TrivialAccessors:
73
- Enabled: false
74
-
75
- IndentationWidth:
76
- Enabled: false
77
-
78
- IndentHash:
79
- Enabled: false
4
+ javascript:
5
+ config_file: .jshintrc
80
6
 
@@ -0,0 +1,33 @@
1
+ {
2
+ "asi": false,
3
+ "bitwise": true,
4
+ "browser": true,
5
+ "camelcase": true,
6
+ "curly": true,
7
+ "forin": true,
8
+ "immed": true,
9
+ "latedef": "nofunc",
10
+ "maxlen": 120,
11
+ "newcap": true,
12
+ "noarg": true,
13
+ "noempty": true,
14
+ "nonew": true,
15
+ "predef": [
16
+ "$",
17
+ "jQuery",
18
+
19
+ "jasmine",
20
+ "beforeEach",
21
+ "describe",
22
+ "expect",
23
+ "it",
24
+
25
+ "angular",
26
+ "inject",
27
+ "module"
28
+ ],
29
+ "quotmark": false,
30
+ "trailing": true,
31
+ "undef": true,
32
+ "unused": true
33
+ }
@@ -77,4 +77,3 @@ IndentationWidth:
77
77
 
78
78
  IndentHash:
79
79
  Enabled: false
80
-
data/Appraisals CHANGED
@@ -1,20 +1,28 @@
1
1
  appraise 'rails-32' do
2
2
  gem 'rails', '~> 3.2.21'
3
+ gem 'sprockets', '~> 2.2.2.backport2', github: 'razum2um/sprockets-2.2.2.backport', branch: 'master'
4
+ gem 'sass-rails', github: 'razum2um/sass-rails', branch: 'backport'
3
5
  eval ::File.read('Gemfile')
4
6
  end
5
7
 
6
8
  appraise 'rails-40' do
7
9
  gem 'rails', '~> 4.0.13'
10
+ gem 'sprockets'
11
+ gem 'sass-rails'
8
12
  eval ::File.read('Gemfile')
9
13
  end
10
14
 
11
15
  appraise 'rails-41' do
12
16
  gem 'rails', '~> 4.1.9'
17
+ gem 'sprockets'
18
+ gem 'sass-rails'
13
19
  eval ::File.read('Gemfile')
14
20
  end
15
21
 
16
22
  appraise 'rails-42' do
17
23
  gem 'rails', '~> 4.2.0'
24
+ gem 'sprockets'
25
+ gem 'sass-rails'
18
26
  eval ::File.read('Gemfile')
19
27
  end
20
28
 
data/Gemfile CHANGED
@@ -3,10 +3,11 @@ gemspec
3
3
 
4
4
  group :development do
5
5
  # tools
6
- gem 'pry-byebug', platforms: [:mri_20, :mri_21, :mri_22]
7
- gem 'pry-debugger', platforms: :mri_19
8
- gem 'pry-stack_explorer', platform: :mri
9
- gem 'pry-session', platform: :mri
6
+ platforms :mri_20, :mri_21, :mri_22 do
7
+ gem 'pry-byebug'
8
+ gem 'pry-stack_explorer'
9
+ gem 'pry-session'
10
+ end
10
11
  # rspec --format fuubar
11
12
  gem 'fuubar'
12
13
  # cucumber --format fuubar
@@ -18,14 +19,12 @@ group :development do
18
19
  # gem 'coderay', path: '../coderay'
19
20
 
20
21
  # multiple rails versions support
21
- gem 'appraisal', github: 'razum2um/appraisal', branch: 'master'
22
+ gem 'appraisal'
22
23
 
23
24
  # build template static
24
25
  # run `rake assets:precompile`
25
26
  # to get bundled application.(js|css)
26
- gem 'sprockets'
27
27
  gem 'uglifier'
28
- gem 'sass-rails'
29
28
  gem 'coffee-rails'
30
29
  gem 'bootstrap-sass', '~> 3.3.3'
31
30
  gem 'jquery-rails'
@@ -2,12 +2,25 @@ Feature: html generation
2
2
 
3
3
  Lurker generates pretty info pages based on schema information
4
4
  and form which allow you to test live api.
5
- When testing your api ensure that CSRF protection is handled properlya
5
+ When testing your api ensure that CSRF protection is handled properly
6
6
  with `protect_from_forgery :null_session`
7
7
 
8
8
  @javascript
9
9
  Scenario: json schema gets generated into html preview using "users/create"
10
10
  Given an empty directory named "public/lurker"
11
+ And a service file with:
12
+ """yml
13
+ ---
14
+ name: Lurker Demo Application
15
+ basePath: ''
16
+ description: ''
17
+ domains:
18
+ '[Sandbox] Heroku': 'http://lurker-app.herokuapp.com'
19
+ '[Real] razum2um.me': 'http://lurker.razum2um.me'
20
+ consumes:
21
+ - application/x-www-form-urlencoded
22
+ - application/json
23
+ """
11
24
  And a file named "lurker/api/v1/users-POST.json.yml" with:
12
25
  """yml
13
26
  ---
@@ -62,7 +75,7 @@ Feature: html generation
62
75
  And I fill in the submit form field "name" with "Jim"
63
76
  Then I should see:
64
77
  """
65
- curl -X POST -d "user%5Bname%5D=Jim"
78
+ curl -X POST -d 'user%5Bname%5D=Jim'
66
79
  """
67
80
 
68
81
  And I submit lurk form
@@ -74,3 +87,13 @@ Feature: html generation
74
87
 
75
88
  Then I should see JSON response with "can't be blank"
76
89
 
90
+ When I select "application/json" request media type
91
+ And I fill in the submit form field "name" with "Jim"
92
+ Then I should see:
93
+ """
94
+ curl -X POST -H 'Content-Type: application/json' -d '{"user":{"name":"Jim"}}'
95
+ """
96
+
97
+ And I submit lurk form
98
+
99
+ Then I should see JSON response with "Jim"
@@ -66,6 +66,6 @@ Feature: mutidomain support
66
66
  When I select "[Sandbox] Heroku" hostname
67
67
  Then I should see:
68
68
  """
69
- curl -X DELETE "http://lurker-app.herokuapp.com/api/v1/users/1"
69
+ curl -X DELETE 'http://lurker-app.herokuapp.com/api/v1/users/1'
70
70
  """
71
71
 
@@ -30,7 +30,14 @@ When /^I select "([^"]*)" hostname$/ do |host|
30
30
  end
31
31
  # FIXME: see multidomain feature - cannot select node in phantomjs
32
32
  page.execute_script("window.submitForm.setState({host: jQuery('#hostname').val()});")
33
- page.execute_script("window.submitForm.afterSetPartialState()")
33
+ end
34
+
35
+ When /^I select "([^"]*)" request media type$/ do |type|
36
+ within(:xpath, "//*[@id='requestMediaType']") do
37
+ select(type)
38
+ end
39
+ # FIXME: cannot select node in phantomjs
40
+ page.execute_script("window.submitForm.setState({requestMediaType: jQuery('#requestMediaType').val()});")
34
41
  end
35
42
 
36
43
  When(/^I fill in the submit form field "([^"]*)" with "([^"]*)"$/) do |field, name|
@@ -3,25 +3,27 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "rails", "~> 3.2.21"
6
+ gem "sprockets", "~> 2.2.2.backport2", :github => "razum2um/sprockets-2.2.2.backport", :branch => "master"
7
+ gem "sass-rails", :github => "razum2um/sass-rails", :branch => "backport"
6
8
 
7
9
  group :development do
8
- gem "pry-byebug", :platforms => [:mri_20, :mri_21, :mri_22]
9
- gem "pry-debugger", :platforms => :mri_19
10
- gem "pry-stack_explorer", :platform => :mri
11
- gem "pry-session", :platform => :mri
12
10
  gem "fuubar"
13
11
  gem "fuubar-cucumber"
14
12
  gem "selenium-webdriver"
15
13
  gem "highline"
16
- gem "appraisal", :github => "razum2um/appraisal", :branch => "master"
17
- gem "sprockets"
14
+ gem "appraisal"
18
15
  gem "uglifier"
19
- gem "sass-rails"
20
16
  gem "coffee-rails"
21
- gem "bootstrap-sass", "~> 3.3.3"
17
+ gem "bootstrap-sass"
22
18
  gem "jquery-rails"
23
19
  gem "remotipart"
24
20
  gem "launchy"
21
+
22
+ platforms :mri_20, :mri_21, :mri_22 do
23
+ gem "pry-byebug"
24
+ gem "pry-stack_explorer"
25
+ gem "pry-session"
26
+ end
25
27
  end
26
28
 
27
29
  gemspec :path => "../"
@@ -3,25 +3,27 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "rails", "~> 4.0.13"
6
+ gem "sprockets"
7
+ gem "sass-rails"
6
8
 
7
9
  group :development do
8
- gem "pry-byebug", :platforms => [:mri_20, :mri_21, :mri_22]
9
- gem "pry-debugger", :platforms => :mri_19
10
- gem "pry-stack_explorer", :platform => :mri
11
- gem "pry-session", :platform => :mri
12
10
  gem "fuubar"
13
11
  gem "fuubar-cucumber"
14
12
  gem "selenium-webdriver"
15
13
  gem "highline"
16
- gem "appraisal", :github => "razum2um/appraisal", :branch => "master"
17
- gem "sprockets"
14
+ gem "appraisal"
18
15
  gem "uglifier"
19
- gem "sass-rails"
20
16
  gem "coffee-rails"
21
- gem "bootstrap-sass", "~> 3.3.3"
17
+ gem "bootstrap-sass"
22
18
  gem "jquery-rails"
23
19
  gem "remotipart"
24
20
  gem "launchy"
21
+
22
+ platforms :mri_20, :mri_21, :mri_22 do
23
+ gem "pry-byebug"
24
+ gem "pry-stack_explorer"
25
+ gem "pry-session"
26
+ end
25
27
  end
26
28
 
27
29
  gemspec :path => "../"
@@ -3,25 +3,27 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "rails", "~> 4.1.9"
6
+ gem "sprockets"
7
+ gem "sass-rails"
6
8
 
7
9
  group :development do
8
- gem "pry-byebug", :platforms => [:mri_20, :mri_21, :mri_22]
9
- gem "pry-debugger", :platforms => :mri_19
10
- gem "pry-stack_explorer", :platform => :mri
11
- gem "pry-session", :platform => :mri
12
10
  gem "fuubar"
13
11
  gem "fuubar-cucumber"
14
12
  gem "selenium-webdriver"
15
13
  gem "highline"
16
- gem "appraisal", :github => "razum2um/appraisal", :branch => "master"
17
- gem "sprockets"
14
+ gem "appraisal"
18
15
  gem "uglifier"
19
- gem "sass-rails"
20
16
  gem "coffee-rails"
21
- gem "bootstrap-sass", "~> 3.3.3"
17
+ gem "bootstrap-sass"
22
18
  gem "jquery-rails"
23
19
  gem "remotipart"
24
20
  gem "launchy"
21
+
22
+ platforms :mri_20, :mri_21, :mri_22 do
23
+ gem "pry-byebug"
24
+ gem "pry-stack_explorer"
25
+ gem "pry-session"
26
+ end
25
27
  end
26
28
 
27
29
  gemspec :path => "../"
@@ -3,25 +3,27 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "rails", "~> 4.2.0"
6
+ gem "sprockets"
7
+ gem "sass-rails"
6
8
 
7
9
  group :development do
8
- gem "pry-byebug", :platforms => [:mri_20, :mri_21, :mri_22]
9
- gem "pry-debugger", :platforms => :mri_19
10
- gem "pry-stack_explorer", :platform => :mri
11
- gem "pry-session", :platform => :mri
12
10
  gem "fuubar"
13
11
  gem "fuubar-cucumber"
14
12
  gem "selenium-webdriver"
15
13
  gem "highline"
16
- gem "appraisal", :github => "razum2um/appraisal", :branch => "master"
17
- gem "sprockets"
14
+ gem "appraisal"
18
15
  gem "uglifier"
19
- gem "sass-rails"
20
16
  gem "coffee-rails"
21
- gem "bootstrap-sass", "~> 3.3.3"
17
+ gem "bootstrap-sass"
22
18
  gem "jquery-rails"
23
19
  gem "remotipart"
24
20
  gem "launchy"
21
+
22
+ platforms :mri_20, :mri_21, :mri_22 do
23
+ gem "pry-byebug"
24
+ gem "pry-stack_explorer"
25
+ gem "pry-session"
26
+ end
25
27
  end
26
28
 
27
29
  gemspec :path => "../"
@@ -11,55 +11,46 @@ module Lurker
11
11
 
12
12
  private
13
13
 
14
- def add_to_buffer(params, parent_labels = [])
15
- params.each do |label, value|
16
- if parent_labels.present?
17
- label = "[#{label}]"
18
- end
19
-
20
- new_parent_labels = parent_labels.clone << label
14
+ def add_to_buffer(params, parent_accessors = [])
15
+ params.each do |name, value|
21
16
 
17
+ accessors = parent_accessors.clone << name
22
18
  if value.is_a?(Hash)
23
- add_legend_to_buffer(parent_labels, label)
24
-
25
- add_to_buffer(value, new_parent_labels)
19
+ add_to_buffer(value, accessors)
26
20
  elsif value.is_a?(Array)
27
- value.each do |v|
21
+ value.each_with_index do |v, i|
28
22
  if v.is_a?(Hash)
29
- add_legend_to_buffer(parent_labels, label)
30
-
31
- add_to_buffer(v, parent_labels.clone << "#{label}[]")
23
+ add_to_buffer(v, accessors << i)
32
24
  else
33
- add_element_to_buffer(parent_labels, "#{label}[]", v)
25
+ add_element_to_buffer(accessors, v)
34
26
  end
35
27
  end
36
28
  else
37
- add_element_to_buffer(parent_labels, label, value)
29
+ add_element_to_buffer(accessors, value)
38
30
  end
39
31
  end
40
32
  end
41
33
 
42
- def add_element_to_buffer(parent_labels, label, value)
34
+ def add_element_to_buffer(accessors, value)
43
35
  @_buffer += render(
44
36
  :partial => 'param_form_element',
45
- :locals => {
46
- :label => "#{print_labels(parent_labels)}#{label}",
47
- :label_text => "#{print_labels(parent_labels)}#{label}",
48
- :value => value
37
+ :locals => {
38
+ :accessor => "#{accessors.compact.join('.')}",
39
+ :label => "#{print_labels(accessors)}",
40
+ :label_text => "#{print_labels(accessors)}",
41
+ :value => value
49
42
  }
50
43
  )
51
44
  end
52
45
 
53
- def add_legend_to_buffer(parent_labels, label)
54
- return
55
- @_buffer += render(
56
- :partial => 'param_form_legend',
57
- :locals => { :label => print_labels(parent_labels.clone << label) }
58
- )
59
- end
60
-
61
- def print_labels(parent_labels)
62
- "#{parent_labels * ''}"
46
+ def print_labels(accessors)
47
+ accessors.inject do |acc, label|
48
+ if label.is_a? Numeric
49
+ "#{acc}[]"
50
+ else
51
+ "#{acc}[#{label}]"
52
+ end
53
+ end
63
54
  end
64
55
  end
65
56
  end