acts_as_git 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/acts_as_git.gemspec +1 -1
- data/lib/acts_as_git.rb +15 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 548a408bfc4e57cd36753dfc8f6d5430c17d0153
|
4
|
+
data.tar.gz: 6d8237671f4f92ef5b30c24b1d4645ee42085124
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52fdcc5ab24e32e2a722de1cfc7a52607f04c3bb03918a63f1d978e366ce14bf884c5821b571dcfd2655144ad0453b30b18ee7f3819e9fc3f2bfdcf027d330c4
|
7
|
+
data.tar.gz: 3f9bc33d2e1be6575e4e63e5880b4b9b3035d80d87b0345456cb3b722e4dd4325cb1883425ab38605672c9f0a486394985e4ea3acc8698d39135113878ce7184
|
data/acts_as_git.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.homepage = "https://github.com/rail44/acts_as_git"
|
9
9
|
s.summary = "Make your field act as a git repo"
|
10
10
|
s.description = "Make your field act as a git repo. Save the content to a file, and load the content from a file."
|
11
|
-
s.version = '0.2.
|
11
|
+
s.version = '0.2.3'
|
12
12
|
s.date = Time.now.strftime("%Y-%m-%d")
|
13
13
|
|
14
14
|
s.extra_rdoc_files = Dir["*.rdoc"]
|
data/lib/acts_as_git.rb
CHANGED
@@ -49,22 +49,13 @@ module ActsAsGit
|
|
49
49
|
Rugged::Repository.init_at(repodir)
|
50
50
|
@@repo = Rugged::Repository.new(repodir)
|
51
51
|
end
|
52
|
-
@@origin = @@repo.remotes['origin'] || @@repo.remotes.create('origin', @@remote) if @@remote
|
53
52
|
|
54
|
-
|
55
|
-
if
|
56
|
-
@current
|
57
|
-
else
|
58
|
-
(@@repo.empty?)? nil: @@repo.head.target
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def is_changed?
|
63
|
-
(@is_changed)? true: false
|
53
|
+
if @@remote
|
54
|
+
@@origin = @@repo.remotes['origin'] || @@repo.remotes.create('origin', @@remote) if @@remote
|
64
55
|
end
|
65
56
|
|
66
57
|
def self.head
|
67
|
-
@@repo.head.target
|
58
|
+
(@@repo.empty?)? nil: @@repo.head.target
|
68
59
|
end
|
69
60
|
|
70
61
|
def self.sync
|
@@ -77,6 +68,18 @@ module ActsAsGit
|
|
77
68
|
@@repo.checkout('master', :strategy => :force)
|
78
69
|
end
|
79
70
|
|
71
|
+
def current
|
72
|
+
if @current
|
73
|
+
@current
|
74
|
+
else
|
75
|
+
self.class.head
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def is_changed?
|
80
|
+
(@is_changed)? true: false
|
81
|
+
end
|
82
|
+
|
80
83
|
define_method :path do |field|
|
81
84
|
filename = params[field].bind(self).call
|
82
85
|
File.join(self.class.repodir, filename)
|