rinfo 0.1.4 → 0.2.0

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: 240215c899a894034febb6720816fe85ef35b685
4
- data.tar.gz: 4cce294d94ae5410caff2e1120121887af1cdd83
3
+ metadata.gz: 3ba2d5c8467354ec83f1272f7dbf84ebd7fe50f5
4
+ data.tar.gz: 934158ff2e6dbd04228f5eecd177c1b7dc78ec54
5
5
  SHA512:
6
- metadata.gz: 107f38e6734bf41370aeca07d3a5219a0014a5c1a0666cf2be63800c429d777b9966047c28782b6b4c7bb2cac87017e10095207bda5ce9835cce0775be0d5ec6
7
- data.tar.gz: 8651230a80852b7cd94c668d50bc6175685ddab2ba6ce11001608b5e7be82e630d293ecddd1af57cd25dfe39a3214f701cca8a23d670d96267b90e1a8f6dee6f
6
+ metadata.gz: 9a541a36b1f655c28d0a1cc54988185c666b561abe1e169fcab27373d24e791be44f29f9341e0cd0b3a594edcfad1b0eeae56b204d7334f61f58fb76080a1510
7
+ data.tar.gz: 5df7f9925d84bb8fb1b7d4a2788f51892fbfc5a70552150f023799d4b92f7618f0f43be50f4cc76b0961120773ff8c4491c4a6959fd4b6290653a0a82566fef7
data/.gitignore CHANGED
@@ -3,3 +3,5 @@ log/*.log
3
3
  pkg/
4
4
  Gemfile.lock
5
5
  *.gem
6
+ /coverage/
7
+ /db
@@ -1,8 +1,14 @@
1
1
  ---
2
2
  AllCops:
3
- Excludes:
3
+ Exclude:
4
4
  - bin/rails
5
5
  - vendor/bundle/**/*
6
6
 
7
7
  Documentation:
8
8
  Enabled: false
9
+
10
+ RegexpLiteral:
11
+ MaxSlashes: 0
12
+
13
+ LineLength:
14
+ Max: 100
@@ -1,8 +1,7 @@
1
- ---
2
1
  language: ruby
3
2
  matrix:
4
3
  allow_failures:
5
- - rvm: jruby-19mode
4
+ - rvm: jruby-19mode
6
5
  rvm:
7
6
  - 1.9.3
8
7
  - 2.0.0
@@ -10,4 +9,4 @@ rvm:
10
9
  notifications:
11
10
  email:
12
11
  recipients:
13
- - r.colton@modcloth.com
12
+ - r.colton@modcloth.com
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Rinfo
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/rinfo.png)](http://badge.fury.io/rb/rinfo) [![Build Status](https://travis-ci.org/rafecolton/rinfo.png?branch=master)](https://travis-ci.org/rafecolton/rinfo) [![Dependency Status](https://gemnasium.com/rafecolton/rinfo.png)](https://gemnasium.com/rafecolton/rinfo)
3
+ [![Gem Version](https://badge.fury.io/rb/rinfo.png)](http://badge.fury.io/rb/rinfo)
4
+ [![Build Status](https://travis-ci.org/rafecolton/rinfo.png?branch=master)](https://travis-ci.org/rafecolton/rinfo)
5
+ [![Code Climate](https://codeclimate.com/github/rafecolton/rinfo.png)](https://codeclimate.com/github/rafecolton/rinfo)
4
6
 
5
7
  ## Usage
6
8
 
@@ -46,6 +48,7 @@ made at run time:
46
48
  To add `rinfo` to your Rails application, add the `rinfo` gem to your `Gemfile`:
47
49
 
48
50
  ```ruby
51
+ # Gemfile
49
52
  gem 'rinfo'
50
53
  ```
51
54
 
@@ -88,3 +91,9 @@ your `RAILS_ENV`
88
91
  The `filename` attribute allows you to set the filename at which your
89
92
  release information is available. The default value of `rinfo.json` will
90
93
  mean your file is available at `/rinfo.json`.
94
+
95
+ ## Contributing
96
+
97
+ 0. Fork it
98
+ 0. Do your thing
99
+ 0. Submit a pull request
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  begin
2
4
  require 'bundler/setup'
3
5
  rescue LoadError
@@ -13,7 +15,7 @@ require 'rspec/core/rake_task'
13
15
 
14
16
  desc 'Run rubocop'
15
17
  task :rubocop do
16
- sh('rubocop --format simple'){ |ok, _| ok || abort }
18
+ sh('rubocop --format simple') { |ok, _| ok || abort }
17
19
  end
18
20
 
19
21
  RSpec::Core::RakeTask.new(:spec) do |t|
@@ -4,6 +4,9 @@ class RinfoController < ApplicationController
4
4
  include Rails.application.routes.url_helpers
5
5
 
6
6
  def info
7
- render json: Rinfo.inform!
7
+ json_data = ::MemoryCache.instance.fetch('rinfo_data') do
8
+ Rinfo.inform!
9
+ end
10
+ render json: json_data
8
11
  end
9
12
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require File.expand_path('../boot', __FILE__)
4
4
 
5
- require 'rails'
5
+ require 'rails/all'
6
6
  require 'rinfo'
7
7
  require 'action_controller'
8
8
 
@@ -0,0 +1,5 @@
1
+ test:
2
+ adapter: sqlite3
3
+ database: db/test.sqlite3
4
+ pool: 5
5
+ timeout: 5000
@@ -1,7 +1,9 @@
1
1
  # coding: utf-8
2
2
 
3
3
  require 'rinfo/engine'
4
+ require 'rinfo/cache'
4
5
  require 'git'
6
+ require 'time'
5
7
 
6
8
  class Rinfo
7
9
  autoload :VERSION, 'rinfo/version'
@@ -63,7 +65,7 @@ class Rinfo
63
65
  end
64
66
 
65
67
  def date
66
- git.log.first.date
68
+ git.log.first.date.iso8601
67
69
  end
68
70
 
69
71
  def branch
@@ -0,0 +1,16 @@
1
+ # coding: utf-8
2
+
3
+ class MemoryCache
4
+ include Singleton
5
+
6
+ # create a private instance of MemoryStore
7
+ def initialize
8
+ @memory_store = ::ActiveSupport::Cache::MemoryStore.new
9
+ end
10
+
11
+ # this will allow our MemoryCache to be called just like Rails.cache
12
+ # every method passed to it will be passed to our MemoryStore
13
+ def method_missing(m, *args, &block)
14
+ @memory_store.send(m, *args, &block)
15
+ end
16
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  unless defined?(Rinfo::VERSION)
4
4
  class Rinfo
5
- VERSION = '0.1.4'
5
+ VERSION = '0.2.0'
6
6
  end
7
7
  end
@@ -3,32 +3,38 @@
3
3
  lib = File.expand_path('../lib', __FILE__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
- $TOP = File.expand_path('..', __FILE__)
7
-
8
6
  require 'rinfo/version'
9
7
 
10
8
  Gem::Specification.new do |gem|
11
9
  gem.name = 'rinfo'
12
10
  gem.version = Rinfo::VERSION
13
- gem.authors = ['Rafe Colton']
14
- gem.email = ['r.colton@modcloth.com']
11
+ gem.authors = ['Rafe Colton', 'Nick Rowe']
12
+ gem.email = ['rafael.colton@gmail.com', 'n.rowe@modcloth.com']
15
13
  gem.homepage = 'https://github.com/rafecolton/rinfo'
16
14
  gem.summary = 'Generates an rinfo.json page for your Rails app'
17
15
  gem.description = 'Generates an rinfo.json page for your Rails app'
18
16
  gem.license = 'MIT'
19
17
 
20
- gem.files = `git ls-files`.split($/)
18
+ gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
21
19
  gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
22
20
  gem.bindir = 'bin'
23
21
  gem.test_files = gem.files.grep(%r{^spec/})
24
22
  gem.require_paths = ['lib']
25
23
  gem.required_ruby_version = '>= 1.9.3'
26
24
 
27
- %w(rake rspec rubocop rspec-rails).map do |dep|
28
- gem.add_development_dependency dep
29
- end
25
+ # dev/test dependencies
26
+ gem.add_development_dependency 'rake'
27
+ gem.add_development_dependency 'rspec'
28
+ gem.add_development_dependency 'rubocop'
29
+ gem.add_development_dependency 'rspec-rails'
30
+ gem.add_development_dependency 'simplecov'
31
+ gem.add_development_dependency 'sqlite3' unless RUBY_PLATFORM == 'java'
32
+ gem.add_development_dependency 'activerecord-jdbcsqlite3-adapter' if RUBY_PLATFORM == 'java'
33
+
34
+ # dev/test deps, no jruby
30
35
  gem.add_development_dependency 'pry' unless RUBY_PLATFORM == 'java'
31
36
 
37
+ # full dependencies
32
38
  gem.add_dependency 'rails', '>= 3'
33
39
  gem.add_dependency 'git'
34
40
  end
@@ -29,6 +29,7 @@ describe RinfoController, type: :controller do
29
29
  end
30
30
 
31
31
  before(:each) do
32
+ ::MemoryCache.instance.clear
32
33
  Rinfo.stub(:root).and_return(@tmpdir)
33
34
  end
34
35
 
@@ -80,6 +81,7 @@ describe RinfoController, type: :controller do
80
81
 
81
82
  it 'displays rinfo for all envs not on the blacklist' do
82
83
  default_whitelist.each do |env|
84
+ ::MemoryCache.instance.clear
83
85
  Rinfo.stub(:env).and_return(env.to_s)
84
86
  get 'info', format: :json
85
87
  response.body.should == rinfo
@@ -94,6 +96,7 @@ describe RinfoController, type: :controller do
94
96
 
95
97
  it 'displays rinfo for all envs' do
96
98
  rails_envs.each do |env|
99
+ ::MemoryCache.instance.clear
97
100
  Rinfo.stub(:env).and_return(env.to_s)
98
101
  get 'info', format: :json
99
102
  response.body.should == rinfo
@@ -108,6 +111,7 @@ describe RinfoController, type: :controller do
108
111
 
109
112
  it 'does not display rinfo for any envs' do
110
113
  rails_envs.each do |env|
114
+ ::MemoryCache.instance.clear
111
115
  Rinfo.stub(:env).and_return(env.to_s)
112
116
  expect { get 'info', format: :json }.to raise_error(
113
117
  ActionController::RoutingError
@@ -123,6 +127,7 @@ describe RinfoController, type: :controller do
123
127
 
124
128
  it 'does not display rinfo for blacklisted envs' do
125
129
  custom_blacklist.each do |env|
130
+ ::MemoryCache.instance.clear
126
131
  Rinfo.stub(:env).and_return(env.to_s)
127
132
  expect { get 'info', format: :json }.to raise_error(
128
133
  ActionController::RoutingError
@@ -132,6 +137,7 @@ describe RinfoController, type: :controller do
132
137
 
133
138
  it 'displays rinfo for non-blacklisted envs' do
134
139
  (rails_envs - custom_blacklist).each do |env|
140
+ ::MemoryCache.instance.clear
135
141
  Rinfo.stub(:env).and_return(env.to_s)
136
142
  get 'info', format: :json
137
143
  response.body.should == rinfo
@@ -9,3 +9,6 @@ require 'bundler/setup'
9
9
  require 'pry' unless RUBY_PLATFORM == 'java'
10
10
  require 'rspec/rails'
11
11
  require 'rspec/autorun'
12
+ require 'simplecov'
13
+
14
+ SimpleCov.start 'rails'
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rinfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafe Colton
8
+ - Nick Rowe
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-03-24 00:00:00.000000000 Z
12
+ date: 2014-08-14 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rake
@@ -66,6 +67,34 @@ dependencies:
66
67
  - - '>='
67
68
  - !ruby/object:Gem::Version
68
69
  version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: simplecov
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: sqlite3
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
69
98
  - !ruby/object:Gem::Dependency
70
99
  name: pry
71
100
  requirement: !ruby/object:Gem::Requirement
@@ -110,7 +139,8 @@ dependencies:
110
139
  version: '0'
111
140
  description: Generates an rinfo.json page for your Rails app
112
141
  email:
113
- - r.colton@modcloth.com
142
+ - rafael.colton@gmail.com
143
+ - n.rowe@modcloth.com
114
144
  executables:
115
145
  - rails
116
146
  extensions: []
@@ -133,11 +163,13 @@ files:
133
163
  - config.ru
134
164
  - config/application.rb
135
165
  - config/boot.rb
166
+ - config/database.yml
136
167
  - config/environment.rb
137
168
  - config/environments/test.rb
138
169
  - config/initializers/secret_token.rb
139
170
  - config/routes.rb
140
171
  - lib/rinfo.rb
172
+ - lib/rinfo/cache.rb
141
173
  - lib/rinfo/engine.rb
142
174
  - lib/rinfo/version.rb
143
175
  - lib/tasks/rinfo_tasks.rake
@@ -164,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
196
  version: '0'
165
197
  requirements: []
166
198
  rubyforge_project:
167
- rubygems_version: 2.0.14
199
+ rubygems_version: 2.2.2
168
200
  signing_key:
169
201
  specification_version: 4
170
202
  summary: Generates an rinfo.json page for your Rails app