rinfo 0.1.2 → 0.1.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: 2ef45bcac62d24bde6ca081f30cb07c2378ebabc
4
- data.tar.gz: 4ae40805b18e2935917768eb86e49a108bfdfcdc
3
+ metadata.gz: 48bf8ab63486dafa4d75ae5648ea021cfc24670e
4
+ data.tar.gz: 24aca6b70c28dae0ce9acf3f8328a58ef32e5bbb
5
5
  SHA512:
6
- metadata.gz: 54b50f87424e960cf2da52729b6b40acd217a64d0919ed6281f35439eafda2e02ea2aefa0e5bbe71aeac9a17c43a8e8ee2e24828090577ce578a2167acaaa313
7
- data.tar.gz: 89a72994604b35ef3c86af49174480da4a0123ce30c54ec00ab92905f37831d12ea481ca23a275baa9f989c14f7b9b8636b3c163bed50058627577eea7520884
6
+ metadata.gz: aea752affa94e2246eec334ab5d80c4ac95acee8d0a0a660c9be8b9989df98d1265231dd98f1be657c6f9b17007c4073f1eb6181a6adb8fefe6228ba57c716d5
7
+ data.tar.gz: f1b8a6bbbf7720d10f329cf555676d7a6c1c4b9e749272fbec882eb1ee8800a76dea4e19f10f5757e4c5383dd99639128602201c5d2cb6fdc2a334fb1b7630bf
@@ -0,0 +1,5 @@
1
+ ---
2
+ release:
3
+ tag: true
4
+
5
+ # vim:ft=yaml
@@ -1,4 +1,4 @@
1
- Copyright 2014 YOURNAME
1
+ Copyright 2014 Rafe Colton
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -18,18 +18,28 @@ Accessing your `rinfo.json` page will product something like this:
18
18
 
19
19
  ```javascript
20
20
  {
21
- Deployed By: "Rafe Colton",
22
- Deployed At: "2014-03-17 15:18:35 -0700",
23
- Rails Env: "development",
24
- Branch: "master",
25
- Rev: "018f44579795167c56066c013b4b18e196142ecb"
21
+ deployed_by: "Rafe Colton",
22
+ deployed_at: "2014-03-17 15:18:35 -0700",
23
+ rails_env: "development",
24
+ branch: "master",
25
+ rev: "018f44579795167c56066c013b4b18e196142ecb"
26
26
  }
27
27
  ```
28
28
 
29
29
  It's as easy as that!
30
30
 
31
- **NOTE:** For now, the `Deployed At` value is being estimated as the
32
- timestamp on the most latest commit.
31
+ ### A Note About Estimation
32
+
33
+ It is not always the case that the release information above is
34
+ available, so sometimes, it has to be estimated. In addition, Rinfo
35
+ does not make any assumptions about how you deploy your application, and
36
+ not all deployment methods make it possible to inject your release
37
+ information at deploy time. Therefore, the following estimations are
38
+ made at run time:
39
+
40
+ * `deployed_by`: estimated as the git config `user.name`, or, if that is
41
+ not available, the author name on the most recent commit
42
+ * `deployed_at`: estimated as timestamp of the most recent commit
33
43
 
34
44
  ## Installation
35
45
 
@@ -59,7 +59,8 @@ class Rinfo
59
59
  end
60
60
 
61
61
  def author
62
- git.config('user.name')
62
+ name = git.config('user.name')
63
+ name.blank? ? git.log.first.author.name : name
63
64
  end
64
65
 
65
66
  def date
@@ -2,6 +2,6 @@
2
2
 
3
3
  unless defined?(Rinfo::VERSION)
4
4
  class Rinfo
5
- VERSION = '0.1.2'
5
+ VERSION = '0.1.3'
6
6
  end
7
7
  end
@@ -11,21 +11,21 @@ describe RinfoController, type: :controller do
11
11
  Dir.chdir(@tmpdir)
12
12
 
13
13
  # initialize a git repository
14
- git = Git.init(Dir.pwd)
14
+ @git = Git.init(Dir.pwd)
15
15
  FileUtils.touch("#{Dir.pwd}/initial-file.txt")
16
16
  @name = 'Spec Ninja'
17
- git.config('user.name', @name)
18
- git.config('user.email', 'spec_ninja@example.com')
19
- git.add
20
- git.commit('initial commit')
17
+ @git.config('user.name', @name)
18
+ @git.config('user.email', 'spec_ninja@example.com')
19
+ @git.add
20
+ @git.commit('initial commit')
21
21
 
22
22
  # checkout our desired branch
23
23
  @branch_name = 'foo-bar-branch'
24
- git.branch(@branch_name).checkout
24
+ @git.branch(@branch_name).checkout
25
25
 
26
26
  # set the other things we're checking for
27
- @rev = git.revparse('HEAD')
28
- @date = git.log.first.date
27
+ @rev = @git.revparse('HEAD')
28
+ @date = @git.log.first.date
29
29
  end
30
30
 
31
31
  before(:each) do
@@ -135,5 +135,15 @@ describe RinfoController, type: :controller do
135
135
  end
136
136
  end
137
137
  end
138
+
139
+ context 'git config user.name is blank' do
140
+ before(:each) { @git.config('user.name', '') }
141
+ after(:each) { @git.config('user.name', @name) }
142
+
143
+ it 'displays the author name on the last commit' do
144
+ get 'info', format: :json
145
+ response.body.should == rinfo
146
+ end
147
+ end
138
148
  end
139
149
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rinfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafe Colton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-19 00:00:00.000000000 Z
11
+ date: 2014-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -116,6 +116,7 @@ executables:
116
116
  extensions: []
117
117
  extra_rdoc_files: []
118
118
  files:
119
+ - .gemrelease
119
120
  - .gitignore
120
121
  - .rspec
121
122
  - .rubocop.yml