Dahistory 1.0.1 → 1.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.
- data/Dahistory.gemspec +1 -1
- data/lib/Dahistory.rb +4 -4
- data/lib/Dahistory/version.rb +1 -1
- data/spec/main.rb +20 -20
- data/spec/tests/Dashistory.rb +4 -4
- metadata +4 -4
data/Dahistory.gemspec
CHANGED
data/lib/Dahistory.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'Dahistory/version'
|
2
|
-
require '
|
2
|
+
require 'Exit_0'
|
3
3
|
|
4
4
|
def Dahistory file = nil
|
5
5
|
da = Dahistory.new { |o|
|
@@ -105,11 +105,11 @@ class Dahistory
|
|
105
105
|
|
106
106
|
def git_it path
|
107
107
|
return false unless @git
|
108
|
-
|
109
|
-
|
108
|
+
Exit_0 "git add #{path}"
|
109
|
+
Exit_0 %! git commit -m "Backup: #{backup_file}"!
|
110
110
|
|
111
111
|
if @git.is_a?(String)
|
112
|
-
|
112
|
+
Exit_0 %! git push #{@git} !
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
data/lib/Dahistory/version.rb
CHANGED
data/spec/main.rb
CHANGED
@@ -12,14 +12,14 @@ def chdir
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def reset_dirs
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
15
|
+
Exit_0 "rm -rf #{FOLDER}"
|
16
|
+
Exit_0 "mkdir #{FOLDER}"
|
17
|
+
Exit_0 "mkdir #{FOLDER}/files"
|
18
|
+
Exit_0 "mkdir #{FOLDER}/history"
|
19
|
+
Exit_0 "mkdir #{FOLDER}/history/blue"
|
20
|
+
Exit_0 "mkdir #{FOLDER}/history/red"
|
21
|
+
Exit_0 "mkdir #{FOLDER}/history/yellow"
|
22
|
+
Exit_0 "mkdir #{FOLDER}/pending"
|
23
23
|
end
|
24
24
|
|
25
25
|
reset_dirs
|
@@ -29,20 +29,20 @@ shared( "git" ) {
|
|
29
29
|
before {
|
30
30
|
@proj = "#{FOLDER}/project_#{rand 1000}"
|
31
31
|
@git_repo = "#{@proj}.git"
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
Exit_0 "mkdir -p #{@git_repo}"
|
33
|
+
Exit_0 "cd #{@git_repo} && git init --bare"
|
34
|
+
Exit_0 "mkdir -p #{@proj}"
|
35
35
|
|
36
36
|
Dir.chdir(@proj) {
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
37
|
+
Exit_0 "mkdir files"
|
38
|
+
Exit_0 "mkdir history"
|
39
|
+
Exit_0 "mkdir pending"
|
40
|
+
Exit_0 "git init"
|
41
|
+
Exit_0 "git remote add origin #{@git_repo}"
|
42
|
+
Exit_0 "touch README.md"
|
43
|
+
Exit_0 "git add ."
|
44
|
+
Exit_0 %! git commit -m "First commit." !
|
45
|
+
Exit_0 "git push -u origin master"
|
46
46
|
}
|
47
47
|
@file = "files/#{rand 1000}.txt"
|
48
48
|
}
|
data/spec/tests/Dashistory.rb
CHANGED
@@ -143,7 +143,7 @@ describe "Dahistory :git_add_commit" do
|
|
143
143
|
rescue Dahistory::Pending => e
|
144
144
|
end
|
145
145
|
|
146
|
-
|
146
|
+
Exit_0('git log -n 1 --oneline --decorate=short')
|
147
147
|
.out[target].should == target
|
148
148
|
}
|
149
149
|
end
|
@@ -161,7 +161,7 @@ describe "Dahistory :git_add_commit" do
|
|
161
161
|
target = "Backup: #{o.backup_file}"
|
162
162
|
}
|
163
163
|
|
164
|
-
|
164
|
+
Exit_0('git log -n 1 --oneline --decorate=short')
|
165
165
|
.out[target].should == target
|
166
166
|
}
|
167
167
|
end
|
@@ -186,7 +186,7 @@ describe "Dahistory :git_add_commit_push" do
|
|
186
186
|
rescue Dahistory::Pending => e
|
187
187
|
end
|
188
188
|
|
189
|
-
|
189
|
+
Exit_0('git push 2>&1').out["Everything up-to-date"].should == "Everything up-to-date"
|
190
190
|
}
|
191
191
|
end
|
192
192
|
|
@@ -195,7 +195,7 @@ describe "Dahistory :git_add_commit_push" do
|
|
195
195
|
|
196
196
|
Dir.chdir(@proj) {
|
197
197
|
File.write @file, @file
|
198
|
-
should.raise(
|
198
|
+
should.raise(Exit_0::Non_0) {
|
199
199
|
Dahistory { |o|
|
200
200
|
o.file @file
|
201
201
|
o.git_add_commit_push "old_remote someting"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Dahistory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bacon
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
79
|
+
name: Exit_0
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
81
81
|
none: false
|
82
82
|
requirements:
|
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
131
|
version: '0'
|
132
132
|
requirements: []
|
133
133
|
rubyforge_project:
|
134
|
-
rubygems_version: 1.8.
|
134
|
+
rubygems_version: 1.8.23
|
135
135
|
signing_key:
|
136
136
|
specification_version: 3
|
137
137
|
summary: Compare file to previous history and backup.
|