acts_as_git 0.2.1 → 0.2.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.
- checksums.yaml +4 -4
- data/acts_as_git.gemspec +1 -1
- data/lib/acts_as_git.rb +14 -10
- 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: 2adff1bdfaba3fc2c58e62c74b6c7aff1611ab65
|
|
4
|
+
data.tar.gz: 0878c8b9acd3d33856f654fba2ae32eac8028338
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1f63ea366a1142774d8fccc8eb57983f7a212aa766daa26c43669a915a50b794ef243685e1aa1287713668f3dad5e7e7a4a608863755cf28c180fd454ea420d6
|
|
7
|
+
data.tar.gz: 18a0a7cf764132fc7b536f99eea161772115872912798dee49a74871ec68454bb1fb9a31550d23b64d2c3b1fa212913d23e78b23b8241c754c953fba929f8abc
|
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.2'
|
|
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
|
@@ -63,6 +63,20 @@ module ActsAsGit
|
|
|
63
63
|
(@is_changed)? true: false
|
|
64
64
|
end
|
|
65
65
|
|
|
66
|
+
def self.head
|
|
67
|
+
@@repo.head.target
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def self.sync
|
|
71
|
+
cred = Rugged::Credentials::SshKeyFromAgent.new(username: 'git')
|
|
72
|
+
@@origin.fetch(credentials: cred)
|
|
73
|
+
@@repo.checkout('origin/master', :strategy => :force)
|
|
74
|
+
branch = @@repo.branches["master"]
|
|
75
|
+
@@repo.branches.delete(branch) if branch
|
|
76
|
+
@@repo.create_branch('master')
|
|
77
|
+
@@repo.checkout('master', :strategy => :force)
|
|
78
|
+
end
|
|
79
|
+
|
|
66
80
|
define_method :path do |field|
|
|
67
81
|
filename = params[field].bind(self).call
|
|
68
82
|
File.join(self.class.repodir, filename)
|
|
@@ -95,16 +109,6 @@ module ActsAsGit
|
|
|
95
109
|
self
|
|
96
110
|
end
|
|
97
111
|
|
|
98
|
-
def self.sync
|
|
99
|
-
cred = Rugged::Credentials::SshKeyFromAgent.new(username: 'git')
|
|
100
|
-
@@origin.fetch(credentials: cred)
|
|
101
|
-
@@repo.checkout('origin/master', :strategy => :force)
|
|
102
|
-
branch = @@repo.branches["master"]
|
|
103
|
-
@@repo.branches.delete(branch) if branch
|
|
104
|
-
@@repo.create_branch('master')
|
|
105
|
-
@@repo.checkout('master', :strategy => :force)
|
|
106
|
-
end
|
|
107
|
-
|
|
108
112
|
define_method(:save_with_file) do |*args|
|
|
109
113
|
params.each do |field, filename_instance_method|
|
|
110
114
|
field_name = :"@#{field}"
|