gemon 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 36e1563daa8590611bed955ed24257f384205248
4
+ data.tar.gz: beb11c4e74c83c3b1add933e3e0750fbc22edde6
5
+ SHA512:
6
+ metadata.gz: 65c52ae466f4239184699a75e202186f4e01128fec7b1f9097748786dc617c3fbaf6fe697c9d80ab57711da6da50feaacb3217fe0a2b60cb40861cff3540128f
7
+ data.tar.gz: 9d08098bc54ec9e8a465c7ceabd1c1c3182b75cb7743cc6fa0f04931d0ced24b360a220a1147920dea1a1487b993a15d9da4367c4fbfbefa1edec90d7767a6ec
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in gemon.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Rob Zolkos
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # Gemon
2
+
3
+ Securely report your production Rails server settings.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'gemon'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ ## Usage
16
+
17
+ Mount the Gemon server in your `config/routes.rb` file.
18
+
19
+ ```
20
+ mount Gemon::Server, at: "/appstatus"
21
+ ```
22
+
23
+ In the above example the json data will be available on /appstatus in your Rails app.
24
+
25
+
26
+ ## Contributing
27
+
28
+ 1. Fork it ( http://github.com/robzolkos/gemon/fork )
29
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
30
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
31
+ 4. Push to the branch (`git push origin my-new-feature`)
32
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/gemon.gemspec ADDED
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'gemon/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "gemon"
8
+ spec.version = Gemon::VERSION
9
+ spec.authors = ["Rob Zolkos"]
10
+ spec.email = ["robzolkos@gmail.com"]
11
+ spec.summary = %q{Report your production Rails server settings.}
12
+ spec.description = %q{Gemon provides a small sinatra server that gets mounted in your Rails app. It then reports system and app settings.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", ">= 1.4"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency "rack-test"
25
+ spec.add_development_dependency "multi_json"
26
+
27
+ spec.add_dependency "sinatra"
28
+ spec.add_dependency "bundler", ">= 1.4"
29
+ end
@@ -0,0 +1,3 @@
1
+ module Gemon
2
+ VERSION = "0.0.1"
3
+ end
data/lib/gemon.rb ADDED
@@ -0,0 +1,55 @@
1
+ require "gemon/version"
2
+ require "sinatra/base"
3
+ require "bundler"
4
+ require "json"
5
+
6
+ module Gemon
7
+ class Server < Sinatra::Base
8
+
9
+ dir = File.dirname(File.expand_path(__FILE__))
10
+
11
+ set :static, true
12
+
13
+ get '/' do
14
+ dir = File.expand_path("..",Dir.pwd)
15
+ dir = Dir.pwd
16
+ gemfile = dir + "/Gemfile.lock"
17
+ lockfile = Bundler::LockfileParser.new(Bundler.read_file(gemfile))
18
+ content_type :json
19
+ {
20
+ :ruby => ruby_version,
21
+ :os => {
22
+ name: `uname -s`.strip,
23
+ platform: `uname -m`.strip,
24
+ release: `uname -r`.strip,
25
+ nodename: `uname -n`.strip
26
+ },
27
+ :directory => dir,
28
+ :gemfile => get_gems(lockfile)
29
+ }.to_json
30
+ end
31
+
32
+ private
33
+
34
+ def ruby_version
35
+ begin
36
+ return `ruby -v`.split[1]
37
+ rescue
38
+ return "Error: Ruby not found."
39
+ end
40
+ end
41
+
42
+ def get_gems(lockfile)
43
+ a = []
44
+ lockfile.dependencies.each do |d|
45
+ spec = lockfile.specs.select { |s| s.name == d.name }
46
+ version = ""
47
+ version = spec[0].version if !spec[0].nil?
48
+ a << {name: d.name, requirement: d.requirement, locked: version}
49
+ end
50
+ a
51
+ end
52
+
53
+ end
54
+
55
+ end
@@ -0,0 +1,24 @@
1
+ require 'rack/test'
2
+ require "gemon"
3
+ require "multi_json"
4
+
5
+ describe Gemon::Server do
6
+ include Rack::Test::Methods
7
+
8
+ def app
9
+ Gemon::Server.new
10
+ end
11
+
12
+ it "returns the ruby version" do
13
+ get '/'
14
+ ruby_version = `ruby -v`.split[1]
15
+ expect(json_parse(last_response.body)[:ruby]).to eq(ruby_version)
16
+ end
17
+
18
+ private
19
+
20
+ def json_parse(body)
21
+ MultiJson.load(body, symbolize_keys: true)
22
+ end
23
+
24
+ end
metadata ADDED
@@ -0,0 +1,154 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gemon
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Rob Zolkos
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '1.4'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '1.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
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: rspec
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: rack-test
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: multi_json
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: sinatra
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: bundler
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '1.4'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '1.4'
111
+ description: Gemon provides a small sinatra server that gets mounted in your Rails
112
+ app. It then reports system and app settings.
113
+ email:
114
+ - robzolkos@gmail.com
115
+ executables: []
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - .gitignore
120
+ - .rspec
121
+ - Gemfile
122
+ - LICENSE.txt
123
+ - README.md
124
+ - Rakefile
125
+ - gemon.gemspec
126
+ - lib/gemon.rb
127
+ - lib/gemon/version.rb
128
+ - spec/gemon_spec.rb
129
+ homepage: ''
130
+ licenses:
131
+ - MIT
132
+ metadata: {}
133
+ post_install_message:
134
+ rdoc_options: []
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - '>='
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ requirements: []
148
+ rubyforge_project:
149
+ rubygems_version: 2.0.14
150
+ signing_key:
151
+ specification_version: 4
152
+ summary: Report your production Rails server settings.
153
+ test_files:
154
+ - spec/gemon_spec.rb