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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2adff1bdfaba3fc2c58e62c74b6c7aff1611ab65
4
- data.tar.gz: 0878c8b9acd3d33856f654fba2ae32eac8028338
3
+ metadata.gz: 548a408bfc4e57cd36753dfc8f6d5430c17d0153
4
+ data.tar.gz: 6d8237671f4f92ef5b30c24b1d4645ee42085124
5
5
  SHA512:
6
- metadata.gz: 1f63ea366a1142774d8fccc8eb57983f7a212aa766daa26c43669a915a50b794ef243685e1aa1287713668f3dad5e7e7a4a608863755cf28c180fd454ea420d6
7
- data.tar.gz: 18a0a7cf764132fc7b536f99eea161772115872912798dee49a74871ec68454bb1fb9a31550d23b64d2c3b1fa212913d23e78b23b8241c754c953fba929f8abc
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.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
- def current
55
- if @current
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_git
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Satoshi Amemiya