ponytail 0.0.1 → 0.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c75b33fbb39b0a78274a6a673377999cddb9fce9
4
- data.tar.gz: 6123f5e28927dcc5daeb3c5e34472d7f6917f844
3
+ metadata.gz: 3abe40fddc7790c3c4df41e86756bff646adb10a
4
+ data.tar.gz: 0b5606b7198008fee75171c6c62926b6fc2bbc71
5
5
  SHA512:
6
- metadata.gz: 301713b64534b02506f7abdc73da999960707224a8a93bd3231a4b07f3a442866f8a21c2e1f5e99e5f63e22d5a60dfbcf4c7423e6496c04699119d543150ba28
7
- data.tar.gz: 84b27835b843b182da3443a121979a8fb0617ac812db26b863e2395ee513b15049ba04a9dccfcb76da9b4742350a4d3f0fdfe35f3cb811aa1fca8110a12b4cca
6
+ metadata.gz: ed5138f2740020d332fcacd9ca100046b01fb7573face47cb000768db84d307d5cdb9ab08a0d7cf97fc47a680b39ba072bae20aefab98c97998404ae689155a7
7
+ data.tar.gz: dae7e9101eb822be5f73c9a9917bdccca4648eaf5f573b7e587aea6182e07180141b217d87a34fc0de373a668a57c7359690c300568f1ec919395278794ad050
data/.travis.yml CHANGED
@@ -1,3 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.0.0
4
+ branches:
5
+ only:
6
+ - master
7
+ - develop
8
+ notifications:
9
+ email: false
data/README.md CHANGED
@@ -1,24 +1,35 @@
1
1
  # Ponytail
2
2
 
3
+ [![Build Status](https://travis-ci.org/sinsoku/ponytail.png?branch=develop)](https://travis-ci.org/sinsoku/ponytail)
4
+
3
5
  Ponytail is a Rails engine that shows the migrations.
4
6
 
5
7
  ## Installation
6
8
 
7
- Add this line to your application's Gemfile:
9
+ Add `ponytail` to `:development` groups in your application's Gemfile:
8
10
 
9
- gem 'ponytail'
11
+ ```ruby
12
+ group :development do
13
+ gem 'ponytail'
14
+ end
15
+ ```
10
16
 
11
17
  And then execute:
12
18
 
13
- $ bundle
19
+ ```bash
20
+ $ bundle
21
+ ```
14
22
 
15
- Or install it yourself as:
23
+ Comment out `config.active_record.migration_error` in `config/environments/development.rb`.
16
24
 
17
- $ gem install ponytail
25
+ ```ruby
26
+ # Raise an error on page load if there are pending migrations
27
+ # config.active_record.migration_error = :page_load
28
+ ```
18
29
 
19
30
  ## Usage
20
31
 
21
- TODO: Write usage instructions here
32
+ Visit `/rails/migrations` in your app.
22
33
 
23
34
  ## Contributing
24
35
 
@@ -0,0 +1 @@
1
+ <span class="pt_notice"><%= notice %></span>
@@ -1,11 +1,13 @@
1
+ <%= render 'notice' %>
2
+
1
3
  <% @migrations.each do |migration| %>
2
4
  <%= render 'migration', migration: migration, current: @current_version %>
3
5
  <% end %>
4
6
 
5
7
  <div class="pt_actions">
6
- <%= button_to 'New', new_migration_path, class: 'pt_new', method: :get %>
7
- <%= button_to 'Migrate', migrate_migrations_path, class: 'pt_migrate' %>
8
- <%= button_to 'Rollback', rollback_migrations_path, class: 'pt_rallback' %>
8
+ <%= button_to 'New', new_migration_path, class: 'pt_new', method: :get, disabled: Ponytail::Migration.check_pending? %>
9
+ <%= button_to 'Migrate', migrate_migrations_path, class: 'pt_migrate', disabled: Ponytail::Migration.check_pending? %>
10
+ <%= button_to 'Rollback', rollback_migrations_path, class: 'pt_rallback', disabled: Ponytail::Migration.check_pending? %>
9
11
  </div>
10
12
 
11
13
  <script type='text/javascript'>
@@ -1,3 +1,5 @@
1
+ <%= render 'notice' %>
2
+
1
3
  <%= form_for @migration, url: migrations_path do |f| %>
2
4
  <%= f.label :name %>
3
5
  <%= f.text_field :name %>
data/config/routes.rb CHANGED
@@ -1,8 +1,3 @@
1
1
  Rails.application.routes.draw do
2
- resources :migrations, only: [:index, :new, :create], module: :ponytail, path: 'rails/migrations' do
3
- collection do
4
- post :migrate
5
- post :rollback
6
- end
7
- end
2
+ mount_ponytail
8
3
  end
@@ -4,6 +4,10 @@ module Ponytail
4
4
  attr_accessor :name, :filename, :version, :raw_content
5
5
 
6
6
  class << self
7
+ def check_pending?
8
+ Rails.application.config.middleware.include?(ActiveRecord::Migration::CheckPending)
9
+ end
10
+
7
11
  def all
8
12
  proxys = ActiveRecord::Migrator.migrations(migrations_paths)
9
13
  proxys.map { |p| new(name: p.name, filename: p.filename, version: p.version) }
@@ -1,3 +1,3 @@
1
1
  module Ponytail
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/ponytail.rb CHANGED
@@ -1,2 +1,3 @@
1
1
  require 'ponytail/engine'
2
2
  require 'ponytail/migration'
3
+ require 'rails/mapper'
@@ -0,0 +1,12 @@
1
+ module ActionDispatch::Routing
2
+ class Mapper
3
+ def mount_ponytail
4
+ resources :migrations, only: [:index, :new, :create], module: :ponytail, path: 'rails/migrations' do
5
+ collection do
6
+ post :migrate
7
+ post :rollback
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
data/ponytail.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency 'rails'
21
+ spec.add_dependency 'rails', '~> 4.0'
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.3"
24
24
  spec.add_development_dependency "rake"
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ponytail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - sinsoku
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-03 00:00:00.000000000 Z
11
+ date: 2013-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -86,6 +86,7 @@ files:
86
86
  - app/controllers/ponytail/migrations_controller.rb
87
87
  - app/views/layouts/ponytail/application.html.erb
88
88
  - app/views/ponytail/migrations/_migration.html.erb
89
+ - app/views/ponytail/migrations/_notice.html.erb
89
90
  - app/views/ponytail/migrations/index.html.erb
90
91
  - app/views/ponytail/migrations/new.html.erb
91
92
  - config/routes.rb
@@ -93,6 +94,7 @@ files:
93
94
  - lib/ponytail/engine.rb
94
95
  - lib/ponytail/migration.rb
95
96
  - lib/ponytail/version.rb
97
+ - lib/rails/mapper.rb
96
98
  - ponytail.gemspec
97
99
  - spec/migration_spec.rb
98
100
  - spec/ponytail_spec.rb