git_scratch 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e773a9830ca7b8ac3af5d7bcdf0b55208165e47f
|
4
|
+
data.tar.gz: e7418d1302a9eafd4ffb33ad0a1cb9e8854d087e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6885a6bb042ad35a262ec3296634055aafb44ff19d1b33a6a24ccdd72aa6236a158340e5031f85a094dc319cdb3c1b2206c943d2b3a4eaae765561fd2576491
|
7
|
+
data.tar.gz: a42b4bdfc71a0a8bb6a4b974ec7cc833cec953f25f4c8f915f64f19f0a52d752753934f11ac41675bc144713e499a8aa9cca060aaaf50dec2cddec7eb84bec0b
|
data/git_scratch.gemspec
CHANGED
@@ -14,6 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
|
15
15
|
spec.add_dependency 'rails', '>= 3.0.0'
|
16
16
|
spec.add_dependency 'thor', '>= 0.19.1'
|
17
|
+
spec.rubyforge_project = 'git_scratch'
|
17
18
|
|
18
19
|
spec.files = `git ls-files`.split("\n")
|
19
20
|
spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
@@ -6,13 +6,78 @@ module CommonMethods
|
|
6
6
|
included do
|
7
7
|
desc 'GitScratch rails app'
|
8
8
|
|
9
|
-
argument :
|
9
|
+
argument :new_remote_path, :type => :string, :default => ''
|
10
10
|
end
|
11
11
|
|
12
12
|
protected
|
13
13
|
|
14
14
|
def perform
|
15
|
-
puts "perform in commons...."
|
15
|
+
puts "perform in commons....GitScratch"
|
16
|
+
@remote_path = new_remote_path.to_s.strip
|
17
|
+
change_remote_path
|
18
|
+
reset_all_commits
|
19
|
+
end
|
20
|
+
|
21
|
+
def reset_all_commits
|
22
|
+
begin
|
23
|
+
if get_choice("Want to reset all commits (y/n) : ")
|
24
|
+
puts "Resetting all commit messages"
|
25
|
+
`git checkout --orphan latest_branch`
|
26
|
+
sleep 3
|
27
|
+
`git add -A`
|
28
|
+
sleep 3
|
29
|
+
`git commit -am "git_scratch initial commit"`
|
30
|
+
sleep 3
|
31
|
+
`git branch -D master`
|
32
|
+
sleep 3
|
33
|
+
`git branch -m master`
|
34
|
+
sleep 3
|
35
|
+
current_branch = `git rev-parse --abbrev-ref HEAD`
|
36
|
+
puts "Current Branch => #{current_branch.to_s}"
|
37
|
+
puts "Use command 'git push -f origin master' to update the repo"
|
38
|
+
|
39
|
+
end
|
40
|
+
rescue => e
|
41
|
+
puts "error => #{e}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def get_choice(msg = '')
|
46
|
+
puts "#{msg}" if msg.present?
|
47
|
+
flag = STDIN.gets.strip.downcase
|
48
|
+
if flag == 'n'
|
49
|
+
return false
|
50
|
+
elsif flag == 'y'
|
51
|
+
return true
|
52
|
+
else
|
53
|
+
puts "Please enter 'y' or 'n' :"
|
54
|
+
get_choice
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def change_remote_path
|
59
|
+
begin
|
60
|
+
`git remote remove origin`
|
61
|
+
if @remote_path.blank?
|
62
|
+
puts "Want to add new remote path(y/n):"
|
63
|
+
if get_choice
|
64
|
+
puts "Enter remote path :"
|
65
|
+
@remote_path = STDIN.gets.strip.downcase
|
66
|
+
puts "Invalid remote path." if @remote_path.blank?
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
puts "Changing remote path"
|
71
|
+
if @remote_path.present?
|
72
|
+
`git remote add origin #{@remote_path}`
|
73
|
+
end
|
74
|
+
current_remotes = `git remote -v`
|
75
|
+
if current_remotes.to_s.strip.present?
|
76
|
+
puts "current remotes => \n#{current_remotes.to_s}"
|
77
|
+
end
|
78
|
+
rescue => e
|
79
|
+
puts "error => #{e}"
|
80
|
+
end
|
16
81
|
end
|
17
82
|
|
18
83
|
end
|
data/lib/git_scratch/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_scratch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kshitij Yadav
|
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: '0'
|
74
74
|
requirements: []
|
75
|
-
rubyforge_project:
|
75
|
+
rubyforge_project: git_scratch
|
76
76
|
rubygems_version: 2.6.14
|
77
77
|
signing_key:
|
78
78
|
specification_version: 4
|