Permalink
Browse files

extract travis-core from travis-ci

  • Loading branch information...
0 parents commit 732fe001d1ffab7a1ab5bf3ef473ec093c087def Sven Fuchs committed Nov 7, 2011
Showing with 7,137 additions and 0 deletions.
  1. +3 −0 .rspec
  2. +41 −0 Gemfile
  3. +214 −0 Gemfile.lock
  4. +21 −0 LICENSE
  5. +1 −0 README.md
  6. +9 −0 Rakefile
  7. +15 −0 db/migrate/20101126174706_create_repositories.rb
  8. +26 −0 db/migrate/20101126174715_create_builds.rb
  9. +16 −0 db/migrate/20110109130532_devise_create_users.rb
  10. +13 −0 db/migrate/20110116155100_repositories_add_username.rb
  11. +13 −0 db/migrate/20110130102621_create_tokens.rb
  12. +22 −0 db/migrate/20110301071656_add_build_parent_id_and_configuration.rb
  13. +23 −0 db/migrate/20110316174721_repositories_denormalize_last_build_attributes.rb
  14. +67 −0 db/migrate/20110321075539_repositories_add_owner_name_and_owner_email.rb
  15. +15 −0 db/migrate/20110321171101_repository_strip_owner_name_from_name.rb
  16. +18 −0 db/migrate/20110411171936_create_histories_table.rb
  17. +9 −0 db/migrate/20110411171937_rename_histories_to_rails_admin_histories.rb
  18. +20 −0 db/migrate/20110411172518_add_admin_flag_to_user.rb
  19. +15 −0 db/migrate/20110413101057_builds_add_ref.rb
  20. +13 −0 db/migrate/20110414131100_builds_add_github_payload.rb
  21. +11 −0 db/migrate/20110503150504_add_github_id_to_users_table.rb
  22. +9 −0 db/migrate/20110523012243_repositories_change_owner_email_type.rb
  23. +11 −0 db/migrate/20110611203537_add_github_oauth_token_to_user.rb
  24. +9 −0 db/migrate/20110613210252_add_compare_url_to_build.rb
  25. +13 −0 db/migrate/20110615152003_builds_remove_job_id.rb
  26. +13 −0 db/migrate/20110616211744_build_remove_last_built_at.rb
  27. +13 −0 db/migrate/20110617114728_add_missing_indexes.rb
  28. +9 −0 db/migrate/20110619100906_add_active_to_repositories.rb
  29. +9 −0 db/migrate/20110729094426_store_token_in_build.rb
  30. +164 −0 db/migrate/20110801161819_create_requests_commits_and_tasks.rb
  31. +9 −0 db/migrate/20110805030147_repository_rename_is_active_to_active.rb
  32. +9 −0 db/migrate/20110819232908_tasks_add_tags.rb
  33. +13 −0 db/migrate/20110911204538_cache_one_number_for_shared_builds_tasks_sequence.rb
  34. +15 −0 db/migrate/20111027032250_rename_tasks_to_jobs.rb
  35. +31 −0 db/migrate/20111031115207_create_artifacts.rb
  36. +12 −0 db/migrate/20111104172344_create_workers.rb
  37. +7 −0 db/migrate/20111105171924_jobs_add_retries.rb
  38. +23 −0 lib/core_ext/active_record/base.rb
  39. +6 −0 lib/core_ext/array/flatten_once.rb
  40. +12 −0 lib/core_ext/hash/compact.rb
  41. +15 −0 lib/core_ext/hash/deep_symbolize_keys.rb
  42. +9 −0 lib/core_ext/ostruct/hash_access.rb
  43. +9 −0 lib/devise/api_token_authenticatable.rb
  44. +15 −0 lib/devise/models/api_token_authenticatable.rb
  45. +46 −0 lib/devise/strategies/api_token_authenticatable.rb
  46. +170 −0 lib/github.rb
  47. +43 −0 lib/irc_client.rb
  48. +30 −0 lib/travis.rb
  49. +38 −0 lib/travis/amqp.rb
  50. +39 −0 lib/travis/config.rb
  51. +111 −0 lib/travis/consumer.rb
  52. +15 −0 lib/travis/consumer/handler.rb
  53. +28 −0 lib/travis/consumer/job.rb
  54. +27 −0 lib/travis/consumer/worker.rb
  55. +27 −0 lib/travis/database.rb
  56. +31 −0 lib/travis/github_api.rb
  57. +42 −0 lib/travis/logging.rb
  58. +25 −0 lib/travis/mailer.rb
  59. +25 −0 lib/travis/mailer/build.rb
  60. +59 −0 lib/travis/mailer/helper/build.rb
  61. +12 −0 lib/travis/mailer/locales/en.yml
  62. +37 −0 lib/travis/mailer/views/build/finished_email.html.erb
  63. +16 −0 lib/travis/mailer/views/build/finished_email.text.erb
  64. +258 −0 lib/travis/mailer/views/layouts/build.html.erb
  65. +8 −0 lib/travis/mailer/views/layouts/build.text.erb
  66. +26 −0 lib/travis/model.rb
  67. +7 −0 lib/travis/model/artifact.rb
  68. +5 −0 lib/travis/model/artifact/log.rb
  69. +88 −0 lib/travis/model/build.rb
  70. +22 −0 lib/travis/model/build/denormalize.rb
  71. +99 −0 lib/travis/model/build/matrix.rb
  72. +29 −0 lib/travis/model/build/messages.rb
  73. +107 −0 lib/travis/model/build/notifications.rb
  74. +43 −0 lib/travis/model/build/states.rb
  75. +6 −0 lib/travis/model/commit.rb
  76. +36 −0 lib/travis/model/job.rb
  77. +7 −0 lib/travis/model/job/configure.rb
  78. +40 −0 lib/travis/model/job/configure/states.rb
  79. +43 −0 lib/travis/model/job/requeueing.rb
  80. +55 −0 lib/travis/model/job/states.rb
  81. +20 −0 lib/travis/model/job/tagging.rb
  82. +19 −0 lib/travis/model/job/test.rb
  83. +44 −0 lib/travis/model/job/test/states.rb
  84. +66 −0 lib/travis/model/repository.rb
  85. +37 −0 lib/travis/model/repository/service_hook.rb
  86. +48 −0 lib/travis/model/request.rb
  87. +32 −0 lib/travis/model/request/branches.rb
  88. +5 −0 lib/travis/model/request/payload.rb
  89. +34 −0 lib/travis/model/request/payload/github.rb
  90. +32 −0 lib/travis/model/request/states.rb
  91. +17 −0 lib/travis/model/token.rb
  92. +62 −0 lib/travis/model/user.rb
  93. +23 −0 lib/travis/model/worker.rb
  94. +49 −0 lib/travis/notifications.rb
  95. +29 −0 lib/travis/notifications/email.rb
  96. +53 −0 lib/travis/notifications/irc.rb
  97. +74 −0 lib/travis/notifications/pusher.rb
  98. +33 −0 lib/travis/notifications/pusher/payload.rb
  99. +15 −0 lib/travis/notifications/pusher/views/v1/event/build/finished.rabl
  100. +10 −0 lib/travis/notifications/pusher/views/v1/event/build/finished/test.rabl
  101. +13 −0 lib/travis/notifications/pusher/views/v1/event/build/log.rabl
  102. +9 −0 lib/travis/notifications/pusher/views/v1/event/build/queued.rabl
  103. +9 −0 lib/travis/notifications/pusher/views/v1/event/build/removed.rabl
  104. +23 −0 lib/travis/notifications/pusher/views/v1/event/build/started.rabl
  105. +11 −0 lib/travis/notifications/pusher/views/v1/event/build/started/test.rabl
  106. +21 −0 lib/travis/notifications/pusher/views/v1/event/job/test/started.rabl
  107. +43 −0 lib/travis/notifications/webhook.rb
  108. +30 −0 lib/travis/notifications/webhook/payload.rb
  109. +19 −0 lib/travis/notifications/webhook/views/v1/webhook/build.rabl
  110. +14 −0 lib/travis/notifications/webhook/views/v1/webhook/job/test.rabl
  111. +3 −0 lib/travis/notifications/webhook/views/v1/webhook/repository.rabl
  112. +58 −0 lib/travis/notifications/worker.rb
  113. +33 −0 lib/travis/notifications/worker/payload.rb
  114. +35 −0 lib/travis/notifications/worker/queue.rb
  115. +11 −0 lib/travis/notifications/worker/views/v1/worker/job/configure.rabl
  116. +13 −0 lib/travis/notifications/worker/views/v1/worker/job/test.rabl
  117. +86 −0 lib/travis/renderer.rb
  118. +19 −0 lib/travis/tasks/thor.rb
  119. +4 −0 lib/travis_core/railtie.rb
  120. +3 −0 lib/travis_core/version.rb
  121. +1 −0 spec/fixtures/github/api/v2/json/organizations/travis-ci/public_members.json
  122. +1 −0 spec/fixtures/github/api/v2/json/repos/show/svenfuchs.json
  123. +1 −0 spec/fixtures/github/api/v2/json/repos/show/svenfuchs/gem-release.json
  124. +1 −0 spec/fixtures/github/api/v2/json/repos/show/svenfuchs/minimal.json
  125. +1 −0 spec/fixtures/github/api/v2/json/repos/show/travis-ci/travis-ci.json
  126. +1 −0 spec/fixtures/github/api/v2/json/user/show/LTe.json
  127. +1 −0 spec/fixtures/github/api/v2/json/user/show/svenfuchs.json
  128. +31 −0 spec/lib/core_ext/active_record_spec.rb
  129. +9 −0 spec/lib/core_ext/array_spec.rb
  130. +19 −0 spec/lib/core_ext/hash_spec.rb
  131. +74 −0 spec/lib/github_spec.rb
  132. +107 −0 spec/lib/irc_client_spec.rb
  133. +26 −0 spec/spec_helper.rb
  134. +35 −0 spec/support/active_record.rb
  135. +77 −0 spec/support/factories.rb
  136. +36 −0 spec/support/formats.rb
  137. +126 −0 spec/support/matchers.rb
  138. +42 −0 spec/support/mocks/irc.rb
  139. +22 −0 spec/support/mocks/pusher.rb
  140. +191 −0 spec/support/payloads.rb
  141. +17 −0 spec/support/pusher.rb
  142. +67 −0 spec/support/webmock.rb
  143. +66 −0 spec/travis/config_spec.rb
  144. +53 −0 spec/travis/consumer/worker_spec.rb
  145. +28 −0 spec/travis/consumer_spec.rb
  146. +5 −0 spec/travis/github_api_spec.rb
  147. +96 −0 spec/travis/mailer/build_spec.rb
  148. +13 −0 spec/travis/mailer/helper/build_spec.rb
  149. +23 −0 spec/travis/model/artifact/log_spec.rb
  150. +43 −0 spec/travis/model/build/denormalize_spec.rb
  151. +295 −0 spec/travis/model/build/matrix_spec.rb
  152. +177 −0 spec/travis/model/build/notifications_spec.rb
  153. +79 −0 spec/travis/model/build/states_spec.rb
  154. +133 −0 spec/travis/model/build_spec.rb
  155. +86 −0 spec/travis/model/job/configure/states_spec.rb
  156. +58 −0 spec/travis/model/job/requeueing_spec.rb
  157. +38 −0 spec/travis/model/job/tagging_spec.rb
  158. +107 −0 spec/travis/model/job/test/states_spec.rb
  159. +21 −0 spec/travis/model/job_spec.rb
  160. +32 −0 spec/travis/model/repository/service_hook_spec.rb
  161. +85 −0 spec/travis/model/repository_spec.rb
  162. +75 −0 spec/travis/model/request/branches_spec.rb
  163. +80 −0 spec/travis/model/request/payload/github_spec.rb
  164. +186 −0 spec/travis/model/request/states_spec.rb
  165. +67 −0 spec/travis/model/request_spec.rb
  166. +7 −0 spec/travis/model/token_spec.rb
  167. +62 −0 spec/travis/model/user_spec.rb
  168. +15 −0 spec/travis/model/worker_spec.rb
  169. +12 −0 spec/travis/notifications/email_spec.rb
  170. +97 −0 spec/travis/notifications/irc_spec.rb
  171. +105 −0 spec/travis/notifications/pusher_spec.rb
  172. +40 −0 spec/travis/notifications/webhook_spec.rb
  173. +6 −0 spec/travis/notifications/worker/payload_spec.rb
  174. +38 −0 spec/travis/notifications/worker/queue_spec.rb
  175. +71 −0 spec/travis/notifications/worker_spec.rb
  176. +54 −0 spec/travis/renderer_spec.rb
  177. +19 −0 travis-core.gemspec
3 .rspec
@@ -0,0 +1,3 @@
+--colour
+--tty
+--format documentation
41 Gemfile
@@ -0,0 +1,41 @@
+source :rubygems
+# gemspec
+
+gem 'rake', '~> 0.9.2'
+gem 'thor', '~> 0.14.6'
+gem 'jruby-openssl', :platforms => :jruby
+
+gem 'rails', '~> 3.1.1' # why does devise require rails??
+gem 'activerecord', '~> 3.1.1'
+gem 'actionmailer', '~> 3.1.1'
+gem 'nokogiri', '~> 1.5.0'
+gem 'actionmailer_inline_css', '~> 1.3.0'
+
+# db
+# gem 'pg', '~> 0.11.0'
+# gem 'silent-postgres', '~> 0.0.8'
+gem 'activerecord-jdbcpostgresql-adapter'
+gem 'data_migrations', '~> 0.0.1'
+
+# structures
+gem 'hashr', '~> 0.0.16'
+gem 'rabl', '~> 0.5.0'
+
+# app
+gem 'devise', '~> 1.4.2'
+gem 'oa-oauth', '~> 0.3.0'
+gem 'simple_states', '~> 0.0.10'
+
+# apis
+gem 'octokit', '~> 0.6.5'
+gem 'pusher', '~> 0.8.1'
+gem 'amqp', '~> 0.8.2'
+
+group :test do
+ gem 'rspec', '~> 2.7.0'
+ gem 'factory_girl', '~> 2.1.2'
+ gem 'database_cleaner', '~> 0.6.7'
+ gem 'mocha', '~> 0.10.0'
+ gem 'webmock', '~> 1.7.7'
+end
+
@@ -0,0 +1,214 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionmailer (3.1.1)
+ actionpack (= 3.1.1)
+ mail (~> 2.3.0)
+ actionmailer_inline_css (1.3.1)
+ actionmailer (>= 3.0.0)
+ nokogiri (>= 1.4.4)
+ premailer (>= 1.7.1)
+ actionpack (3.1.1)
+ activemodel (= 3.1.1)
+ activesupport (= 3.1.1)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ i18n (~> 0.6)
+ rack (~> 1.3.2)
+ rack-cache (~> 1.1)
+ rack-mount (~> 0.8.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.0.2)
+ activemodel (3.1.1)
+ activesupport (= 3.1.1)
+ builder (~> 3.0.0)
+ i18n (~> 0.6)
+ activerecord (3.1.1)
+ activemodel (= 3.1.1)
+ activesupport (= 3.1.1)
+ arel (~> 2.2.1)
+ tzinfo (~> 0.3.29)
+ activerecord-jdbc-adapter (1.2.0)
+ activerecord-jdbcpostgresql-adapter (1.2.0)
+ activerecord-jdbc-adapter (~> 1.2.0)
+ jdbc-postgres (~> 9.0.0)
+ activeresource (3.1.1)
+ activemodel (= 3.1.1)
+ activesupport (= 3.1.1)
+ activesupport (3.1.1)
+ multi_json (~> 1.0)
+ addressable (2.2.6)
+ amq-client (0.8.5)
+ amq-protocol (>= 0.8.0)
+ eventmachine
+ amq-protocol (0.8.3)
+ amqp (0.8.2)
+ amq-client (~> 0.8.5)
+ amq-protocol (~> 0.8.3)
+ eventmachine
+ arel (2.2.1)
+ bcrypt-ruby (3.0.1)
+ bcrypt-ruby (3.0.1-java)
+ bouncy-castle-java (1.5.0146.1)
+ builder (3.0.0)
+ crack (0.1.8)
+ css_parser (1.2.5)
+ addressable
+ data_migrations (0.0.1)
+ activerecord
+ rake
+ database_cleaner (0.6.7)
+ devise (1.4.9)
+ bcrypt-ruby (~> 3.0)
+ orm_adapter (~> 0.0.3)
+ warden (~> 1.0.3)
+ diff-lcs (1.1.3)
+ erubis (2.7.0)
+ eventmachine (0.12.10)
+ eventmachine (0.12.10-java)
+ factory_girl (2.1.2)
+ activesupport
+ faraday (0.7.5)
+ addressable (~> 2.2.6)
+ multipart-post (~> 1.1.3)
+ rack (>= 1.1.0, < 2)
+ faraday_middleware (0.7.0)
+ faraday (~> 0.7.3)
+ hashie (1.2.0)
+ hashr (0.0.16)
+ hike (1.2.1)
+ htmlentities (4.3.0)
+ i18n (0.6.0)
+ jdbc-postgres (9.0.801)
+ jruby-openssl (0.7.4)
+ bouncy-castle-java
+ json (1.6.1-java)
+ mail (2.3.0)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ metaclass (0.0.1)
+ mime-types (1.17.2)
+ mocha (0.10.0)
+ metaclass (~> 0.0.1)
+ multi_json (1.0.3)
+ multi_xml (0.4.1)
+ multipart-post (1.1.3)
+ nokogiri (1.5.0)
+ nokogiri (1.5.0-java)
+ oa-core (0.3.2)
+ oa-oauth (0.3.2)
+ faraday (~> 0.7.3)
+ multi_json (~> 1.0.0)
+ multi_xml (~> 0.4.0)
+ oa-core (= 0.3.2)
+ oauth (~> 0.4.0)
+ oauth2 (~> 0.5.0)
+ oauth (0.4.5)
+ oauth2 (0.5.1)
+ faraday (~> 0.7.4)
+ multi_json (~> 1.0.3)
+ octokit (0.6.5)
+ addressable (~> 2.2.6)
+ faraday (~> 0.7.4)
+ faraday_middleware (~> 0.7.0)
+ hashie (~> 1.2.0)
+ multi_json (~> 1.0.2)
+ orm_adapter (0.0.5)
+ polyglot (0.3.3)
+ premailer (1.7.3)
+ css_parser (>= 1.1.9)
+ htmlentities (>= 4.0.0)
+ pusher (0.8.4)
+ crack (~> 0.1.0)
+ multi_json (~> 1.0)
+ ruby-hmac (~> 0.4.0)
+ signature (~> 0.1.2)
+ rabl (0.5.0)
+ activesupport (>= 2.3.14)
+ multi_json (~> 1.0.3)
+ rack (1.3.5)
+ rack-cache (1.1)
+ rack (>= 0.4)
+ rack-mount (0.8.3)
+ rack (>= 1.0.0)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rails (3.1.1)
+ actionmailer (= 3.1.1)
+ actionpack (= 3.1.1)
+ activerecord (= 3.1.1)
+ activeresource (= 3.1.1)
+ activesupport (= 3.1.1)
+ bundler (~> 1.0)
+ railties (= 3.1.1)
+ railties (3.1.1)
+ actionpack (= 3.1.1)
+ activesupport (= 3.1.1)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+ rake (0.9.2.2)
+ rdoc (3.11)
+ json (~> 1.4)
+ rspec (2.7.0)
+ rspec-core (~> 2.7.0)
+ rspec-expectations (~> 2.7.0)
+ rspec-mocks (~> 2.7.0)
+ rspec-core (2.7.1)
+ rspec-expectations (2.7.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.7.0)
+ ruby-hmac (0.4.0)
+ signature (0.1.2)
+ ruby-hmac
+ simple_states (0.0.10)
+ activesupport
+ hashr (~> 0.0.10)
+ sprockets (2.0.3)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ thor (0.14.6)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.31)
+ warden (1.0.6)
+ rack (>= 1.0)
+ webmock (1.7.7)
+ addressable (~> 2.2, > 2.2.5)
+ crack (>= 0.1.7)
+
+PLATFORMS
+ java
+ ruby
+
+DEPENDENCIES
+ actionmailer (~> 3.1.1)
+ actionmailer_inline_css (~> 1.3.0)
+ activerecord (~> 3.1.1)
+ activerecord-jdbcpostgresql-adapter
+ amqp (~> 0.8.2)
+ data_migrations (~> 0.0.1)
+ database_cleaner (~> 0.6.7)
+ devise (~> 1.4.2)
+ factory_girl (~> 2.1.2)
+ hashr (~> 0.0.16)
+ jruby-openssl
+ mocha (~> 0.10.0)
+ nokogiri (~> 1.5.0)
+ oa-oauth (~> 0.3.0)
+ octokit (~> 0.6.5)
+ pusher (~> 0.8.1)
+ rabl (~> 0.5.0)
+ rails (~> 3.1.1)
+ rake (~> 0.9.2)
+ rspec (~> 2.7.0)
+ simple_states (~> 0.0.10)
+ thor (~> 0.14.6)
+ webmock (~> 1.7.7)
21 LICENSE
@@ -0,0 +1,21 @@
+MIT LICENSE
+
+Copyright (c) Sven Fuchs <svenfuchs@artweb-design.de>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
@@ -0,0 +1 @@
+# travis-core
@@ -0,0 +1,9 @@
+require 'rake'
+require 'rspec/core/rake_task'
+
+desc 'Run specs'
+RSpec::Core::RakeTask.new do |t|
+ t.pattern = './spec/**/*_spec.rb'
+end
+
+task :default => :spec
@@ -0,0 +1,15 @@
+class CreateRepositories < ActiveRecord::Migration
+ def self.up
+ create_table :repositories do |t|
+ t.string :name
+ t.string :url
+ t.integer :last_duration
+ t.datetime :last_built_at
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :repositories
+ end
+end
@@ -0,0 +1,26 @@
+class CreateBuilds < ActiveRecord::Migration
+ def self.up
+ create_table :builds do |t|
+ t.references :repository
+ t.integer :number
+ t.integer :status
+ t.datetime :started_at
+ t.datetime :finished_at
+ t.text :log, :default => ''
+ t.string :commit
+ t.text :message
+ t.datetime :committed_at
+ t.string :committer_name
+ t.string :committer_email
+ t.string :author_name
+ t.string :author_email
+ t.string :job_id
+ t.string :agent
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :builds
+ end
+end
@@ -0,0 +1,16 @@
+class DeviseCreateUsers < ActiveRecord::Migration
+ def self.up
+ create_table(:users) do |t|
+ t.string :name
+ t.string :login
+ t.string :email
+ t.timestamps
+ end
+
+ add_index :users, :login, :unique => true
+ end
+
+ def self.down
+ drop_table :users
+ end
+end
@@ -0,0 +1,13 @@
+class RepositoriesAddUsername < ActiveRecord::Migration
+ def self.up
+ change_table :repositories do |t|
+ t.string :username
+ end
+ end
+
+ def self.down
+ change_table :repositories do |t|
+ t.remove :username
+ end
+ end
+end
@@ -0,0 +1,13 @@
+class CreateTokens < ActiveRecord::Migration
+ def self.up
+ create_table :tokens do |t|
+ t.belongs_to :user
+ t.string :token
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :tokens
+ end
+end
Oops, something went wrong.

0 comments on commit 732fe00

Please sign in to comment.