code_version 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 28a4b0793d43ea3fcd93ffc73cf82c5563710274
4
+ data.tar.gz: 5608683a0306966db3cb63b79b5f6b59f8a868c0
5
+ SHA512:
6
+ metadata.gz: f4d86b71ca3a9920a8e0d2b7ff76033ac12a61bec5f35b94f4ba327ca0bc90f15fbae1c4427f332125b9724fab482e7c90324507f188da71825a3b38e913ded0
7
+ data.tar.gz: aa91111e53b6d7a77db7adb8e99ec537cd9ecd2a7ca3ec06445f20d5e47692664e1525b54e32717b508cf57868d0683ac9149098b5e55a79be2813ba9b00b1c0
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2017 Kraiyanat Tee
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
@@ -0,0 +1,34 @@
1
+ # CodeVersion
2
+ The mountable rails engine that provide api call to get the git commit number on server (at rails root directory)
3
+
4
+ ## Usage
5
+ After install you can go to the url to get a git commit number of code that deploy on server.
6
+ Url example: http://your_domain/code_version/show
7
+
8
+ ## Installation
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'code_version'
13
+ ```
14
+
15
+ And then execute:
16
+ ```bash
17
+ $ bundle
18
+ ```
19
+
20
+ And mount rails engine routes to your application routes by putting
21
+ ```ruby
22
+ Rails.application.routes.draw do
23
+ ...
24
+ mount ServerCodeVersion::Engine => "/code_version"
25
+ ...
26
+ end
27
+ ```
28
+
29
+
30
+ ## Contributing
31
+ Contribution directions go here.
32
+
33
+ ## License
34
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,36 @@
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 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'CodeVersion'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+
24
+
25
+ require 'bundler/gem_tasks'
26
+
27
+ require 'rake/testtask'
28
+
29
+ Rake::TestTask.new(:test) do |t|
30
+ t.libs << 'test'
31
+ t.pattern = 'test/**/*_test.rb'
32
+ t.verbose = false
33
+ end
34
+
35
+
36
+ task default: :test
@@ -0,0 +1,2 @@
1
+ //= link_directory ../javascripts/code_version .js
2
+ //= link_directory ../stylesheets/code_version .css
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,5 @@
1
+ module CodeVersion
2
+ class ApplicationController < ActionController::Base
3
+ protect_from_forgery with: :exception
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ module CodeVersion
2
+ class CodeVersionsController < ApplicationController
3
+ def show
4
+ file_path = "#{Rails.root}/REVISION"
5
+ info = {}
6
+ if File.exists? file_path
7
+ File.open(file_path).each_line do |line|
8
+ info["git commit number"] = line
9
+ end
10
+ else
11
+ info = {"error" => "No file REVISION in Rails root directory"}
12
+ end
13
+ render :json => info
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,4 @@
1
+ module CodeVersion
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module CodeVersion
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module CodeVersion
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: 'from@example.com'
4
+ layout 'mailer'
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module CodeVersion
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Code version</title>
5
+ <%= stylesheet_link_tag "code_version/application", media: "all" %>
6
+ <%= javascript_include_tag "code_version/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ CodeVersion::Engine.routes.draw do
2
+ get '/show', to: 'code_versions#show'
3
+ end
@@ -0,0 +1,5 @@
1
+ module CodeVersion
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace CodeVersion
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module CodeVersion
2
+ VERSION = '0.1.1'
3
+ end
@@ -0,0 +1,5 @@
1
+ require "code_version/engine"
2
+
3
+ module CodeVersion
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :code_version do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: code_version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Kraiyanat Tee
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-10-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '5.0'
27
+ description: The mountable rails engine that provide api call to get the git commit
28
+ number on server (at rails root directory)
29
+ email:
30
+ - kraiyanat@gmail.com
31
+ executables: []
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - MIT-LICENSE
36
+ - README.md
37
+ - Rakefile
38
+ - app/assets/config/code_version_manifest.js
39
+ - app/assets/javascripts/code_version/application.js
40
+ - app/assets/stylesheets/code_version/application.css
41
+ - app/controllers/code_version/application_controller.rb
42
+ - app/controllers/code_version/code_versions_controller.rb
43
+ - app/helpers/code_version/application_helper.rb
44
+ - app/jobs/code_version/application_job.rb
45
+ - app/mailers/code_version/application_mailer.rb
46
+ - app/models/code_version/application_record.rb
47
+ - app/views/layouts/code_version/application.html.erb
48
+ - config/routes.rb
49
+ - lib/code_version.rb
50
+ - lib/code_version/engine.rb
51
+ - lib/code_version/version.rb
52
+ - lib/tasks/code_version_tasks.rake
53
+ homepage: http://kraiyanat.com
54
+ licenses:
55
+ - MIT
56
+ metadata: {}
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubyforge_project:
73
+ rubygems_version: 2.6.11
74
+ signing_key:
75
+ specification_version: 4
76
+ summary: Show git commit number of code.
77
+ test_files: []
78
+ has_rdoc: