ponytail 0.0.5 → 0.1.0
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/Gemfile +0 -4
- data/app/assets/javascripts/ponytail/create_table.js +13 -0
- data/app/assets/javascripts/ponytail/index.js +24 -0
- data/app/assets/javascripts/ponytail/migration_file.js +24 -0
- data/app/assets/javascripts/ponytail/new.js +69 -0
- data/app/views/ponytail/migrations/new.html.erb +1 -1
- data/lib/ponytail/version.rb +1 -1
- data/ponytail.gemspec +1 -0
- data/spec/javascripts/ponytail/{MigrationSpec.js → migration_file_spec.js} +0 -0
- metadata +21 -4
- data/app/assets/javascripts/ponytail/migrations.js +0 -134
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bd123ad0381ca9e4b1a1cda1776119edb61bb0b
|
4
|
+
data.tar.gz: ce92b6c142949b2bbede6e943ca4f3331403a950
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dad876d0050fc6a7f9ba642f70315bddf7bd68270ae18631cf767178df876d96a6dd5768739574765c73bf6dfaa79d9e6ca808aa3b6ab79a120830c1464c4f7b
|
7
|
+
data.tar.gz: f25774e73631379a6d76b3ace3f161bbe9bf1ee388d54e1822cd30cb296a5c88fee08999eddd29ca7b2546c0575d0dfdd2b77933b22ad78c21663774c9628188
|
data/Gemfile
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
function CreateTable() {
|
2
|
+
this.tableName = "";
|
3
|
+
}
|
4
|
+
CreateTable.prototype = {
|
5
|
+
setTableName: function(tableName) {
|
6
|
+
this.tableName = tableName;
|
7
|
+
},
|
8
|
+
toString: function() {
|
9
|
+
return ["create_table :" + this.tableName + " do |t|",
|
10
|
+
" t.timestamps",
|
11
|
+
"end"].join("\n");
|
12
|
+
}
|
13
|
+
};
|
@@ -0,0 +1,24 @@
|
|
1
|
+
function toggleMigrationRawContent() {
|
2
|
+
var elems = document.querySelectorAll(".pt_migration .pt_migration_header");
|
3
|
+
var func = function() {
|
4
|
+
var content = this.nextElementSibling;
|
5
|
+
content.style.display = content.style.display === "" ? "block" : "";
|
6
|
+
};
|
7
|
+
for(var i = 0; i < elems.length; i++) {
|
8
|
+
elems[i].onclick = func;
|
9
|
+
}
|
10
|
+
}
|
11
|
+
|
12
|
+
function closeNotice() {
|
13
|
+
var elem = document.querySelectorAll(".pt_close_notice")[0];
|
14
|
+
if (elem !== undefined) {
|
15
|
+
elem.onclick = function() {
|
16
|
+
this.parentElement.style.display = "none";
|
17
|
+
};
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
function setupMigrations() {
|
22
|
+
toggleMigrationRawContent();
|
23
|
+
closeNotice();
|
24
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
function MigrationFile() {
|
2
|
+
this.className = "";
|
3
|
+
this.commands = [];
|
4
|
+
}
|
5
|
+
MigrationFile.prototype = {
|
6
|
+
setClassName: function(className) {
|
7
|
+
this.className = className;
|
8
|
+
},
|
9
|
+
toString: function() {
|
10
|
+
return ["class " + this.className + " < ActiveRecord::Migration",
|
11
|
+
" def change",
|
12
|
+
this.toStringOfCommands(),
|
13
|
+
" end",
|
14
|
+
"end"].join("\n");
|
15
|
+
},
|
16
|
+
addCommand: function(command) {
|
17
|
+
this.commands.push(command);
|
18
|
+
},
|
19
|
+
toStringOfCommands: function() {
|
20
|
+
return this.commands.map(function(command) {
|
21
|
+
return command.toString();
|
22
|
+
}).join("\n").replace(/^/, " ").replace(/\n/g, "\n ");
|
23
|
+
}
|
24
|
+
};
|
@@ -0,0 +1,69 @@
|
|
1
|
+
function toggleEditRawContent() {
|
2
|
+
var elem = document.querySelectorAll(".pt_checkbox")[0];
|
3
|
+
elem.onclick = function() {
|
4
|
+
var raw_content = document.querySelectorAll(".pt_raw_content");
|
5
|
+
var text_area = raw_content[0].children[0];
|
6
|
+
text_area.disabled = !(text_area.disabled);
|
7
|
+
};
|
8
|
+
}
|
9
|
+
|
10
|
+
function getMigrationClassName() {
|
11
|
+
var elem = document.querySelectorAll(".pt_class_name input")[0];
|
12
|
+
return elem.value;
|
13
|
+
}
|
14
|
+
|
15
|
+
function getNewTableName() {
|
16
|
+
var elem = document.querySelectorAll(".pt_new_class_name input")[0];
|
17
|
+
return elem.value;
|
18
|
+
}
|
19
|
+
|
20
|
+
function inputClassName() {
|
21
|
+
var elems = document.querySelectorAll(".pt_class_name input");
|
22
|
+
elems[0].onkeyup = function() {
|
23
|
+
var file = new MigrationFile();
|
24
|
+
file.setClassName(this.value);
|
25
|
+
var command = new CreateTable();
|
26
|
+
command.setTableName(getNewTableName());
|
27
|
+
file.addCommand(command);
|
28
|
+
var area = document.querySelectorAll(".pt_raw_content textarea")[0];
|
29
|
+
area.value = file.toString();
|
30
|
+
};
|
31
|
+
}
|
32
|
+
|
33
|
+
function clickNewTable() {
|
34
|
+
var elem = document.querySelectorAll(".pt_new_table")[0];
|
35
|
+
elem.onclick = function() {
|
36
|
+
this.style.display = "none";
|
37
|
+
var form = document.querySelectorAll(".pt_new_table_form")[0];
|
38
|
+
form.style.display = "block";
|
39
|
+
};
|
40
|
+
}
|
41
|
+
|
42
|
+
function inputNewTableName() {
|
43
|
+
var elem = document.querySelectorAll(".pt_new_class_name input")[0];
|
44
|
+
elem.onkeyup = function() {
|
45
|
+
var file = new MigrationFile();
|
46
|
+
file.setClassName(getMigrationClassName());
|
47
|
+
var command = new CreateTable();
|
48
|
+
command.setTableName(this.value);
|
49
|
+
file.addCommand(command);
|
50
|
+
var area = document.querySelectorAll(".pt_raw_content textarea")[0];
|
51
|
+
area.value = file.toString();
|
52
|
+
};
|
53
|
+
}
|
54
|
+
|
55
|
+
function clickSubmitButton() {
|
56
|
+
var elem = document.querySelectorAll(".pt_submit")[0];
|
57
|
+
elem.onclick = function() {
|
58
|
+
var text_area = document.querySelectorAll(".pt_raw_content textarea")[0];
|
59
|
+
text_area.disabled = false;
|
60
|
+
};
|
61
|
+
}
|
62
|
+
|
63
|
+
function setupNewMigration() {
|
64
|
+
toggleEditRawContent();
|
65
|
+
inputClassName();
|
66
|
+
clickNewTable();
|
67
|
+
inputNewTableName();
|
68
|
+
clickSubmitButton();
|
69
|
+
}
|
data/lib/ponytail/version.rb
CHANGED
data/ponytail.gemspec
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ponytail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sinsoku
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: coveralls
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
description: Ponytail is a Rails engine that shows the migrations.
|
84
98
|
email:
|
85
99
|
- sinsoku.listy@gmail.com
|
@@ -96,7 +110,10 @@ files:
|
|
96
110
|
- README.md
|
97
111
|
- Rakefile
|
98
112
|
- app/assets/javascripts/ponytail/application.js
|
99
|
-
- app/assets/javascripts/ponytail/
|
113
|
+
- app/assets/javascripts/ponytail/create_table.js
|
114
|
+
- app/assets/javascripts/ponytail/index.js
|
115
|
+
- app/assets/javascripts/ponytail/migration_file.js
|
116
|
+
- app/assets/javascripts/ponytail/new.js
|
100
117
|
- app/assets/stylesheets/ponytail/application.css
|
101
118
|
- app/controllers/ponytail/migrations_controller.rb
|
102
119
|
- app/views/layouts/ponytail/application.html.erb
|
@@ -116,7 +133,7 @@ files:
|
|
116
133
|
- ponytail.gemspec
|
117
134
|
- spec/controllers/migrations_controller_spec.rb
|
118
135
|
- spec/javascripts/helpers/.keep
|
119
|
-
- spec/javascripts/ponytail/
|
136
|
+
- spec/javascripts/ponytail/migration_file_spec.js
|
120
137
|
- spec/javascripts/support/jasmine.yml
|
121
138
|
- spec/javascripts/support/jasmine_helper.rb
|
122
139
|
- spec/ponytail/migration_spec.rb
|
@@ -151,7 +168,7 @@ summary: Ponytail is a Rails engine that shows the migrations.
|
|
151
168
|
test_files:
|
152
169
|
- spec/controllers/migrations_controller_spec.rb
|
153
170
|
- spec/javascripts/helpers/.keep
|
154
|
-
- spec/javascripts/ponytail/
|
171
|
+
- spec/javascripts/ponytail/migration_file_spec.js
|
155
172
|
- spec/javascripts/support/jasmine.yml
|
156
173
|
- spec/javascripts/support/jasmine_helper.rb
|
157
174
|
- spec/ponytail/migration_spec.rb
|
@@ -1,134 +0,0 @@
|
|
1
|
-
function each(elems, func) {
|
2
|
-
if (!elems instanceof Array) { elems = [elems]; }
|
3
|
-
for (var i = elems.length; i--; ) {
|
4
|
-
func(elems[i]);
|
5
|
-
}
|
6
|
-
}
|
7
|
-
|
8
|
-
function onClick(elems, func) {
|
9
|
-
each(elems, function(elem) {
|
10
|
-
elem.onclick = func;
|
11
|
-
});
|
12
|
-
}
|
13
|
-
|
14
|
-
function toggleMigrationRawContent() {
|
15
|
-
var elems = document.querySelectorAll(".pt_migration .pt_migration_header");
|
16
|
-
onClick(elems, function() {
|
17
|
-
var content = this.nextElementSibling;
|
18
|
-
content.style.display = content.style.display === "" ? "block" : "";
|
19
|
-
});
|
20
|
-
}
|
21
|
-
|
22
|
-
function closeNotice() {
|
23
|
-
var elems = document.querySelectorAll(".pt_close_notice");
|
24
|
-
onClick(elems, function() {
|
25
|
-
this.parentElement.style.display = "none";
|
26
|
-
});
|
27
|
-
}
|
28
|
-
|
29
|
-
function toggleEditRawContent() {
|
30
|
-
var elems = document.querySelectorAll(".pt_checkbox");
|
31
|
-
onClick(elems, function() {
|
32
|
-
var raw_content = document.querySelectorAll(".pt_raw_content");
|
33
|
-
var text_area = raw_content[0].children[0];
|
34
|
-
text_area.disabled = !(text_area.disabled);
|
35
|
-
});
|
36
|
-
}
|
37
|
-
|
38
|
-
function MigrationFile() {
|
39
|
-
this.className = "";
|
40
|
-
this.commands = [];
|
41
|
-
}
|
42
|
-
|
43
|
-
MigrationFile.prototype.setClassName = function(className) {
|
44
|
-
this.className = className;
|
45
|
-
};
|
46
|
-
|
47
|
-
MigrationFile.prototype.toString = function() {
|
48
|
-
return ["class " + this.className + " < ActiveRecord::Migration",
|
49
|
-
" def change",
|
50
|
-
this.toStringOfCommands(),
|
51
|
-
" end",
|
52
|
-
"end"].join("\n");
|
53
|
-
};
|
54
|
-
|
55
|
-
MigrationFile.prototype.addCommand = function(command) {
|
56
|
-
this.commands.push(command);
|
57
|
-
};
|
58
|
-
|
59
|
-
MigrationFile.prototype.toStringOfCommands = function() {
|
60
|
-
return this.commands.map(function(command) {
|
61
|
-
return command.toString();
|
62
|
-
}).join("\n").replace(/^/, " ").replace(/\n/g, "\n ");
|
63
|
-
};
|
64
|
-
|
65
|
-
function CreateTable() {
|
66
|
-
this.tableName = "";
|
67
|
-
}
|
68
|
-
|
69
|
-
CreateTable.prototype.setTableName = function(tableName) {
|
70
|
-
this.tableName = tableName;
|
71
|
-
};
|
72
|
-
|
73
|
-
CreateTable.prototype.toString = function() {
|
74
|
-
return ["create_table :" + this.tableName + " do |t|",
|
75
|
-
" t.timestamps",
|
76
|
-
"end"].join("\n");
|
77
|
-
};
|
78
|
-
|
79
|
-
function getMigrationClassName() {
|
80
|
-
var elem = document.querySelectorAll(".pt_class_name input")[0];
|
81
|
-
return elem.value;
|
82
|
-
}
|
83
|
-
|
84
|
-
function getNewTableName() {
|
85
|
-
var elem = document.querySelectorAll(".pt_new_class_name input")[0];
|
86
|
-
return elem.value;
|
87
|
-
}
|
88
|
-
|
89
|
-
function inputClassName() {
|
90
|
-
var elems = document.querySelectorAll(".pt_class_name input");
|
91
|
-
elems[0].onkeyup = function() {
|
92
|
-
var file = new MigrationFile();
|
93
|
-
file.setClassName(this.value);
|
94
|
-
var command = new CreateTable();
|
95
|
-
command.setTableName(getNewTableName());
|
96
|
-
file.addCommand(command);
|
97
|
-
var area = document.querySelectorAll(".pt_raw_content textarea")[0];
|
98
|
-
area.value = file.toString();
|
99
|
-
};
|
100
|
-
}
|
101
|
-
|
102
|
-
function clickNewTable() {
|
103
|
-
var elem = document.querySelectorAll(".pt_new_table")[0];
|
104
|
-
elem.onclick = function() {
|
105
|
-
this.style.display = "none";
|
106
|
-
var form = document.querySelectorAll(".pt_new_table_form")[0];
|
107
|
-
form.style.display = "block";
|
108
|
-
};
|
109
|
-
}
|
110
|
-
|
111
|
-
function inputNewTableName() {
|
112
|
-
var elem = document.querySelectorAll(".pt_new_class_name input")[0];
|
113
|
-
elem.onkeyup = function() {
|
114
|
-
var file = new MigrationFile();
|
115
|
-
file.setClassName(getMigrationClassName());
|
116
|
-
var command = new CreateTable();
|
117
|
-
command.setTableName(this.value);
|
118
|
-
file.addCommand(command);
|
119
|
-
var area = document.querySelectorAll(".pt_raw_content textarea")[0];
|
120
|
-
area.value = file.toString();
|
121
|
-
};
|
122
|
-
}
|
123
|
-
|
124
|
-
function setupMigrations() {
|
125
|
-
toggleMigrationRawContent();
|
126
|
-
closeNotice();
|
127
|
-
}
|
128
|
-
|
129
|
-
function setupNewMigration() {
|
130
|
-
toggleEditRawContent();
|
131
|
-
inputClassName();
|
132
|
-
clickNewTable();
|
133
|
-
inputNewTableName();
|
134
|
-
}
|