rinfo 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/.rspec +4 -0
- data/.rubocop.yml +8 -0
- data/.ruby-version +1 -0
- data/.travis.yml +13 -0
- data/Gemfile +3 -0
- data/MIT-LICENSE +20 -0
- data/README.md +11 -0
- data/Rakefile +25 -0
- data/app/controllers/.keep +0 -0
- data/app/controllers/application_controller.rb +4 -0
- data/app/controllers/rinfo_controller.rb +9 -0
- data/bin/rails +12 -0
- data/config.ru +4 -0
- data/config/application.rb +14 -0
- data/config/boot.rb +6 -0
- data/config/environment.rb +6 -0
- data/config/environments/test.rb +8 -0
- data/config/initializers/secret_token.rb +6 -0
- data/config/routes.rb +5 -0
- data/lib/rinfo.rb +48 -0
- data/lib/rinfo/engine.rb +6 -0
- data/lib/rinfo/version.rb +7 -0
- data/lib/tasks/rinfo_tasks.rake +4 -0
- data/rinfo.gemspec +34 -0
- data/spec/controllers/rinfo_controller_spec.rb +61 -0
- data/spec/spec_helper.rb +11 -0
- metadata +172 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 735e0df4987cfe914fa2b9f7db835f9ba40e150c
|
4
|
+
data.tar.gz: 6714c7823bbf12c1e6f5fcd84ac643d07e78d3e4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ba9767e290e354c7b14cf4018175048f793af1126d9c2d2f65f54fe16a10ced38a531df1d841d602c074099c1d4e0b97bff2d49faa660d6a4c5e38966966048f
|
7
|
+
data.tar.gz: e84a70886f4ed2566484d10ce3bd1d4be75a31f120ba873ac9c6037f430c4413d071584f5f104f2c4848cc9a9c312a51b78f279ce29f385f0aab9fea2c1e09dc
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.0.0-p451
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2014 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require File.expand_path('../config/application', __FILE__)
|
8
|
+
|
9
|
+
require 'rdoc/task'
|
10
|
+
|
11
|
+
require 'bundler/gem_tasks'
|
12
|
+
require 'rspec/core/rake_task'
|
13
|
+
|
14
|
+
desc 'Run rubocop'
|
15
|
+
task :rubocop do
|
16
|
+
sh('rubocop --format simple'){ |ok, _| ok || abort }
|
17
|
+
end
|
18
|
+
|
19
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
20
|
+
t.rspec_opts = '--format documentation'
|
21
|
+
end
|
22
|
+
|
23
|
+
task default: [:spec, :rubocop]
|
24
|
+
|
25
|
+
Bundler::GemHelper.install_tasks
|
File without changes
|
data/bin/rails
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
|
3
|
+
|
4
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
5
|
+
ENGINE_PATH = File.expand_path('../../lib/rinfo/engine', __FILE__)
|
6
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
7
|
+
|
8
|
+
require File.expand_path('../../config/boot', __FILE__)
|
9
|
+
|
10
|
+
require 'rails/commands'
|
11
|
+
require 'rails/all'
|
12
|
+
require 'rails/engine/commands'
|
data/config.ru
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path('../boot', __FILE__)
|
4
|
+
|
5
|
+
require 'rails'
|
6
|
+
require 'rinfo'
|
7
|
+
require 'action_controller'
|
8
|
+
|
9
|
+
class Rinfo
|
10
|
+
class Application < Rails::Application
|
11
|
+
config.encoding = 'utf-8'
|
12
|
+
config.time_zone = 'Pacific Time (US & Canada)'
|
13
|
+
end
|
14
|
+
end
|
data/config/boot.rb
ADDED
data/config/routes.rb
ADDED
data/lib/rinfo.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'rinfo/engine'
|
4
|
+
require 'git'
|
5
|
+
|
6
|
+
class Rinfo
|
7
|
+
autoload :VERSION, 'rinfo/version'
|
8
|
+
|
9
|
+
class << self
|
10
|
+
def info
|
11
|
+
<<-RINFO.gsub(/^ {6}/, '')
|
12
|
+
{
|
13
|
+
"Deployed By": "#{author}",
|
14
|
+
"Deployed At": "#{date}",
|
15
|
+
"Rails Env": "#{Rails.env}",
|
16
|
+
"Branch": "#{branch}",
|
17
|
+
"Rev": "#{rev}"
|
18
|
+
}
|
19
|
+
RINFO
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def git
|
25
|
+
@git ||= Git.open(root)
|
26
|
+
end
|
27
|
+
|
28
|
+
def root
|
29
|
+
Rails.root
|
30
|
+
end
|
31
|
+
|
32
|
+
def author
|
33
|
+
git.config('user.name')
|
34
|
+
end
|
35
|
+
|
36
|
+
def date
|
37
|
+
git.log.first.date
|
38
|
+
end
|
39
|
+
|
40
|
+
def branch
|
41
|
+
git.lib.branch_current
|
42
|
+
end
|
43
|
+
|
44
|
+
def rev
|
45
|
+
git.revparse('HEAD')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/rinfo/engine.rb
ADDED
data/rinfo.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
|
6
|
+
$TOP = File.expand_path('..', __FILE__)
|
7
|
+
|
8
|
+
require 'rinfo/version'
|
9
|
+
|
10
|
+
Gem::Specification.new do |gem|
|
11
|
+
gem.name = 'rinfo'
|
12
|
+
gem.version = Rinfo::VERSION
|
13
|
+
gem.authors = ['Rafe Colton']
|
14
|
+
gem.email = ['r.colton@modcloth.com']
|
15
|
+
gem.homepage = 'https://github.com/rafecolton/rinfo'
|
16
|
+
gem.summary = 'Generates an rinfo.json page for your Rails app'
|
17
|
+
gem.description = 'Generates an rinfo.json page for your Rails app'
|
18
|
+
gem.license = 'MIT'
|
19
|
+
|
20
|
+
gem.files = `git ls-files`.split($/)
|
21
|
+
gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
22
|
+
gem.bindir = 'bin'
|
23
|
+
gem.test_files = gem.files.grep(%r{^spec/})
|
24
|
+
gem.require_paths = ['lib']
|
25
|
+
gem.required_ruby_version = '>= 1.9.3'
|
26
|
+
|
27
|
+
%w(rake rspec rubocop rspec-rails).map do |dep|
|
28
|
+
gem.add_development_dependency dep
|
29
|
+
end
|
30
|
+
gem.add_development_dependency 'pry' unless RUBY_PLATFORM == 'java'
|
31
|
+
|
32
|
+
gem.add_dependency 'rails', '>= 3'
|
33
|
+
gem.add_dependency 'git'
|
34
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'tmpdir'
|
4
|
+
require 'git'
|
5
|
+
|
6
|
+
describe RinfoController, type: :controller do
|
7
|
+
before :all do
|
8
|
+
# create temporary directory
|
9
|
+
@tmpdir = Dir.mktmpdir
|
10
|
+
Dir.chdir(@tmpdir)
|
11
|
+
|
12
|
+
# initialize a git repository
|
13
|
+
git = Git.init(Dir.pwd)
|
14
|
+
FileUtils.touch("#{Dir.pwd}/initial-file.txt")
|
15
|
+
@name = 'Spec Ninja'
|
16
|
+
git.config('user.name', @name)
|
17
|
+
git.config('user.email', 'spec_ninja@example.com')
|
18
|
+
git.add
|
19
|
+
git.commit('initial commit')
|
20
|
+
|
21
|
+
# checkout our desired branch
|
22
|
+
@branch_name = 'foo-bar-branch'
|
23
|
+
git.branch(@branch_name).checkout
|
24
|
+
|
25
|
+
# set the other things we're checking for
|
26
|
+
@rev = git.revparse('HEAD')
|
27
|
+
@date = git.log.first.date
|
28
|
+
end
|
29
|
+
|
30
|
+
after :all do
|
31
|
+
Dir.chdir(Rails.root)
|
32
|
+
FileUtils.rm_rf(@tmpdir)
|
33
|
+
end
|
34
|
+
|
35
|
+
let(:author) { @name }
|
36
|
+
let(:deploy_time) { "#{@date}" }
|
37
|
+
let(:rails_env) { 'test' }
|
38
|
+
let(:branch) { @branch_name }
|
39
|
+
let(:rev) { @rev }
|
40
|
+
|
41
|
+
let(:rinfo) do
|
42
|
+
<<-RINFO.gsub(/^ {4}/, '')
|
43
|
+
{
|
44
|
+
"Deployed By": "#{author}",
|
45
|
+
"Deployed At": "#{deploy_time}",
|
46
|
+
"Rails Env": "#{rails_env}",
|
47
|
+
"Branch": "#{branch}",
|
48
|
+
"Rev": "#{rev}"
|
49
|
+
}
|
50
|
+
RINFO
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'GET #info' do
|
54
|
+
it 'renders rinfo.json' do
|
55
|
+
Rinfo.stub(:root).and_return(@tmpdir)
|
56
|
+
|
57
|
+
get 'info', format: :json
|
58
|
+
response.body.should == rinfo
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
ENV['RAILS_ENV'] = 'test'
|
4
|
+
require File.expand_path('../../config/environment', __FILE__)
|
5
|
+
|
6
|
+
require 'rails'
|
7
|
+
require 'rubygems'
|
8
|
+
require 'bundler/setup'
|
9
|
+
require 'pry' unless RUBY_PLATFORM == 'java'
|
10
|
+
require 'rspec/rails'
|
11
|
+
require 'rspec/autorun'
|
metadata
ADDED
@@ -0,0 +1,172 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rinfo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rafe Colton
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec-rails
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: git
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Generates an rinfo.json page for your Rails app
|
112
|
+
email:
|
113
|
+
- r.colton@modcloth.com
|
114
|
+
executables:
|
115
|
+
- rails
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- .gitignore
|
120
|
+
- .rspec
|
121
|
+
- .rubocop.yml
|
122
|
+
- .ruby-version
|
123
|
+
- .travis.yml
|
124
|
+
- Gemfile
|
125
|
+
- MIT-LICENSE
|
126
|
+
- README.md
|
127
|
+
- Rakefile
|
128
|
+
- app/controllers/.keep
|
129
|
+
- app/controllers/application_controller.rb
|
130
|
+
- app/controllers/rinfo_controller.rb
|
131
|
+
- bin/rails
|
132
|
+
- config.ru
|
133
|
+
- config/application.rb
|
134
|
+
- config/boot.rb
|
135
|
+
- config/environment.rb
|
136
|
+
- config/environments/test.rb
|
137
|
+
- config/initializers/secret_token.rb
|
138
|
+
- config/routes.rb
|
139
|
+
- lib/rinfo.rb
|
140
|
+
- lib/rinfo/engine.rb
|
141
|
+
- lib/rinfo/version.rb
|
142
|
+
- lib/tasks/rinfo_tasks.rake
|
143
|
+
- rinfo.gemspec
|
144
|
+
- spec/controllers/rinfo_controller_spec.rb
|
145
|
+
- spec/spec_helper.rb
|
146
|
+
homepage: https://github.com/rafecolton/rinfo
|
147
|
+
licenses:
|
148
|
+
- MIT
|
149
|
+
metadata: {}
|
150
|
+
post_install_message:
|
151
|
+
rdoc_options: []
|
152
|
+
require_paths:
|
153
|
+
- lib
|
154
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - '>='
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: 1.9.3
|
159
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - '>='
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '0'
|
164
|
+
requirements: []
|
165
|
+
rubyforge_project:
|
166
|
+
rubygems_version: 2.0.14
|
167
|
+
signing_key:
|
168
|
+
specification_version: 4
|
169
|
+
summary: Generates an rinfo.json page for your Rails app
|
170
|
+
test_files:
|
171
|
+
- spec/controllers/rinfo_controller_spec.rb
|
172
|
+
- spec/spec_helper.rb
|