peek-app_version 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile +4 -0
- data/LICENCE.md +21 -0
- data/README.md +52 -0
- data/Rakefile +1 -0
- data/app/views/peek/views/_app_version.html.erb +7 -0
- data/lib/peek/views/app_version.rb +19 -0
- data/lib/peek-app_version/railtie.rb +6 -0
- data/lib/peek-app_version/version.rb +5 -0
- data/lib/peek-app_version.rb +3 -0
- data/peek-app_version.gemspec +22 -0
- metadata +71 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cbf905b1e443cb8b32a8d281fa2598901b0edfdf
|
4
|
+
data.tar.gz: c511cc6347eb08621b850e170468b15133d24f80
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9a217925926b75f40c400bccc2307405c231b4942e431d6fae4ea7bbd1796a15212f8ad08b39c2060124352d0cec38f56df4472e63e99f3f152f9f8b623e6f3e
|
7
|
+
data.tar.gz: 0e55733808241ca42c3501257df492e1082e41a525435cd7a8eca915d7d321a945285973d38e8526c27f4e3cc6d7688e59e3ab72bf5c1ea70653c1db2cafeca9
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENCE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Wan Qi Chen
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# Peek::AppVersion
|
2
|
+
|
3
|
+
[![Code Climate](https://codeclimate.com/github/kamisama/peek-app_version/badges/gpa.svg)](https://codeclimate.com/github/kamisama/peek-app_version) [![Gem Version](https://badge.fury.io/rb/peek-app_version.svg)](http://badge.fury.io/rb/peek-app_version) [![Inline docs](http://inch-ci.org/github/kamisama/peek-app_version.png?branch=master)](http://inch-ci.org/github/kamisama/peek-app_version)
|
4
|
+
|
5
|
+
Display your application version number.
|
6
|
+
|
7
|
+
This peek view will try to fetch you application version number if it exists, with
|
8
|
+
|
9
|
+
Rails::VERSION
|
10
|
+
|
11
|
+
or if you have a custom app name,
|
12
|
+
|
13
|
+
MyAppName::VERSION
|
14
|
+
|
15
|
+
If you didn't set a version, it'll try to build a version name with [`git-describe`](http://git-scm.com/docs/git-describe).
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
Add this line to your application's Gemfile:
|
20
|
+
|
21
|
+
gem 'peek-app_version'
|
22
|
+
|
23
|
+
And then execute:
|
24
|
+
|
25
|
+
$ bundle
|
26
|
+
|
27
|
+
Or install it yourself as:
|
28
|
+
|
29
|
+
$ gem install peek-app_version
|
30
|
+
|
31
|
+
## Requirements
|
32
|
+
|
33
|
+
* [Peek](https://github.com/peek/peek)
|
34
|
+
* Git, if your application don't have a version number
|
35
|
+
|
36
|
+
## Usage
|
37
|
+
|
38
|
+
Add the following to your `config/initializers/peek.rb`:
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
Peek.into Peek::Views::AppVersion
|
42
|
+
```
|
43
|
+
|
44
|
+
If you're using a different application name than the default `Rails` for your application, you can set it like that
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
Peek.into Peek::Views::AppVersion, app_name: MyAppName
|
48
|
+
```
|
49
|
+
|
50
|
+
## To-do
|
51
|
+
|
52
|
+
* Build version number from SCM other than git
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Peek
|
2
|
+
module Views
|
3
|
+
# AppVersion view
|
4
|
+
class AppVersion < View
|
5
|
+
# Setting up the peek views
|
6
|
+
# Accepted keys in options:
|
7
|
+
# - app_name: Name of your Rails application (default: Rails)
|
8
|
+
def initialize(options = {})
|
9
|
+
@app_name = options.delete(:app_name) || Rails
|
10
|
+
end
|
11
|
+
|
12
|
+
# Return the application version number is set
|
13
|
+
# Else, build it from the git tag
|
14
|
+
def app_version
|
15
|
+
@app_version ||= (@app_name::VERSION || `git describe --tags`.strip)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'peek-app_version/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = 'peek-app_version'
|
8
|
+
gem.version = Peek::AppVersion::VERSION
|
9
|
+
gem.authors = ['Wan Qi Chen']
|
10
|
+
gem.email = ['kami@kamisama.me']
|
11
|
+
gem.description = 'Display the application version number.'
|
12
|
+
gem.summary = 'Display the application version number.'
|
13
|
+
gem.homepage = 'https://github.com/kamisama/peek-app_version'
|
14
|
+
gem.license = 'MIT'
|
15
|
+
|
16
|
+
gem.files = `git ls-files`.split($/)
|
17
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
|
+
gem.require_paths = ['lib']
|
20
|
+
|
21
|
+
gem.add_dependency 'peek', '~> 0.1.0'
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: peek-app_version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Wan Qi Chen
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: peek
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.1.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.1.0
|
27
|
+
description: Display the application version number.
|
28
|
+
email:
|
29
|
+
- kami@kamisama.me
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".gitignore"
|
35
|
+
- CHANGELOG.md
|
36
|
+
- Gemfile
|
37
|
+
- LICENCE.md
|
38
|
+
- README.md
|
39
|
+
- Rakefile
|
40
|
+
- app/views/peek/views/_app_version.html.erb
|
41
|
+
- lib/peek-app_version.rb
|
42
|
+
- lib/peek-app_version/railtie.rb
|
43
|
+
- lib/peek-app_version/version.rb
|
44
|
+
- lib/peek/views/app_version.rb
|
45
|
+
- peek-app_version.gemspec
|
46
|
+
homepage: https://github.com/kamisama/peek-app_version
|
47
|
+
licenses:
|
48
|
+
- MIT
|
49
|
+
metadata: {}
|
50
|
+
post_install_message:
|
51
|
+
rdoc_options: []
|
52
|
+
require_paths:
|
53
|
+
- lib
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
requirements: []
|
65
|
+
rubyforge_project:
|
66
|
+
rubygems_version: 2.4.1
|
67
|
+
signing_key:
|
68
|
+
specification_version: 4
|
69
|
+
summary: Display the application version number.
|
70
|
+
test_files: []
|
71
|
+
has_rdoc:
|