plus2_version 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,10 @@
1
+ if defined?(Rails::Railtie)
2
+ module Plus2Version
3
+ class Railtie < Rails::Railtie
4
+
5
+ initializer :plus2_version_routes do |app|
6
+ end
7
+ end
8
+ end
9
+ end
10
+
@@ -1,3 +1,3 @@
1
1
  module Plus2Version
2
- Version = '0.0.2'
2
+ Version = '0.0.3'
3
3
  end
@@ -0,0 +1,28 @@
1
+ module Plus2Version
2
+ class VersionFinder
3
+ class << self
4
+
5
+ def as_hash
6
+ {
7
+ :log => git('log HEAD^.. --shortstat --no-color --decorate').split("\n")
8
+ }
9
+ end
10
+
11
+ def sha
12
+ git('rev-parse HEAD').chomp
13
+ end
14
+
15
+ def git(cmd)
16
+ git = Plus2Version.git_path || 'git'
17
+ Dir.chdir(Rails.root) do
18
+ `#{git} #{cmd}`.chomp.tap {|output|
19
+ output.replace('problem running git') unless $?.success?
20
+ }
21
+ end
22
+ end
23
+ end
24
+
25
+ LoadTimeSha = self.sha
26
+ LoadTimeLog = self.as_hash
27
+ end
28
+ end
data/lib/plus2_version.rb CHANGED
@@ -3,9 +3,12 @@ module Plus2Version
3
3
  end
4
4
  require 'plus2_version/routes'
5
5
 
6
+ autoload :VersionFinder, "plus2_version/version_finder"
7
+
6
8
  def self.git_path=(git_path)
7
9
  @git_path = git_path
8
10
  end
11
+
9
12
  def self.git_path
10
13
  @git_path
11
14
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plus2_version
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Lachie Cox
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-13 00:00:00 +11:00
18
+ date: 2011-03-05 00:00:00 +11:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -29,8 +29,10 @@ extensions: []
29
29
  extra_rdoc_files: []
30
30
 
31
31
  files:
32
+ - lib/plus2_version/railtie.rb
32
33
  - lib/plus2_version/routes.rb
33
34
  - lib/plus2_version/version.rb
35
+ - lib/plus2_version/version_finder.rb
34
36
  - lib/plus2_version.rb
35
37
  - Readme.md
36
38
  has_rdoc: true