git_wit 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +82 -0
  3. data/Rakefile +40 -0
  4. data/app/controllers/git_wit/application_controller.rb +6 -0
  5. data/app/controllers/git_wit/git_controller.rb +116 -0
  6. data/bin/gw-shell +4 -0
  7. data/config/initializers/git_wit.rb +2 -0
  8. data/config/routes.rb +5 -0
  9. data/lib/generators/git_wit/install/USAGE +8 -0
  10. data/lib/generators/git_wit/install/install_generator.rb +15 -0
  11. data/lib/generators/git_wit/templates/README +11 -0
  12. data/lib/generators/git_wit/templates/git_wit.rb +78 -0
  13. data/lib/git_wit/auth.rb +28 -0
  14. data/lib/git_wit/authorized_keys.rb +102 -0
  15. data/lib/git_wit/engine.rb +12 -0
  16. data/lib/git_wit/errors.rb +6 -0
  17. data/lib/git_wit/shell.rb +72 -0
  18. data/lib/git_wit/version.rb +3 -0
  19. data/lib/git_wit.rb +38 -0
  20. data/test/dummy/README.rdoc +261 -0
  21. data/test/dummy/Rakefile +7 -0
  22. data/test/dummy/app/assets/javascripts/application.js +16 -0
  23. data/test/dummy/app/assets/javascripts/bootstrap.js +5 -0
  24. data/test/dummy/app/assets/javascripts/public_keys.js +2 -0
  25. data/test/dummy/app/assets/javascripts/repositories.js +2 -0
  26. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  27. data/test/dummy/app/assets/stylesheets/bootstrap_and_overrides.css +12 -0
  28. data/test/dummy/app/assets/stylesheets/public_keys.css +4 -0
  29. data/test/dummy/app/assets/stylesheets/repositories.css +4 -0
  30. data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
  31. data/test/dummy/app/controllers/application_controller.rb +3 -0
  32. data/test/dummy/app/controllers/public_keys_controller.rb +61 -0
  33. data/test/dummy/app/controllers/repositories_controller.rb +76 -0
  34. data/test/dummy/app/helpers/application_helper.rb +2 -0
  35. data/test/dummy/app/helpers/public_keys_helper.rb +2 -0
  36. data/test/dummy/app/helpers/repositories_helper.rb +2 -0
  37. data/test/dummy/app/models/ability.rb +16 -0
  38. data/test/dummy/app/models/public_key.rb +46 -0
  39. data/test/dummy/app/models/repository.rb +27 -0
  40. data/test/dummy/app/models/role.rb +6 -0
  41. data/test/dummy/app/models/user.rb +14 -0
  42. data/test/dummy/app/views/devise/confirmations/new.html.erb +22 -0
  43. data/test/dummy/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  44. data/test/dummy/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  45. data/test/dummy/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  46. data/test/dummy/app/views/devise/passwords/edit.html.erb +30 -0
  47. data/test/dummy/app/views/devise/passwords/new.html.erb +22 -0
  48. data/test/dummy/app/views/devise/registrations/edit.html.erb +50 -0
  49. data/test/dummy/app/views/devise/registrations/new.html.erb +43 -0
  50. data/test/dummy/app/views/devise/sessions/new.html.erb +37 -0
  51. data/test/dummy/app/views/devise/shared/_links.erb +29 -0
  52. data/test/dummy/app/views/devise/unlocks/new.html.erb +12 -0
  53. data/test/dummy/app/views/layouts/application.html.erb +106 -0
  54. data/test/dummy/app/views/public_keys/_form.html.erb +16 -0
  55. data/test/dummy/app/views/public_keys/index.html.erb +36 -0
  56. data/test/dummy/app/views/public_keys/new.html.erb +5 -0
  57. data/test/dummy/app/views/public_keys/show.html.erb +25 -0
  58. data/test/dummy/app/views/repositories/_form.html.erb +29 -0
  59. data/test/dummy/app/views/repositories/edit.html.erb +5 -0
  60. data/test/dummy/app/views/repositories/index.html.erb +52 -0
  61. data/test/dummy/app/views/repositories/new.html.erb +5 -0
  62. data/test/dummy/app/views/repositories/show.html.erb +31 -0
  63. data/test/dummy/config/application.rb +59 -0
  64. data/test/dummy/config/boot.rb +10 -0
  65. data/test/dummy/config/database.yml +25 -0
  66. data/test/dummy/config/environment.rb +5 -0
  67. data/test/dummy/config/environments/development.rb +37 -0
  68. data/test/dummy/config/environments/production.rb +67 -0
  69. data/test/dummy/config/environments/test.rb +37 -0
  70. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  71. data/test/dummy/config/initializers/devise.rb +242 -0
  72. data/test/dummy/config/initializers/git_wit.rb +73 -0
  73. data/test/dummy/config/initializers/inflections.rb +15 -0
  74. data/test/dummy/config/initializers/mime_types.rb +5 -0
  75. data/test/dummy/config/initializers/rolify.rb +8 -0
  76. data/test/dummy/config/initializers/secret_token.rb +7 -0
  77. data/test/dummy/config/initializers/session_store.rb +8 -0
  78. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  79. data/test/dummy/config/locales/devise.en.yml +59 -0
  80. data/test/dummy/config/locales/en.bootstrap.yml +17 -0
  81. data/test/dummy/config/locales/en.yml +5 -0
  82. data/test/dummy/config/routes.rb +12 -0
  83. data/test/dummy/config.ru +4 -0
  84. data/test/dummy/db/development.sqlite3 +0 -0
  85. data/test/dummy/db/migrate/20130217110616_devise_create_users.rb +46 -0
  86. data/test/dummy/db/migrate/20130217111055_create_repositories.rb +14 -0
  87. data/test/dummy/db/migrate/20130217114405_rolify_create_roles.rb +19 -0
  88. data/test/dummy/db/migrate/20130217191808_add_username_to_users.rb +5 -0
  89. data/test/dummy/db/migrate/20130217221157_create_public_keys.rb +13 -0
  90. data/test/dummy/db/schema.rb +76 -0
  91. data/test/dummy/db/test.sqlite3 +0 -0
  92. data/test/dummy/public/404.html +26 -0
  93. data/test/dummy/public/422.html +26 -0
  94. data/test/dummy/public/500.html +25 -0
  95. data/test/dummy/public/favicon.ico +0 -0
  96. data/test/dummy/script/rails +6 -0
  97. data/test/dummy/test/fixtures/public_keys.yml +14 -0
  98. data/test/dummy/test/fixtures/repositories.yml +17 -0
  99. data/test/dummy/test/fixtures/users.yml +9 -0
  100. data/test/dummy/test/functional/public_keys_controller_test.rb +49 -0
  101. data/test/dummy/test/functional/repositories_controller_test.rb +49 -0
  102. data/test/dummy/test/unit/helpers/public_keys_helper_test.rb +4 -0
  103. data/test/dummy/test/unit/helpers/repositories_helper_test.rb +4 -0
  104. data/test/dummy/test/unit/public_key_test.rb +7 -0
  105. data/test/dummy/test/unit/repository_test.rb +7 -0
  106. data/test/dummy/test/unit/user_test.rb +7 -0
  107. data/test/dummy/tmp/cache/assets/C7E/BC0/sprockets%2Fb7118f368364962573a44054bcfb80d0 +0 -0
  108. data/test/dummy/tmp/cache/assets/C80/840/sprockets%2F562c2d168da585f80579347d10790a0a +0 -0
  109. data/test/dummy/tmp/cache/assets/C8C/B80/sprockets%2F371bf96e99717688ed7313a0c53f4212 +0 -0
  110. data/test/dummy/tmp/cache/assets/C9C/700/sprockets%2Fc7b1373dbf219a8722efc21160641340 +0 -0
  111. data/test/dummy/tmp/cache/assets/C9E/5F0/sprockets%2F2bca2b107bb6c26b720d135270688918 +0 -0
  112. data/test/dummy/tmp/cache/assets/CA9/9C0/sprockets%2F0c1b7ebd087418498ea6037225d33d25 +0 -0
  113. data/test/dummy/tmp/cache/assets/CC8/B00/sprockets%2F9815364bfd49ed907870e270d75a995a +0 -0
  114. data/test/dummy/tmp/cache/assets/CD1/800/sprockets%2Fc044b140dcef533c52712c7b51e21996 +0 -0
  115. data/test/dummy/tmp/cache/assets/CD5/2C0/sprockets%2F166c056119ebdfb8b7104c97b424b423 +0 -0
  116. data/test/dummy/tmp/cache/assets/CD7/380/sprockets%2F4079ce1dbbcf4a599527303670006b6b +0 -0
  117. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  118. data/test/dummy/tmp/cache/assets/CE0/CC0/sprockets%2F2b38c3fb549036de5c4666637a0c80c6 +0 -0
  119. data/test/dummy/tmp/cache/assets/CEC/B70/sprockets%2F7f98753ca8c35e4249363a04389b3caf +0 -0
  120. data/test/dummy/tmp/cache/assets/CF0/1D0/sprockets%2F6fc757c2c8329244ca95d6909865bbc2 +0 -0
  121. data/test/dummy/tmp/cache/assets/CF9/980/sprockets%2Fbd55042e1acd32eb611041444d794d4d +0 -0
  122. data/test/dummy/tmp/cache/assets/CFD/560/sprockets%2Fe4e7fe4ee089382325686f806b939d3e +0 -0
  123. data/test/dummy/tmp/cache/assets/D00/B90/sprockets%2F07c00c80f1ea62d95a01f11f9c728b72 +0 -0
  124. data/test/dummy/tmp/cache/assets/D0D/9A0/sprockets%2F1fce44192cdb30f44b7545a37c9891b2 +0 -0
  125. data/test/dummy/tmp/cache/assets/D0F/390/sprockets%2F9df081609c3449ab40c93b1cf07de357 +0 -0
  126. data/test/dummy/tmp/cache/assets/D25/A60/sprockets%2F0e036061ad22b2e6dce1639b234cf15c +0 -0
  127. data/test/dummy/tmp/cache/assets/D27/DB0/sprockets%2Fa3a0a778855bce9fa47913d389ea9884 +0 -0
  128. data/test/dummy/tmp/cache/assets/D29/5A0/sprockets%2Fdad9e81b43ca12671246ee52a1900d0c +0 -0
  129. data/test/dummy/tmp/cache/assets/D2E/FF0/sprockets%2Fc06112642c994b6b7c2ba6632fad1fd0 +0 -0
  130. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  131. data/test/dummy/tmp/cache/assets/D36/120/sprockets%2Feac54bd3c540af6b964d025e345227d6 +0 -0
  132. data/test/dummy/tmp/cache/assets/D3E/240/sprockets%2F84b96d6b2d2653cb4127b06d8acb990d +0 -0
  133. data/test/dummy/tmp/cache/assets/D3F/830/sprockets%2F18578d4ef3abd6e12d836841dd6b8a00 +0 -0
  134. data/test/dummy/tmp/cache/assets/D4B/E70/sprockets%2F0909bc70e589d40a6cd90dfe6f18257e +0 -0
  135. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  136. data/test/dummy/tmp/cache/assets/D57/3D0/sprockets%2F7bbccc5129a5013b70831ec9ad62ab24 +0 -0
  137. data/test/dummy/tmp/cache/assets/D5A/000/sprockets%2F7d4f67f146b6d7904dfc4edd9135f588 +0 -0
  138. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  139. data/test/dummy/tmp/cache/assets/D5B/BB0/sprockets%2Fba769276c4de14151bc4202cba7f3ad3 +0 -0
  140. data/test/dummy/tmp/cache/assets/D5E/BC0/sprockets%2F2d96fa667066778db858d7b7cb0fce69 +0 -0
  141. data/test/dummy/tmp/cache/assets/D6E/BA0/sprockets%2F5178d3788fe35a52acb5f3bd22ea078a +0 -0
  142. data/test/dummy/tmp/cache/assets/D6F/C20/sprockets%2F22e783a8f5f9224f01e8e62fab6afb40 +0 -0
  143. data/test/dummy/tmp/cache/assets/D76/5C0/sprockets%2Fd8a5669df31f129f355283e6dab4c5ad +0 -0
  144. data/test/dummy/tmp/cache/assets/D79/DE0/sprockets%2F7cfd335e68d881b03f6b7f1bd91f270f +0 -0
  145. data/test/dummy/tmp/cache/assets/D8A/CA0/sprockets%2F656af8b87ad378e8e4f2ec94b6b5c719 +0 -0
  146. data/test/dummy/tmp/cache/assets/D8C/620/sprockets%2Ff37f8e5b8cccd9880276a9f5157d4c7e +0 -0
  147. data/test/dummy/tmp/cache/assets/D92/200/sprockets%2Fb816d858281027bdd3fe2bfac43b4ca1 +0 -0
  148. data/test/dummy/tmp/cache/assets/D92/CE0/sprockets%2Ffca6a13676a2be09234905f9acae22cd +0 -0
  149. data/test/dummy/tmp/cache/assets/D96/9E0/sprockets%2F6fabecd33f7a5a087f4fb6a2d6312443 +0 -0
  150. data/test/dummy/tmp/cache/assets/DA2/D20/sprockets%2Ff5faf079fb660bde5bc9502bde442088 +0 -0
  151. data/test/dummy/tmp/cache/assets/DA5/570/sprockets%2F3517de599b6fd005bc5d5d69ba5ff1e2 +0 -0
  152. data/test/dummy/tmp/cache/assets/DA7/070/sprockets%2F69eadf8c3a94b04fe0b4992ee4a8c821 +0 -0
  153. data/test/dummy/tmp/cache/assets/DBA/BF0/sprockets%2Fe63ea1d7bfb0ee50380debe42360a3b5 +0 -0
  154. data/test/dummy/tmp/cache/assets/DBB/3B0/sprockets%2F6a0aaa6c5b0d10b936e237a7ecb4e4c9 +0 -0
  155. data/test/dummy/tmp/cache/assets/DBC/8E0/sprockets%2F908976cfbcdf6ad4c59737bf3c78e1e8 +0 -0
  156. data/test/dummy/tmp/cache/assets/DD3/FD0/sprockets%2Febf97c76a9ba2a889dd01be2caa75806 +0 -0
  157. data/test/dummy/tmp/cache/assets/DD8/410/sprockets%2Fc02eeb7ea977fd713cc19ca93d838af4 +0 -0
  158. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  159. data/test/dummy/tmp/cache/assets/DEA/E40/sprockets%2F4166d7d00d1e72fed2004debed2bea3e +0 -0
  160. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  161. data/test/dummy/tmp/cache/assets/E05/C70/sprockets%2Fccd814ec859d582ada46e271edfe7ae1 +0 -0
  162. data/test/dummy/tmp/cache/assets/E0C/2A0/sprockets%2F37c59fadd9a21cab7d05d78a7dfe7e85 +0 -0
  163. data/test/dummy/tmp/cache/assets/E28/130/sprockets%2F6f332ca43b7ed658d90b8ba5daaa5ded +0 -0
  164. data/test/dummy/tmp/cache/assets/E3B/080/sprockets%2F09e2a090befacdae0db10cafb1893a0a +0 -0
  165. data/test/dummy/tmp/cache/assets/E65/CD0/sprockets%2F93cdf3fec0e3aa6deefa955c6828fbd0 +0 -0
  166. data/test/dummy/tmp/cache/assets/E9F/450/sprockets%2Fbbfdc5edaaf25dfdb5ee8f9db7895435 +0 -0
  167. data/test/dummy/tmp/restart.txt +0 -0
  168. data/test/functional/git_wit/git_controller_test.rb +10 -0
  169. data/test/git_wit_test.rb +7 -0
  170. data/test/integration/navigation_test.rb +10 -0
  171. data/test/test_helper.rb +18 -0
  172. data/test/unit/auth_test.rb +56 -0
  173. data/test/unit/authorized_keys_test.rb +57 -0
  174. data/test/unit/config_test.rb +42 -0
  175. data/test/unit/shell_test.rb +89 -0
  176. metadata +409 -0
@@ -0,0 +1,59 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ en:
4
+ devise:
5
+ confirmations:
6
+ confirmed: "Your account was successfully confirmed. You are now signed in."
7
+ send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
8
+ send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
9
+ failure:
10
+ already_authenticated: "You are already signed in."
11
+ inactive: "Your account was not activated yet."
12
+ invalid: "Invalid username or password."
13
+ invalid_token: "Invalid authentication token."
14
+ locked: "Your account is locked."
15
+ not_found_in_database: "Invalid username or password."
16
+ timeout: "Your session expired, please sign in again to continue."
17
+ unauthenticated: "You need to sign in or sign up before continuing."
18
+ unconfirmed: "You have to confirm your account before continuing."
19
+ mailer:
20
+ confirmation_instructions:
21
+ subject: "Confirmation instructions"
22
+ reset_password_instructions:
23
+ subject: "Reset password instructions"
24
+ unlock_instructions:
25
+ subject: "Unlock Instructions"
26
+ omniauth_callbacks:
27
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
28
+ success: "Successfully authenticated from %{kind} account."
29
+ passwords:
30
+ no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
31
+ send_instructions: "You will receive an email with instructions about how to reset your password in a few minutes."
32
+ send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
33
+ updated: "Your password was changed successfully. You are now signed in."
34
+ updated_not_active: "Your password was changed successfully."
35
+ registrations:
36
+ destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
37
+ signed_up: "Welcome! You have signed up successfully."
38
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
39
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
40
+ signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account."
41
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
42
+ updated: "You updated your account successfully."
43
+ sessions:
44
+ signed_in: "Signed in successfully."
45
+ signed_out: "Signed out successfully."
46
+ unlocks:
47
+ send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes."
48
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes."
49
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
50
+ errors:
51
+ messages:
52
+ already_confirmed: "was already confirmed, please try signing in"
53
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
54
+ expired: "has expired, please request a new one"
55
+ not_found: "not found"
56
+ not_locked: "was not locked"
57
+ not_saved:
58
+ one: "1 error prohibited this %{resource} from being saved:"
59
+ other: "%{count} errors prohibited this %{resource} from being saved:"
@@ -0,0 +1,17 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ helpers:
6
+ actions: "Actions"
7
+ links:
8
+ back: "Back"
9
+ cancel: "Cancel"
10
+ confirm: "Are you sure?"
11
+ destroy: "Delete"
12
+ new: "New"
13
+ titles:
14
+ edit: "Edit"
15
+ save: "Save"
16
+ new: "New"
17
+ delete: "Delete"
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,12 @@
1
+ Rails.application.routes.draw do
2
+ resources :public_keys
3
+
4
+
5
+ root to: "repositories#index"
6
+
7
+ resources :repositories
8
+
9
+ devise_for :users
10
+
11
+ mount GitWit::Engine => "/"
12
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
Binary file
@@ -0,0 +1,46 @@
1
+ class DeviseCreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table(:users) do |t|
4
+ ## Database authenticatable
5
+ t.string :email, :null => false, :default => ""
6
+ t.string :encrypted_password, :null => false, :default => ""
7
+
8
+ ## Recoverable
9
+ t.string :reset_password_token
10
+ t.datetime :reset_password_sent_at
11
+
12
+ ## Rememberable
13
+ t.datetime :remember_created_at
14
+
15
+ ## Trackable
16
+ t.integer :sign_in_count, :default => 0
17
+ t.datetime :current_sign_in_at
18
+ t.datetime :last_sign_in_at
19
+ t.string :current_sign_in_ip
20
+ t.string :last_sign_in_ip
21
+
22
+ ## Confirmable
23
+ # t.string :confirmation_token
24
+ # t.datetime :confirmed_at
25
+ # t.datetime :confirmation_sent_at
26
+ # t.string :unconfirmed_email # Only if using reconfirmable
27
+
28
+ ## Lockable
29
+ # t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
30
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
31
+ # t.datetime :locked_at
32
+
33
+ ## Token authenticatable
34
+ # t.string :authentication_token
35
+
36
+
37
+ t.timestamps
38
+ end
39
+
40
+ add_index :users, :email, :unique => true
41
+ add_index :users, :reset_password_token, :unique => true
42
+ # add_index :users, :confirmation_token, :unique => true
43
+ # add_index :users, :unlock_token, :unique => true
44
+ # add_index :users, :authentication_token, :unique => true
45
+ end
46
+ end
@@ -0,0 +1,14 @@
1
+ class CreateRepositories < ActiveRecord::Migration
2
+ def change
3
+ create_table :repositories do |t|
4
+ t.string :name
5
+ t.string :path
6
+ t.references :user
7
+ t.boolean :public
8
+
9
+ t.timestamps
10
+ end
11
+ add_index :repositories, :path
12
+ add_index :repositories, :user_id
13
+ end
14
+ end
@@ -0,0 +1,19 @@
1
+ class RolifyCreateRoles < ActiveRecord::Migration
2
+ def change
3
+ create_table(:roles) do |t|
4
+ t.string :name
5
+ t.references :resource, :polymorphic => true
6
+
7
+ t.timestamps
8
+ end
9
+
10
+ create_table(:users_roles, :id => false) do |t|
11
+ t.references :user
12
+ t.references :role
13
+ end
14
+
15
+ add_index(:roles, :name)
16
+ add_index(:roles, [ :name, :resource_type, :resource_id ])
17
+ add_index(:users_roles, [ :user_id, :role_id ])
18
+ end
19
+ end
@@ -0,0 +1,5 @@
1
+ class AddUsernameToUsers < ActiveRecord::Migration
2
+ def change
3
+ add_column :users, :username, :string
4
+ end
5
+ end
@@ -0,0 +1,13 @@
1
+ class CreatePublicKeys < ActiveRecord::Migration
2
+ def change
3
+ create_table :public_keys do |t|
4
+ t.references :user
5
+ t.text :content
6
+ t.string :comment
7
+
8
+ t.timestamps
9
+ end
10
+ add_index :public_keys, :user_id
11
+ add_index :public_keys, :content, :unique => true
12
+ end
13
+ end
@@ -0,0 +1,76 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20130217221157) do
15
+
16
+ create_table "public_keys", :force => true do |t|
17
+ t.integer "user_id"
18
+ t.text "content"
19
+ t.string "comment"
20
+ t.datetime "created_at", :null => false
21
+ t.datetime "updated_at", :null => false
22
+ end
23
+
24
+ add_index "public_keys", ["content"], :name => "index_public_keys_on_content", :unique => true
25
+ add_index "public_keys", ["user_id"], :name => "index_public_keys_on_user_id"
26
+
27
+ create_table "repositories", :force => true do |t|
28
+ t.string "name"
29
+ t.string "path"
30
+ t.integer "user_id"
31
+ t.boolean "public"
32
+ t.datetime "created_at", :null => false
33
+ t.datetime "updated_at", :null => false
34
+ end
35
+
36
+ add_index "repositories", ["path"], :name => "index_repositories_on_path"
37
+ add_index "repositories", ["user_id"], :name => "index_repositories_on_user_id"
38
+
39
+ create_table "roles", :force => true do |t|
40
+ t.string "name"
41
+ t.integer "resource_id"
42
+ t.string "resource_type"
43
+ t.datetime "created_at", :null => false
44
+ t.datetime "updated_at", :null => false
45
+ end
46
+
47
+ add_index "roles", ["name", "resource_type", "resource_id"], :name => "index_roles_on_name_and_resource_type_and_resource_id"
48
+ add_index "roles", ["name"], :name => "index_roles_on_name"
49
+
50
+ create_table "users", :force => true do |t|
51
+ t.string "email", :default => "", :null => false
52
+ t.string "encrypted_password", :default => "", :null => false
53
+ t.string "reset_password_token"
54
+ t.datetime "reset_password_sent_at"
55
+ t.datetime "remember_created_at"
56
+ t.integer "sign_in_count", :default => 0
57
+ t.datetime "current_sign_in_at"
58
+ t.datetime "last_sign_in_at"
59
+ t.string "current_sign_in_ip"
60
+ t.string "last_sign_in_ip"
61
+ t.datetime "created_at", :null => false
62
+ t.datetime "updated_at", :null => false
63
+ t.string "username"
64
+ end
65
+
66
+ add_index "users", ["email"], :name => "index_users_on_email", :unique => true
67
+ add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
68
+
69
+ create_table "users_roles", :id => false, :force => true do |t|
70
+ t.integer "user_id"
71
+ t.integer "role_id"
72
+ end
73
+
74
+ add_index "users_roles", ["user_id", "role_id"], :name => "index_users_roles_on_user_id_and_role_id"
75
+
76
+ end
Binary file
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,14 @@
1
+ one:
2
+ user: one
3
+ content: "ssh-rsa AAAAB3N2Xj++woMRw+RIoEOMK2J9dAQABAAABAQC6nrvPbt8L5b1eCHVNo8GQPN4PKUf9zaOknqgI6tJGViqV4evOhUB+MMBh+8C4cUFWu//09PnXLzMjGdP6HNe+J1+lzlY3JQ+PxDFLTUc+jD5XK3ybVC1yc2EAAAADAM/mDvO4WnCtBgcH3CgXfucUxyb9/dvJGIrGvKk/WPwC2k36L77xLFil3cUH8B1qSW2wD3BDcQKukG6vGMqHVI9nwVTkygy9U5MNuDjxl+/8gX5V02qe9uC4iNrZZ4A1N+sjMPcZ7nexDIRu27csAYnypyCd1mGEZanztEMzzR1CAn8AKVregSkbKsKuSfyIw+FDeT3dSAJpywn"
4
+ comment: "one@example.com"
5
+
6
+ two:
7
+ user: two
8
+ content: "ssh-rsa M/mDBh+8C4cUFWu//09CADAQABARw+RIoE1yc2EAAB3NA5b1eCAAzMjGdP6HAAza8LHVNo8GQPN4PKUf9PnXLNe+J1+lzlY3JQ+vAABAQC6nrvPbtAOMK2J9d2Xj++woMO4WnCtBgcH3CgXfucUxyb9/dvJOknqgI6tJGViqV4evOhUB+MMPxDFLTUc+jD5XK3ybVGIrGvKk/WPwC2k36L77xLFil3cUH8B1qSW2wD3BDcQKAKVred1mGEZanzpywnV02qe9uC4iNrZZ4A1N+sjukG6vGMqHVI9nwgSkbKsKuSfyIw+FDeT3dSAJxgy9U5MNuDjxl+/8gX5DIRu27csAYnypyCVTkyZ7netEMzzR1CAn8MPc"
9
+ comment: "two@example.com"
10
+
11
+ three:
12
+ user: one
13
+ content: "ssh-rsa VNo8GQPN4PKUM/mDBh+8C4cUFWu//09Aza8LHf9PnXLNe+J1+lzlY3JQ+vAABACADAQABARw+RIoE1yc2EAAB3NA5b1eCAAzMjGdP6HAQC6nrvPbtAOMK2J9d2Xj++woMO4WnCtBgcH3CgXfucUxyb9/dvJOknqgI6tJGViqV4evOhUB+MMPxDFLTUc+jD5XK3ybVGIrGvKk/WPwC2k36L77xLFil3cUH8By9U5MNuDjxl+/8gX5DIRu27csAYnzpywnV02qe9uC4iNrZZ4A1N+sjukG6vGypyCVTkyZ7netEM1qSW2wD3BDcQKAKVred1mGEZanMqHVI9ngzzR1CAn8MPcwgSkbKsKuSfyIw+FDeT3dSAJx"
14
+ comment: "one@another.com"
@@ -0,0 +1,17 @@
1
+ user1_public:
2
+ name: one public
3
+ path: one/public.git
4
+ user: one
5
+ public: true
6
+
7
+ user1_private:
8
+ name: one private
9
+ path: one/private.git
10
+ user: one
11
+ public: false
12
+
13
+ user2_private:
14
+ name: two private
15
+ path: two/private.git
16
+ user: two
17
+ public: false
@@ -0,0 +1,9 @@
1
+ one:
2
+ username: one
3
+ email: "one@example.com"
4
+ encrypted_password: <%= User.new.send(:password_digest, "user1pw") %>
5
+
6
+ two:
7
+ username: two
8
+ email: "two@example.com"
9
+ encrypted_password: <%= User.new.send(:password_digest, "user2pw") %>
@@ -0,0 +1,49 @@
1
+ require 'test_helper'
2
+
3
+ class PublicKeysControllerTest < ActionController::TestCase
4
+ # setup do
5
+ # @public_key = public_keys(:one)
6
+ # end
7
+
8
+ # test "should get index" do
9
+ # get :index
10
+ # assert_response :success
11
+ # assert_not_nil assigns(:public_keys)
12
+ # end
13
+
14
+ # test "should get new" do
15
+ # get :new
16
+ # assert_response :success
17
+ # end
18
+
19
+ # test "should create public_key" do
20
+ # assert_difference('PublicKey.count') do
21
+ # post :create, public_key: { comment: @public_key.comment, content: @public_key.content }
22
+ # end
23
+
24
+ # assert_redirected_to public_key_path(assigns(:public_key))
25
+ # end
26
+
27
+ # test "should show public_key" do
28
+ # get :show, id: @public_key
29
+ # assert_response :success
30
+ # end
31
+
32
+ # test "should get edit" do
33
+ # get :edit, id: @public_key
34
+ # assert_response :success
35
+ # end
36
+
37
+ # test "should update public_key" do
38
+ # put :update, id: @public_key, public_key: { comment: @public_key.comment, content: @public_key.content }
39
+ # assert_redirected_to public_key_path(assigns(:public_key))
40
+ # end
41
+
42
+ # test "should destroy public_key" do
43
+ # assert_difference('PublicKey.count', -1) do
44
+ # delete :destroy, id: @public_key
45
+ # end
46
+
47
+ # assert_redirected_to public_keys_path
48
+ # end
49
+ end
@@ -0,0 +1,49 @@
1
+ require 'test_helper'
2
+
3
+ class RepositoriesControllerTest < ActionController::TestCase
4
+ # setup do
5
+ # @repository = repositories(:one)
6
+ # end
7
+
8
+ # test "should get index" do
9
+ # get :index
10
+ # assert_response :success
11
+ # assert_not_nil assigns(:repositories)
12
+ # end
13
+
14
+ # test "should get new" do
15
+ # get :new
16
+ # assert_response :success
17
+ # end
18
+
19
+ # test "should create repository" do
20
+ # assert_difference('Repository.count') do
21
+ # post :create, repository: { name: @repository.name, path: @repository.path, public: @repository.public }
22
+ # end
23
+
24
+ # assert_redirected_to repository_path(assigns(:repository))
25
+ # end
26
+
27
+ # test "should show repository" do
28
+ # get :show, id: @repository
29
+ # assert_response :success
30
+ # end
31
+
32
+ # test "should get edit" do
33
+ # get :edit, id: @repository
34
+ # assert_response :success
35
+ # end
36
+
37
+ # test "should update repository" do
38
+ # put :update, id: @repository, repository: { name: @repository.name, path: @repository.path, public: @repository.public }
39
+ # assert_redirected_to repository_path(assigns(:repository))
40
+ # end
41
+
42
+ # test "should destroy repository" do
43
+ # assert_difference('Repository.count', -1) do
44
+ # delete :destroy, id: @repository
45
+ # end
46
+
47
+ # assert_redirected_to repositories_path
48
+ # end
49
+ end
@@ -0,0 +1,4 @@
1
+ require 'test_helper'
2
+
3
+ class PublicKeysHelperTest < ActionView::TestCase
4
+ end
@@ -0,0 +1,4 @@
1
+ require 'test_helper'
2
+
3
+ class RepositoriesHelperTest < ActionView::TestCase
4
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class PublicKeyTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class RepositoryTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class UserTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end