agile-proxy-jruby 0.1.25-jruby

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +7 -0
  2. data/.bowerrc +3 -0
  3. data/.gitignore +10 -0
  4. data/.rspec +2 -0
  5. data/.rubocop.yml +36 -0
  6. data/.travis.yml +10 -0
  7. data/Gemfile +4 -0
  8. data/Guardfile +20 -0
  9. data/LICENSE +22 -0
  10. data/README.md +131 -0
  11. data/Rakefile +15 -0
  12. data/agile-proxy.gemspec +60 -0
  13. data/assets/index.html +39 -0
  14. data/assets/ui/app/AgileProxyApi.js +31 -0
  15. data/assets/ui/app/app.js +1 -0
  16. data/assets/ui/app/controller/Stubs.js +64 -0
  17. data/assets/ui/app/controller/main.js +12 -0
  18. data/assets/ui/app/directive/AppEnhancedFormElement.js +21 -0
  19. data/assets/ui/app/directive/AppFor.js +16 -0
  20. data/assets/ui/app/directive/AppResponseEditor.js +54 -0
  21. data/assets/ui/app/model/RequestSpec.js +6 -0
  22. data/assets/ui/app/routes.js +11 -0
  23. data/assets/ui/app/service/Dialog.js +49 -0
  24. data/assets/ui/app/service/DomId.js +10 -0
  25. data/assets/ui/app/service/Error.js +7 -0
  26. data/assets/ui/app/service/Stub.js +36 -0
  27. data/assets/ui/app/view/404.html +2 -0
  28. data/assets/ui/app/view/dialog/error.html +10 -0
  29. data/assets/ui/app/view/dialog/yesNo.html +8 -0
  30. data/assets/ui/app/view/responses/editForm.html +78 -0
  31. data/assets/ui/app/view/status.html +1 -0
  32. data/assets/ui/app/view/stubs.html +19 -0
  33. data/assets/ui/app/view/stubs/edit.html +58 -0
  34. data/assets/ui/css/main.css +3 -0
  35. data/bin/agile_proxy +4 -0
  36. data/bower.json +27 -0
  37. data/config.yml +6 -0
  38. data/db.yml +10 -0
  39. data/db/migrations/20140818110800_create_users.rb +9 -0
  40. data/db/migrations/20140818134700_create_applications.rb +10 -0
  41. data/db/migrations/20140818135200_create_request_specs.rb +13 -0
  42. data/db/migrations/20140821115300_create_responses.rb +14 -0
  43. data/db/migrations/20140823082900_add_method_to_request_specs.rb +7 -0
  44. data/db/migrations/20140823083900_rename_request_spec_columns.rb +8 -0
  45. data/db/migrations/20141031072100_add_url_type_to_request_specs.rb +8 -0
  46. data/db/migrations/20141105125600_add_conditions_to_request_specs.rb +7 -0
  47. data/db/migrations/20141106083100_add_username_and_password_to_applications.rb +8 -0
  48. data/db/migrations/20141119143800_add_record_to_applications.rb +7 -0
  49. data/db/migrations/20141119174300_create_recordings.rb +18 -0
  50. data/db/migrations/20150221152500_add_record_requests_to_request_specs.rb +7 -0
  51. data/db/schema.rb +78 -0
  52. data/db/seed.rb +26 -0
  53. data/echo_server.rb +19 -0
  54. data/examples/README.md +1 -0
  55. data/examples/facebook_api.html +59 -0
  56. data/examples/tumblr_api.html +22 -0
  57. data/lib/agile_proxy.rb +8 -0
  58. data/lib/agile_proxy/api/applications.rb +77 -0
  59. data/lib/agile_proxy/api/recordings.rb +52 -0
  60. data/lib/agile_proxy/api/request_spec_recordings.rb +52 -0
  61. data/lib/agile_proxy/api/request_specs.rb +86 -0
  62. data/lib/agile_proxy/api/root.rb +45 -0
  63. data/lib/agile_proxy/cli.rb +116 -0
  64. data/lib/agile_proxy/config.rb +66 -0
  65. data/lib/agile_proxy/handlers/handler.rb +43 -0
  66. data/lib/agile_proxy/handlers/proxy_handler.rb +111 -0
  67. data/lib/agile_proxy/handlers/request_handler.rb +75 -0
  68. data/lib/agile_proxy/handlers/stub_handler.rb +146 -0
  69. data/lib/agile_proxy/mitm.crt +22 -0
  70. data/lib/agile_proxy/mitm.key +27 -0
  71. data/lib/agile_proxy/model/application.rb +20 -0
  72. data/lib/agile_proxy/model/recording.rb +17 -0
  73. data/lib/agile_proxy/model/request_spec.rb +48 -0
  74. data/lib/agile_proxy/model/response.rb +51 -0
  75. data/lib/agile_proxy/model/user.rb +17 -0
  76. data/lib/agile_proxy/proxy_connection.rb +112 -0
  77. data/lib/agile_proxy/rack/get_only_cache.rb +30 -0
  78. data/lib/agile_proxy/route.rb +106 -0
  79. data/lib/agile_proxy/router.rb +99 -0
  80. data/lib/agile_proxy/server.rb +119 -0
  81. data/lib/agile_proxy/servers/api.rb +40 -0
  82. data/lib/agile_proxy/servers/request_spec.rb +40 -0
  83. data/lib/agile_proxy/servers/request_spec_direct.rb +35 -0
  84. data/lib/agile_proxy/version.rb +6 -0
  85. data/load_proxy.js +39 -0
  86. data/log/.gitkeep +0 -0
  87. data/spec/common_helper.rb +32 -0
  88. data/spec/fixtures/example_static_file.html +1 -0
  89. data/spec/fixtures/test-server.crt +15 -0
  90. data/spec/fixtures/test-server.key +15 -0
  91. data/spec/integration/helpers/request_spec_helper.rb +84 -0
  92. data/spec/integration/specs/lib/server_spec.rb +474 -0
  93. data/spec/integration_spec_helper.rb +16 -0
  94. data/spec/spec_helper.rb +39 -0
  95. data/spec/support/test_server.rb +105 -0
  96. data/spec/unit/agile_proxy/api/applications_spec.rb +102 -0
  97. data/spec/unit/agile_proxy/api/common_helper.rb +31 -0
  98. data/spec/unit/agile_proxy/api/recordings_spec.rb +115 -0
  99. data/spec/unit/agile_proxy/api/request_spec_recordings_spec.rb +119 -0
  100. data/spec/unit/agile_proxy/api/request_specs_spec.rb +159 -0
  101. data/spec/unit/agile_proxy/handlers/handler_spec.rb +8 -0
  102. data/spec/unit/agile_proxy/handlers/proxy_handler_spec.rb +138 -0
  103. data/spec/unit/agile_proxy/handlers/request_handler_spec.rb +76 -0
  104. data/spec/unit/agile_proxy/handlers/stub_handler_spec.rb +177 -0
  105. data/spec/unit/agile_proxy/model/recording_spec.rb +0 -0
  106. data/spec/unit/agile_proxy/model/request_spec_spec.rb +45 -0
  107. data/spec/unit/agile_proxy/model/response_spec.rb +38 -0
  108. data/spec/unit/agile_proxy/server_spec.rb +91 -0
  109. data/spec/unit/agile_proxy/servers/api_spec.rb +35 -0
  110. data/spec/unit/agile_proxy/servers/request_spec_direct_spec.rb +51 -0
  111. data/spec/unit/agile_proxy/servers/request_spec_spec.rb +35 -0
  112. metadata +736 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 15926e8c2229e6d48005ff1c7196558359b5fe69
4
+ data.tar.gz: ab1f1ad24f3f00219c3035a70901f4d8f94270ea
5
+ SHA512:
6
+ metadata.gz: 801ae9e3cee2fd6cc108b853bf1f0696f7acb067356f9629975408623f3d5a66823491571996dde5e8a86e2b9aa39f4d9b5d0a6b3a469a3802b77977727d88a4
7
+ data.tar.gz: 029dc8adb94c4c3f8f07572a60f08f409521d72c31ce1dafebb4456e3e951ea742257f4d90f0a0c185c027f63225b6b0b250d6dcbcaa473d0b287ac42273b358
@@ -0,0 +1,3 @@
1
+ {
2
+ "directory" : "assets/ui/bower_components"
3
+ }
@@ -0,0 +1,10 @@
1
+ node_modules/
2
+ log/test.log
3
+ .idea/
4
+ .ruby-version
5
+ assets/ui/bower_components
6
+ .yardoc
7
+ db/*.db
8
+ coverage/
9
+ Gemfile.lock
10
+ vendor/gems
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
@@ -0,0 +1,36 @@
1
+ AllCops:
2
+ Exclude:
3
+ - 'db/**/*'
4
+ - 'assets/**/*'
5
+ - !ruby/regexp /old_and_unused\.rb$/
6
+ Style/Documentation:
7
+ Exclude:
8
+ - 'spec/**/*'
9
+ - 'bin/**/*'
10
+ Metrics/AbcSize:
11
+ Max: 36
12
+ Exclude:
13
+ - 'spec/**/*'
14
+ Metrics/CyclomaticComplexity:
15
+ Max: 5
16
+ Enabled: false
17
+ Metrics/LineLength:
18
+ Max: 125
19
+ Exclude:
20
+ - 'spec/**/*'
21
+ - 'agile-proxy.gemspec'
22
+ - 'Guardfile'
23
+ Metrics/MethodLength:
24
+ Max: 30
25
+ Exclude:
26
+ - 'spec/**/*'
27
+ Metrics/PerceivedComplexity:
28
+ Max: 7
29
+ Exclude:
30
+ - 'spec/**/*'
31
+ Style/TrivialAccessors:
32
+ Enabled: false
33
+ Style/SpecialGlobalVars:
34
+ Enabled: false
35
+ Style/RegexpLiteral:
36
+ Enabled: false
@@ -0,0 +1,10 @@
1
+ language: ruby
2
+ cache: false
3
+ rvm:
4
+ - 1.9.3
5
+ - 2.0.0
6
+ - 2.1.0
7
+ script:
8
+ - bundle exec rake db:migrate ENV=test
9
+ - bundle exec rspec spec/unit
10
+ - bundle exec rspec spec/integration
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in agile-proxy.gemspec
4
+ gemspec
@@ -0,0 +1,20 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'rspec', version: 2 do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { 'spec' }
8
+
9
+ # Rails example
10
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
11
+ watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
12
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
13
+ watch(%r{^spec/support/(.+)\.rb$}) { 'spec' }
14
+ watch('config/routes.rb') { 'spec/routing' }
15
+ watch('app/controllers/application_controller.rb') { 'spec/controllers' }
16
+
17
+ # Turnip features and steps
18
+ watch(%r{^spec/acceptance/(.+)\.feature$})
19
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
20
+ end
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Olly Smith
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.
@@ -0,0 +1,131 @@
1
+ [![Build Status](https://travis-ci.org/garytaylor/agileproxy.svg?branch=master)](https://travis-ci.org/garytaylor/agileproxy)
2
+ [![Gem Version](https://badge.fury.io/rb/agile-proxy.svg)](http://badge.fury.io/rb/agile-proxy)
3
+ # agile-proxy
4
+
5
+ A proxy server intended for use during development or in integration test environments such as selenium.
6
+
7
+ Either the developer or the test suite can constantly change the response from a particular 'route' or URL via
8
+ either the built in user interface or using REST calls. An adapter is currently written for nodejs to provide easy
9
+ access to the REST interface - others are to follow.
10
+
11
+ So, you may be used to being able to stub methods in your unit tests, you can now stub http requests in your integration
12
+ tests too. It doesn't matter if you are using ruby, nodejs, java, scala ... the list goes on. As long as your 'HTTP Client'
13
+ (whether its a browser, or some form of programatic access to HTTP) supports a proxy, then you can use this.
14
+
15
+ This has many uses, the main one that I currently use this for is for developing a user interface when the server side
16
+ code is either a work in progress or not developed yet.
17
+ Even if you are not into writing integration tests for your UI layer and prefer to just write code and test manually
18
+ (which of course I do not recommend, but some people like working that way), then you can go to the user interface
19
+ and simply tell the system what you want your fake server to look like -
20
+
21
+ for example :- "When anything requests http://www.bing.com" then return "A fake bing page".
22
+
23
+ A particularly poor example, but hopefully demonstrates the idea.
24
+
25
+ ## Overview
26
+
27
+ The proxy sits between the client (maybe a browser) and the server. You can either configure the browser manually to do so
28
+ or via the selenium API if you are writing an integration test using selenium.
29
+ Requests can simply pass through, or be intercepted in some way.
30
+ By default, all requests pass through untouched.
31
+ The magic then happens when the developer informs the proxy how to respond to various requests. This
32
+ can either be done using a JSON API or using the Web Based User Interface.
33
+
34
+ Requests are matched either exactly (for example 'http://www.google.com'), or using router pattern matching
35
+ (similar to rails or other MVC frameworks).
36
+
37
+ Response bodies can be set along with any header values, status code etc..
38
+
39
+ Client drivers are available for the following languages :-
40
+
41
+ ruby
42
+ javascript (node.js)
43
+
44
+ And will soon be available for :-
45
+
46
+ javascript (browser based)
47
+ java
48
+ scala
49
+ python
50
+
51
+ ## Example Client Code
52
+ To any puffing-billy users, this will look familiar as this project is inspired by puffing-billy.
53
+
54
+ ```ruby
55
+ it 'should stub google' do
56
+ proxy.stub('http://www.google.com/').and_return(:text => "I'm not Google!")
57
+ visit 'http://www.google.com/'
58
+ page.should have_content("I'm not Google!")
59
+ end
60
+ ```
61
+ ## Support
62
+
63
+ To discuss issues, goto https://groups.google.com/forum/#!forum/agileproxygem
64
+
65
+ Or, if you have an issue that you want to report - please use the issues list in this repository
66
+
67
+ ## Installation
68
+
69
+ $ gem install agile-proxy
70
+
71
+ Thats it - all done.
72
+
73
+ ## Starting the server
74
+
75
+ agile_proxy start 3100
76
+
77
+ This will start the server with default options on port 3100
78
+
79
+ ## Using The Built In User Interface
80
+
81
+ Goto http://localhost:3020 in your browser
82
+
83
+ ## Configuring a browser to use the proxy
84
+
85
+ The proxy url for the default application is
86
+
87
+ http://public-app-1:password@localhost:3100
88
+
89
+ ## Contributing
90
+
91
+ 1. Fork it
92
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
93
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
94
+ 4. Push to the branch (`git push origin my-new-feature`)
95
+ 5. Create new Pull Request
96
+
97
+ ## TODO
98
+
99
+ 1. Asserting requests were made to specific urls and that they contained the correct parameters
100
+ 2. Route matching on URL parameters from the query string
101
+ 3. Multi Application - The current infrastructure supports it, just need UI support - can already be done using REST
102
+
103
+ ## History
104
+ v0.1.8 Added support for plain text params parser - As DWR uses this (and maybe others)
105
+
106
+ v0.1.9 Plain text params parser bug fixed - now handles params with a key and no value
107
+
108
+ v0.1.10 Now using dependent: :destroy to tidy up better when all specs for an application are deleted (common occurence)
109
+
110
+ v0.1.11 Further improved database tidy up.
111
+ AGILE_PROXY_ENV can now set the environment at server startup
112
+ conditions handling improved in routing
113
+
114
+ v0.1.12 Added a 'Direct' server which is a simple HTTP server that response to the stubs - also allows
115
+ for static dirs to be hosted.
116
+
117
+ v0.1.13 Upgraded activerecord and other gems to later versions
118
+
119
+ v0.1.14 - Increased pagination size by default to 50 on stubs until I add the client side code
120
+ v0.1.15 - 0.1.17 - No functionality change, these were just to try and please travis
121
+ v0.1.18 - Fixed issue with integration test which was showing up now that travis is working again
122
+ v0.1.19 - Recordings now record the request spec id.
123
+ Recordings can now be accessed via /request_specs/:request_spec_id/recordings to provide recordings specific to the request spec
124
+ v0.1.20 - An individual request spec can now be set to 'record_requests' rather than requiring the whole application to be in record mode which slows down every request
125
+ v0.1.21 - Switched to goliath instead of thin. The gem now installs under jruby as well as other platforms.
126
+ v0.1.22 - Reverted 0.1.21 - Integration tests worked fine, but failed in real world scenario - never ending responses from stubs
127
+ v0.1.23 - Switched to goliath instead of thin. The gem now installs under jruby as well as other platforms.
128
+ v0.1.24 - Added caching
129
+ v0.1.25 - Caching now disabled by default but enabled in config.
130
+ Direct server now functional
131
+
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env rake
2
+ require 'bundler/gem_tasks'
3
+ require 'active_record'
4
+ require_relative 'db/seed'
5
+ include ActiveRecord::Tasks
6
+ DatabaseTasks.database_configuration = YAML.load_file('config.yml')
7
+ DatabaseTasks.db_dir = 'db'
8
+ DatabaseTasks.migrations_paths = 'db/migrations'
9
+ DatabaseTasks.env = ENV['ENV'] || 'development'
10
+ DatabaseTasks.seed_loader = AgileProxy::Seed
11
+ ActiveRecord::Base.establish_connection(DatabaseTasks.database_configuration[DatabaseTasks.env])
12
+ DatabaseTasks.root = File.dirname(__FILE__)
13
+ Rake::Task.define_task(:environment)
14
+ # other settings...
15
+ load 'active_record/railties/databases.rake'
@@ -0,0 +1,60 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/agile_proxy/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ['Gary Taylor']
6
+ gem.email = ['gary.taylor@hismessages.com']
7
+ gem.description = 'An agile, programmable, controllable proxy server for use standalone or as part of an integration test suite with clients for many languages'
8
+ gem.summary = 'An agile, programmable, controllable flexible proxy server for development or test use'
9
+ gem.homepage = 'https://github.com/garytaylor/agileproxy'
10
+
11
+ gem.files = `git ls-files`.split($\).concat(Dir.glob 'assets/ui/bower_components/**/*')
12
+ gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = RUBY_PLATFORM =~ /java/ ? 'agile-proxy-jruby' : 'agile-proxy'
15
+ gem.require_paths = ['lib']
16
+ gem.version = AgileProxy::VERSION
17
+ if RUBY_PLATFORM =~ /java/
18
+ gem.platform = 'jruby'
19
+ end
20
+
21
+ gem.add_development_dependency 'rake', '~> 0'
22
+ gem.add_development_dependency 'rspec', '~> 3.1', '>= 3.1.0'
23
+ gem.add_development_dependency 'rspec-mocks', '~> 3.1', '>= 3.1.3'
24
+ gem.add_development_dependency 'faraday', '~> 0.9', '>= 0.9.0'
25
+ gem.add_development_dependency 'poltergeist', '~> 1.5', '>= 1.5.1'
26
+ gem.add_development_dependency 'selenium-webdriver', '~> 2.43', '>= 2.43.0'
27
+ gem.add_development_dependency 'guard', '~> 2.6', '>= 2.6.1'
28
+ gem.add_development_dependency 'rb-inotify', '~> 0.9', '>= 0.9.5'
29
+ gem.add_development_dependency 'cucumber', '~> 1.3', '>= 1.3.17'
30
+ gem.add_development_dependency 'rest-client', '~> 1.7', '>= 1.7.2'
31
+ gem.add_development_dependency 'require_all', '~> 1.3', '>= 1.3.2'
32
+ gem.add_development_dependency 'faker', '~> 1.2', '>= 1.2.0'
33
+ gem.add_development_dependency 'yard', '~> 0.8', '>= 0.8'
34
+ gem.add_development_dependency 'simplecov', '~> 0.9', '>= 0.9.1'
35
+ gem.add_development_dependency 'travis', '~> 1.7', '>= 1.7.5'
36
+ gem.add_runtime_dependency 'eventmachine', '~> 1.0', '>= 1.0.3'
37
+ gem.add_runtime_dependency 'em-synchrony', '~> 1.0', '>= 1.0.3'
38
+ gem.add_runtime_dependency 'em-http-request', '~> 1.1', '>= 1.1.2'
39
+ gem.add_runtime_dependency 'grape', '~> 0.10', '>= 0.10.1'
40
+ gem.add_runtime_dependency 'activerecord', '~> 4.2', '>= 4.2.0'
41
+ if RUBY_PLATFORM =~ /java/
42
+ #JVM Only
43
+ gem.add_runtime_dependency 'activerecord-jdbc-adapter'
44
+ gem.add_runtime_dependency 'activerecord-jdbcsqlite3-adapter'
45
+ else
46
+ #Non JVM
47
+ gem.add_runtime_dependency 'sqlite3', '~> 1.3', '>= 1.3.10'
48
+ end
49
+
50
+
51
+
52
+ gem.add_runtime_dependency 'grape-kaminari', '~> 0.1', '>= 0.1.7'
53
+ gem.add_runtime_dependency 'shoulda-matchers', '2.8.0.rc2'
54
+ gem.add_runtime_dependency 'flavour_saver', '~> 0.3', '>= 0.3.4'
55
+ gem.add_runtime_dependency 'thor', '~> 0.19', '>= 0.19.1'
56
+ gem.add_runtime_dependency 'goliath', '~> 1.0', '>= 1.0.4'
57
+ gem.add_runtime_dependency 'rack-cache', '~> 1.2', '>= 1.2'
58
+ gem.add_runtime_dependency 'goliath-proxy', '~> 0.0', '>= 0.0.1'
59
+
60
+ end
@@ -0,0 +1,39 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <script src="ui/bower_components/jquery/dist/jquery.js"></script>
5
+ <script src="ui/bower_components/ace-builds/src-min-noconflict/ace.js"></script>
6
+ <script src="ui/bower_components/angular/angular.js"></script>
7
+ <script src="ui/bower_components/angular-bootstrap/ui-bootstrap.js"></script>
8
+ <script src="ui/bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
9
+ <script src="ui/bower_components/angular-ui-ace/ui-ace.js"></script>
10
+ <script src="ui/app/app.js"></script>
11
+ <script src="ui/app/model/RequestSpec.js"></script>
12
+ <script src="ui/app/controller/main.js"></script>
13
+ <script src="ui/app/controller/Stubs.js"></script>
14
+ <script src="ui/app/service/Dialog.js"></script>
15
+ <script src="ui/app/service/Stub.js"></script>
16
+ <script src="ui/app/service/DomId.js"></script>
17
+ <script src="ui/app/service/Error.js"></script>
18
+ <script src="ui/app/directive/AppEnhancedFormElement.js"></script>
19
+ <script src="ui/app/directive/AppResponseEditor.js"></script>
20
+ <script src="ui/app/directive/AppFor.js"></script>
21
+ <script src="ui/app/routes.js"></script>
22
+ <script src="ui/bower_components/angular-route/angular-route.js"></script>
23
+ <script src="ui/bower_components/angular-resource/angular-resource.js"></script>
24
+ <script src="ui/bower_components/angular-restmod/dist/angular-restmod-bundle.js"></script>
25
+ <script src="ui/app/AgileProxyApi.js"></script>
26
+ <link rel="stylesheet" href="ui/bower_components/bootstrap/dist/css/bootstrap.css" />
27
+ <link rel="stylesheet" href="ui/bower_components/bootstrap/dist/css/bootstrap-theme.css" />
28
+ <link rel="stylesheet" href="ui/css/main.css" />
29
+ </head>
30
+ <body ng-app="AgileProxy" class="container-fluid">
31
+ <div class="navbar navbar-inverse">
32
+ <a href="#status" class="navbar-brand">Status</a>
33
+ <a href="#stubs" class="navbar-brand">Stubs</a>
34
+ </div>
35
+ <div>
36
+ <ng-view></ng-view>
37
+ </div>
38
+ </body>
39
+ </html>
@@ -0,0 +1,31 @@
1
+ /**
2
+ * API Bound Models for AngularJS
3
+ * @version v1.1.3 - 2014-09-25
4
+ * @link https://github.com/angular-platanus/restmod
5
+ * @author Ignacio Baixas <ignacio@platan.us>
6
+ * @license MIT License, http://www.opensource.org/licenses/MIT
7
+ */
8
+
9
+ (function(angular, undefined) {
10
+ 'use strict';
11
+
12
+ angular.module('restmod').factory('AgileProxyApi', ['restmod', 'inflector', function(restmod, inflector) {
13
+
14
+ return restmod.mixin('DefaultPacker', { // include default packer extension
15
+ $config: {
16
+ style: 'AMS',
17
+ primaryKey: 'id',
18
+ jsonMeta: 'meta',
19
+ jsonLinks: 'links'
20
+ },
21
+
22
+ $extend: {
23
+ // special snakecase to camelcase renaming
24
+ Model: {
25
+ decodeName: inflector.camelize,
26
+ encodeName: function(_v) { return inflector.parameterize(_v, '_'); }
27
+ }
28
+ }
29
+ });
30
+
31
+ }]);})(angular);
@@ -0,0 +1 @@
1
+ angular.module('AgileProxy', ['ui.bootstrap', 'ngRoute', 'ngResource', 'restmod', 'ui.ace']);
@@ -0,0 +1,64 @@
1
+ angular.module('AgileProxy').controller('StubsCtrl', function ($resource, $scope, DialogService, StubService, RequestSpecModel, ErrorService) {
2
+ var selection;
3
+ $scope.selection = {};
4
+ $scope.selectionCount = 0;
5
+ angular.extend($scope, {
6
+ editStub: function (stub) {
7
+ StubService.editStub(stub, $scope).then(function (obj) {
8
+ obj.stub.$save().$then(function (stub) {
9
+ obj.close();
10
+ },
11
+ function (response) {
12
+ ErrorService.serverError(response);
13
+ }
14
+ )
15
+ });
16
+ },
17
+ deleteStub: function (stub) {
18
+ DialogService.yesNo('Delete this stub ?').then(function (response) {
19
+ stub.$destroy({id: stub.id});
20
+ });
21
+ },
22
+ addStub: function () {
23
+ StubService.addStub($scope).then(function(obj) {
24
+ obj.stub.$save().$then(function (stub) {
25
+ obj.close();
26
+ },
27
+ function (response) {
28
+ ErrorService.serverError(response);
29
+ }
30
+ );
31
+ });
32
+ },
33
+ updateSelection: function (stub) {
34
+ if (stub.$isSelected) {
35
+ $scope.addToSelection(stub);
36
+ } else {
37
+ $scope.removeFromSelection(stub);
38
+ }
39
+ },
40
+ addToSelection: function (stub) {
41
+ $scope.selection[stub.id] = true;
42
+ $scope.onSelectionChange();
43
+ },
44
+ removeFromSelection: function (stub) {
45
+ delete $scope.selection[stub.id];
46
+ $scope.onSelectionChange();
47
+ },
48
+ deleteSelection: function () {
49
+ var s;
50
+ s = $scope.selection;
51
+ debugger;
52
+
53
+ },
54
+ onSelectionChange: function () {
55
+ $scope.selectionCount = Object.keys($scope.selection).length;
56
+ },
57
+ emptySelection: function () {
58
+
59
+ }
60
+ });
61
+ $scope.requestSpecs = RequestSpecModel.$collection({});
62
+ $scope.requestSpecs.$refresh()
63
+
64
+ });