Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
7dffec2c
Commit
7dffec2c
authored
Jan 29, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP - add migration
parent
eb51a4ac
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
0 deletions
+54
-0
db/migrate/20160129135155_remove_dot_atom_path_ending_of_projects.rb
...20160129135155_remove_dot_atom_path_ending_of_projects.rb
+54
-0
No files found.
db/migrate/20160129135155_remove_dot_atom_path_ending_of_projects.rb
0 → 100644
View file @
7dffec2c
class
RemoveDotAtomPathEndingOfProjects
<
ActiveRecord
::
Migration
class
ProjectPath
def
initilize
(
old_path
)
@old_path
=
old_path
end
def
clean_path
@_clean_path
||=
PathCleaner
.
clean
(
@old_path
)
end
end
module
PathCleaner
def
initialize
(
path
)
@path
=
path
end
def
self
.
clean
(
*
args
)
new
(
*
args
).
clean
end
def
clean
path
=
cleaned_path
count
=
0
while
path_exists?
(
path
)
path
=
"
#{
cleaned_path
}#{
count
}
"
count
+=
1
end
path
end
def
cleaned_path
@_cleaned_path
||=
path
.
gsub
(
/\.atom\z/
,
'-atom'
)
end
def
path_exists?
(
path
)
Project
.
find_by_path
(
path
)
end
end
def
up
projects_with_dot_atom
.
each
do
|
project
|
remove_dot
(
project
)
end
end
private
def
remove_dot
(
project
)
#TODO
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment