ponytail 0.0.3 → 0.0.4
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 +4 -4
- data/Rakefile +3 -1
- data/app/assets/javascripts/jasmine_examples/Player.js +22 -0
- data/app/assets/javascripts/jasmine_examples/Song.js +7 -0
- data/app/assets/javascripts/ponytail/migrations.js +4 -1
- data/app/assets/stylesheets/ponytail/application.css +60 -0
- data/app/views/ponytail/migrations/_migration.html.erb +9 -7
- data/app/views/ponytail/migrations/_table.html.erb +5 -3
- data/app/views/ponytail/migrations/index.html.erb +3 -3
- data/app/views/ponytail/migrations/new.html.erb +23 -13
- data/lib/ponytail/migration.rb +1 -1
- data/lib/ponytail/schema.rb +6 -1
- data/lib/ponytail/version.rb +1 -1
- data/ponytail.gemspec +1 -0
- data/spec/javascripts/helpers/.keep +0 -0
- data/spec/javascripts/helpers/SpecHelper.js +9 -0
- data/spec/javascripts/jasmine_examples/PlayerSpec.js +58 -0
- data/spec/javascripts/support/jasmine.yml +76 -0
- data/spec/javascripts/support/jasmine_helper.rb +13 -0
- metadata +28 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee3b29d3740046a1e12155cc766af426c6694523
|
4
|
+
data.tar.gz: a9e134360624760a685ab675046022fb8431ff02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0812489fcccdfdedb8ae0ed4d8da0796e64a01f99d98b5b0f12eb91f4595c80bfbe41b65c396564080f139ee909ef09f9fb89b715009284b84b062909b805cea
|
7
|
+
data.tar.gz: a1d54bf1b29312b846173c82f4eb61843606c6f6e9255502702766f732bd35b5b88d7e5bfa026204a5be53e94b22c771d3f331cc14da032ce33e7e3f76c6975c
|
data/Rakefile
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
function Player() {
|
2
|
+
}
|
3
|
+
Player.prototype.play = function(song) {
|
4
|
+
this.currentlyPlayingSong = song;
|
5
|
+
this.isPlaying = true;
|
6
|
+
};
|
7
|
+
|
8
|
+
Player.prototype.pause = function() {
|
9
|
+
this.isPlaying = false;
|
10
|
+
};
|
11
|
+
|
12
|
+
Player.prototype.resume = function() {
|
13
|
+
if (this.isPlaying) {
|
14
|
+
throw new Error("song is already playing");
|
15
|
+
}
|
16
|
+
|
17
|
+
this.isPlaying = true;
|
18
|
+
};
|
19
|
+
|
20
|
+
Player.prototype.makeFavorite = function() {
|
21
|
+
this.currentlyPlayingSong.persistFavoriteStatus(true);
|
22
|
+
};
|
@@ -12,7 +12,7 @@ function onClick(elems, func) {
|
|
12
12
|
}
|
13
13
|
|
14
14
|
function toggleMigrationRawContent() {
|
15
|
-
var elems = document.querySelectorAll(".pt_migration .
|
15
|
+
var elems = document.querySelectorAll(".pt_migration .pt_migration_header");
|
16
16
|
onClick(elems, function() {
|
17
17
|
var content = this.nextElementSibling;
|
18
18
|
content.style.display = content.style.display === "" ? "block" : "";
|
@@ -30,3 +30,6 @@ function setupMigrations() {
|
|
30
30
|
toggleMigrationRawContent();
|
31
31
|
closeNotice();
|
32
32
|
}
|
33
|
+
|
34
|
+
function setupNewMigration() {
|
35
|
+
}
|
@@ -16,13 +16,33 @@
|
|
16
16
|
}
|
17
17
|
|
18
18
|
/* migration */
|
19
|
+
.pt_migration {
|
20
|
+
display: -moz-box;
|
21
|
+
display: -webkit-box;
|
22
|
+
}
|
23
|
+
|
24
|
+
.pt_migration .pt_current {
|
25
|
+
width: 60px;
|
26
|
+
}
|
27
|
+
|
28
|
+
.pt_migration .pt_migration_file {
|
29
|
+
margin-left: 5px;
|
30
|
+
}
|
31
|
+
|
19
32
|
.pt_migration .pt_name {
|
20
33
|
font-size: large;
|
21
34
|
font-weight: bold;
|
22
35
|
}
|
23
36
|
|
24
37
|
.pt_migration .pt_raw_content {
|
38
|
+
background: whitesmoke;
|
39
|
+
border-radius: 5px;
|
25
40
|
display: none;
|
41
|
+
padding: 5px;
|
42
|
+
}
|
43
|
+
|
44
|
+
.pt_migration .pt_raw_content pre {
|
45
|
+
margin: 5px 0;
|
26
46
|
}
|
27
47
|
|
28
48
|
/* notice */
|
@@ -45,3 +65,43 @@
|
|
45
65
|
.pt_new_errors ul {
|
46
66
|
margin: 3px 0;
|
47
67
|
}
|
68
|
+
|
69
|
+
/* new */
|
70
|
+
.pt_new {
|
71
|
+
display: -moz-box;
|
72
|
+
display: -webkit-box;
|
73
|
+
width: 1024px;
|
74
|
+
}
|
75
|
+
|
76
|
+
.pt_new .pt_schema {
|
77
|
+
-moz-box-flex: 1;
|
78
|
+
-webkit-box-flex: 1;
|
79
|
+
}
|
80
|
+
|
81
|
+
.pt_new .pt_schema .pt_table {
|
82
|
+
font-size: large;
|
83
|
+
font-weight: bold;
|
84
|
+
margin-top: 5px;
|
85
|
+
}
|
86
|
+
|
87
|
+
.pt_new .pt_columns {
|
88
|
+
display: -moz-box;
|
89
|
+
display: -webkit-box;
|
90
|
+
-moz-box-orient: vertical;
|
91
|
+
-webkit-box-orient: vertical;
|
92
|
+
margin-left: 15px;
|
93
|
+
}
|
94
|
+
|
95
|
+
.pt_new .pt_columns .pt_column {
|
96
|
+
display: -moz-box;
|
97
|
+
display: -webkit-box;
|
98
|
+
-moz-box-orient: horizontal;
|
99
|
+
-webkit-box-orient: horizontal;
|
100
|
+
}
|
101
|
+
|
102
|
+
.pt_new .pt_columns .pt_column .pt_column_type {
|
103
|
+
width: 100px;
|
104
|
+
}
|
105
|
+
|
106
|
+
.pt_new .pt_columns .pt_column .pt_column_name {
|
107
|
+
}
|
@@ -1,10 +1,12 @@
|
|
1
1
|
<div class="pt_migration">
|
2
|
-
<div class="
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
<div class="pt_current"><%= migration.version == @current_version ? "current" : "" %></div>
|
3
|
+
<div class="pt_migration_file">
|
4
|
+
<div class="pt_migration_header">
|
5
|
+
<span class="pt_name"><%= migration.name %></span>
|
6
|
+
<span class="pt_filename"><%= migration.filename %></span>
|
7
|
+
</div>
|
8
|
+
<div class="pt_raw_content">
|
9
|
+
<pre><%= migration.raw_content %></pre>
|
10
|
+
</div>
|
8
11
|
</div>
|
9
|
-
<pre class="pt_raw_content"><%= migration.raw_content %></pre>
|
10
12
|
</div>
|
@@ -1,7 +1,9 @@
|
|
1
1
|
<div class="pt_table"><%= table.name %></div>
|
2
|
-
<div>
|
2
|
+
<div class="pt_columns">
|
3
3
|
<% table.columns.each do |column| %>
|
4
|
-
<
|
5
|
-
|
4
|
+
<div class="pt_column">
|
5
|
+
<div class="pt_column_type">t.<%= column.type %></div>
|
6
|
+
<div class="pt_column_name"><%= column.name %></div>
|
7
|
+
</div>
|
6
8
|
<% end %>
|
7
9
|
</div>
|
@@ -6,9 +6,9 @@
|
|
6
6
|
<% end %>
|
7
7
|
|
8
8
|
<div class="pt_actions">
|
9
|
-
<%= button_to 'New', new_migration_path,
|
10
|
-
<%= button_to 'Migrate', migrate_migrations_path,
|
11
|
-
<%= button_to 'Rollback', rollback_migrations_path,
|
9
|
+
<%= button_to 'New', new_migration_path, method: :get, disabled: Ponytail::Migration.check_pending? %>
|
10
|
+
<%= button_to 'Migrate', migrate_migrations_path, disabled: Ponytail::Migration.check_pending? %>
|
11
|
+
<%= button_to 'Rollback', rollback_migrations_path, disabled: Ponytail::Migration.check_pending? %>
|
12
12
|
</div>
|
13
13
|
</div>
|
14
14
|
|
@@ -1,18 +1,28 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
<div class="pt_new">
|
2
|
+
<div class="pt_schema">
|
3
|
+
<% @schema.tables.each do |t| %>
|
4
|
+
<%= render 'table', table: t %>
|
5
|
+
<% end %>
|
6
|
+
</div>
|
3
7
|
|
4
|
-
|
5
|
-
|
8
|
+
<div>
|
9
|
+
<%= form_for @migration, url: migrations_path do |f| %>
|
10
|
+
<%= render 'new_errors', migration: @migration %>
|
6
11
|
|
7
|
-
|
8
|
-
|
9
|
-
</div>
|
12
|
+
<span>Class Name</span>
|
13
|
+
<%= f.text_field :name %>
|
10
14
|
|
11
|
-
|
12
|
-
|
15
|
+
<div class="pt_raw_content">
|
16
|
+
<%= f.text_area :raw_content, size: '60x20' %>
|
17
|
+
</div>
|
13
18
|
|
14
|
-
<%=
|
19
|
+
<%= f.submit 'Update' %>
|
20
|
+
<% end %>
|
21
|
+
|
22
|
+
<%= button_to 'Cancel', migrations_path, method: :get %>
|
23
|
+
</div>
|
24
|
+
</div>
|
15
25
|
|
16
|
-
|
17
|
-
|
18
|
-
|
26
|
+
<script type='text/javascript'>
|
27
|
+
setupNewMigration();
|
28
|
+
</script>
|
data/lib/ponytail/migration.rb
CHANGED
@@ -38,7 +38,7 @@ module Ponytail
|
|
38
38
|
def save
|
39
39
|
if valid?
|
40
40
|
next_filename = "#{Migration.migrations_path}/#{Migration.next_version}_#{name.underscore}.rb"
|
41
|
-
open(next_filename, 'w').write(raw_content)
|
41
|
+
open(next_filename, 'w') { |f| f.write(raw_content) }
|
42
42
|
true
|
43
43
|
else
|
44
44
|
false
|
data/lib/ponytail/schema.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
module Ponytail
|
2
2
|
class Schema
|
3
3
|
def tables
|
4
|
-
|
4
|
+
table_names.sort.map { |t| Table.new(t) }
|
5
|
+
end
|
6
|
+
|
7
|
+
private
|
8
|
+
def table_names
|
9
|
+
ActiveRecord::Base.connection.tables.delete_if { |t| t == 'schema_migrations' }
|
5
10
|
end
|
6
11
|
end
|
7
12
|
|
data/lib/ponytail/version.rb
CHANGED
data/ponytail.gemspec
CHANGED
File without changes
|
@@ -0,0 +1,58 @@
|
|
1
|
+
describe("Player", function() {
|
2
|
+
var player;
|
3
|
+
var song;
|
4
|
+
|
5
|
+
beforeEach(function() {
|
6
|
+
player = new Player();
|
7
|
+
song = new Song();
|
8
|
+
});
|
9
|
+
|
10
|
+
it("should be able to play a Song", function() {
|
11
|
+
player.play(song);
|
12
|
+
expect(player.currentlyPlayingSong).toEqual(song);
|
13
|
+
|
14
|
+
//demonstrates use of custom matcher
|
15
|
+
expect(player).toBePlaying(song);
|
16
|
+
});
|
17
|
+
|
18
|
+
describe("when song has been paused", function() {
|
19
|
+
beforeEach(function() {
|
20
|
+
player.play(song);
|
21
|
+
player.pause();
|
22
|
+
});
|
23
|
+
|
24
|
+
it("should indicate that the song is currently paused", function() {
|
25
|
+
expect(player.isPlaying).toBeFalsy();
|
26
|
+
|
27
|
+
// demonstrates use of 'not' with a custom matcher
|
28
|
+
expect(player).not.toBePlaying(song);
|
29
|
+
});
|
30
|
+
|
31
|
+
it("should be possible to resume", function() {
|
32
|
+
player.resume();
|
33
|
+
expect(player.isPlaying).toBeTruthy();
|
34
|
+
expect(player.currentlyPlayingSong).toEqual(song);
|
35
|
+
});
|
36
|
+
});
|
37
|
+
|
38
|
+
// demonstrates use of spies to intercept and test method calls
|
39
|
+
it("tells the current song if the user has made it a favorite", function() {
|
40
|
+
spyOn(song, 'persistFavoriteStatus');
|
41
|
+
|
42
|
+
player.play(song);
|
43
|
+
player.makeFavorite();
|
44
|
+
|
45
|
+
expect(song.persistFavoriteStatus).toHaveBeenCalledWith(true);
|
46
|
+
});
|
47
|
+
|
48
|
+
//demonstrates use of expected exceptions
|
49
|
+
describe("#resume", function() {
|
50
|
+
it("should throw an exception if song is already playing", function() {
|
51
|
+
player.play(song);
|
52
|
+
|
53
|
+
expect(function() {
|
54
|
+
player.resume();
|
55
|
+
}).toThrow("song is already playing");
|
56
|
+
});
|
57
|
+
});
|
58
|
+
});
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# src_files
|
2
|
+
#
|
3
|
+
# Return an array of filepaths relative to src_dir to include before jasmine specs.
|
4
|
+
# Default: []
|
5
|
+
#
|
6
|
+
# EXAMPLE:
|
7
|
+
#
|
8
|
+
# src_files:
|
9
|
+
# - lib/source1.js
|
10
|
+
# - lib/source2.js
|
11
|
+
# - dist/**/*.js
|
12
|
+
#
|
13
|
+
src_files:
|
14
|
+
- app/assets/javascripts/**/*.js
|
15
|
+
|
16
|
+
# stylesheets
|
17
|
+
#
|
18
|
+
# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
|
19
|
+
# Default: []
|
20
|
+
#
|
21
|
+
# EXAMPLE:
|
22
|
+
#
|
23
|
+
# stylesheets:
|
24
|
+
# - css/style.css
|
25
|
+
# - stylesheets/*.css
|
26
|
+
#
|
27
|
+
stylesheets:
|
28
|
+
- app/stylesheets/**/*.css
|
29
|
+
|
30
|
+
# helpers
|
31
|
+
#
|
32
|
+
# Return an array of filepaths relative to spec_dir to include before jasmine specs.
|
33
|
+
# Default: ["helpers/**/*.js"]
|
34
|
+
#
|
35
|
+
# EXAMPLE:
|
36
|
+
#
|
37
|
+
# helpers:
|
38
|
+
# - helpers/**/*.js
|
39
|
+
#
|
40
|
+
helpers:
|
41
|
+
- helpers/**/*.js
|
42
|
+
|
43
|
+
# spec_files
|
44
|
+
#
|
45
|
+
# Return an array of filepaths relative to spec_dir to include.
|
46
|
+
# Default: ["**/*[sS]pec.js"]
|
47
|
+
#
|
48
|
+
# EXAMPLE:
|
49
|
+
#
|
50
|
+
# spec_files:
|
51
|
+
# - **/*[sS]pec.js
|
52
|
+
#
|
53
|
+
spec_files:
|
54
|
+
- '**/*[sS]pec.js'
|
55
|
+
|
56
|
+
# src_dir
|
57
|
+
#
|
58
|
+
# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
|
59
|
+
# Default: project root
|
60
|
+
#
|
61
|
+
# EXAMPLE:
|
62
|
+
#
|
63
|
+
# src_dir: public
|
64
|
+
#
|
65
|
+
src_dir:
|
66
|
+
|
67
|
+
# spec_dir
|
68
|
+
#
|
69
|
+
# Spec directory path. Your spec_files must be returned relative to this path.
|
70
|
+
# Default: spec/javascripts
|
71
|
+
#
|
72
|
+
# EXAMPLE:
|
73
|
+
#
|
74
|
+
# spec_dir: spec/javascripts
|
75
|
+
#
|
76
|
+
spec_dir: spec/javascripts
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#Use this file to set/override Jasmine configuration options
|
2
|
+
#You can remove it if you don't need it.
|
3
|
+
#This file is loaded *after* jasmine.yml is interpreted.
|
4
|
+
#
|
5
|
+
#Example: using a different boot file.
|
6
|
+
#Jasmine.configure do |config|
|
7
|
+
# @config.boot_dir = '/absolute/path/to/boot_dir'
|
8
|
+
# @config.boot_files = lambda { ['/absolute/path/to/boot_dir/file.js'] }
|
9
|
+
#end
|
10
|
+
#
|
11
|
+
Jasmine.configure do |config|
|
12
|
+
config.browser = :phantomjs
|
13
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ponytail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
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-
|
11
|
+
date: 2013-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: jasmine
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description: Ponytail is a Rails engine that shows the migrations.
|
70
84
|
email:
|
71
85
|
- sinsoku.listy@gmail.com
|
@@ -81,6 +95,8 @@ files:
|
|
81
95
|
- LICENSE.txt
|
82
96
|
- README.md
|
83
97
|
- Rakefile
|
98
|
+
- app/assets/javascripts/jasmine_examples/Player.js
|
99
|
+
- app/assets/javascripts/jasmine_examples/Song.js
|
84
100
|
- app/assets/javascripts/ponytail/application.js
|
85
101
|
- app/assets/javascripts/ponytail/migrations.js
|
86
102
|
- app/assets/stylesheets/ponytail/application.css
|
@@ -101,6 +117,11 @@ files:
|
|
101
117
|
- lib/rails/mapper.rb
|
102
118
|
- ponytail.gemspec
|
103
119
|
- spec/controllers/migrations_controller_spec.rb
|
120
|
+
- spec/javascripts/helpers/.keep
|
121
|
+
- spec/javascripts/helpers/SpecHelper.js
|
122
|
+
- spec/javascripts/jasmine_examples/PlayerSpec.js
|
123
|
+
- spec/javascripts/support/jasmine.yml
|
124
|
+
- spec/javascripts/support/jasmine_helper.rb
|
104
125
|
- spec/ponytail/migration_spec.rb
|
105
126
|
- spec/ponytail/schema_spec.rb
|
106
127
|
- spec/ponytail_spec.rb
|
@@ -132,6 +153,11 @@ specification_version: 4
|
|
132
153
|
summary: Ponytail is a Rails engine that shows the migrations.
|
133
154
|
test_files:
|
134
155
|
- spec/controllers/migrations_controller_spec.rb
|
156
|
+
- spec/javascripts/helpers/.keep
|
157
|
+
- spec/javascripts/helpers/SpecHelper.js
|
158
|
+
- spec/javascripts/jasmine_examples/PlayerSpec.js
|
159
|
+
- spec/javascripts/support/jasmine.yml
|
160
|
+
- spec/javascripts/support/jasmine_helper.rb
|
135
161
|
- spec/ponytail/migration_spec.rb
|
136
162
|
- spec/ponytail/schema_spec.rb
|
137
163
|
- spec/ponytail_spec.rb
|