log_changes 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 +8 -0
- data/.rspec +2 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +149 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +36 -0
- data/app/assets/config/log_changes_manifest.js +0 -0
- data/app/assets/images/log_changes/.keep +0 -0
- data/app/assets/javascripts/log_changes/.keep +0 -0
- data/app/assets/stylesheets/log_changes/.keep +0 -0
- data/app/controllers/.keep +0 -0
- data/app/helpers/.keep +0 -0
- data/app/mailers/.keep +0 -0
- data/app/models/.keep +0 -0
- data/app/views/.keep +0 -0
- data/bin/rails +13 -0
- data/config/routes.rb +2 -0
- data/lib/log_changes/base.rb +60 -0
- data/lib/log_changes/engine.rb +4 -0
- data/lib/log_changes/version.rb +3 -0
- data/lib/log_changes.rb +6 -0
- data/lib/tasks/log_changes_tasks.rake +4 -0
- data/log_changes.gemspec +30 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/config/manifest.js +4 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/javascripts/cable.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/jobs/application_job.rb +2 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/application_record.rb +4 -0
- data/spec/dummy/app/models/employee.rb +8 -0
- data/spec/dummy/app/models/picture.rb +3 -0
- data/spec/dummy/app/models/product.rb +4 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +34 -0
- data/spec/dummy/bin/update +29 -0
- data/spec/dummy/config/application.rb +15 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/cable.yml +9 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +54 -0
- data/spec/dummy/config/environments/production.rb +86 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/new_framework_defaults.rb +24 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/puma.rb +47 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config/spring.rb +6 -0
- data/spec/dummy/config.ru +5 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20161228194303_create_models.rb +21 -0
- data/spec/dummy/db/schema.rb +39 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +93 -0
- data/spec/dummy/log/record_changes/2016.12_Employee.log +9 -0
- data/spec/dummy/log/record_changes/2016.12_Picture.log +0 -0
- data/spec/dummy/log/record_changes/2016.12_Product.log +0 -0
- data/spec/dummy/log/test.log +1802 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/factories/employee.rb +6 -0
- data/spec/factories/picture.rb +6 -0
- data/spec/factories/product.rb +6 -0
- data/spec/log_changes_spec.rb +58 -0
- data/spec/rails_helper.rb +76 -0
- data/spec/spec_helper.rb +99 -0
- metadata +302 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cac50df66f4bbf5b431b1594c2ae8b051ce81fc4
|
4
|
+
data.tar.gz: 836919fc6c68e35d9abaaec218d9b7f81a46755b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8490c5addfef1fa4d696598c4c9b56b333c936cdcf659853192870c25a011a1477a8cb4bded905bdb6425961877580ef8c21dccd433429529d1c8b3bb7623596
|
7
|
+
data.tar.gz: d20b3e85a7aa3de3e88389e7a02943c4cf20cd7e10f045d1f3549b86580b750afcd1bdcb31425dcc32baaf3c630a3bf821699f8a3861c51ad68eb97f5baf86bc
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Declare your gem's dependencies in log_changes.gemspec.
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
5
|
+
# development dependencies will be added by default to the :development group.
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
# Declare any dependencies that are still in development here instead of in
|
9
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
10
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
11
|
+
# your gem to rubygems.org.
|
12
|
+
|
13
|
+
# To use a debugger
|
14
|
+
# gem 'byebug', group: [:development, :test]
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
log_changes (0.1.0)
|
5
|
+
rails (>= 4.1)
|
6
|
+
sr_log (~> 1.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actioncable (5.0.1)
|
12
|
+
actionpack (= 5.0.1)
|
13
|
+
nio4r (~> 1.2)
|
14
|
+
websocket-driver (~> 0.6.1)
|
15
|
+
actionmailer (5.0.1)
|
16
|
+
actionpack (= 5.0.1)
|
17
|
+
actionview (= 5.0.1)
|
18
|
+
activejob (= 5.0.1)
|
19
|
+
mail (~> 2.5, >= 2.5.4)
|
20
|
+
rails-dom-testing (~> 2.0)
|
21
|
+
actionpack (5.0.1)
|
22
|
+
actionview (= 5.0.1)
|
23
|
+
activesupport (= 5.0.1)
|
24
|
+
rack (~> 2.0)
|
25
|
+
rack-test (~> 0.6.3)
|
26
|
+
rails-dom-testing (~> 2.0)
|
27
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
28
|
+
actionview (5.0.1)
|
29
|
+
activesupport (= 5.0.1)
|
30
|
+
builder (~> 3.1)
|
31
|
+
erubis (~> 2.7.0)
|
32
|
+
rails-dom-testing (~> 2.0)
|
33
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
34
|
+
activejob (5.0.1)
|
35
|
+
activesupport (= 5.0.1)
|
36
|
+
globalid (>= 0.3.6)
|
37
|
+
activemodel (5.0.1)
|
38
|
+
activesupport (= 5.0.1)
|
39
|
+
activerecord (5.0.1)
|
40
|
+
activemodel (= 5.0.1)
|
41
|
+
activesupport (= 5.0.1)
|
42
|
+
arel (~> 7.0)
|
43
|
+
activesupport (5.0.1)
|
44
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
45
|
+
i18n (~> 0.7)
|
46
|
+
minitest (~> 5.1)
|
47
|
+
tzinfo (~> 1.1)
|
48
|
+
arel (7.1.4)
|
49
|
+
awesome_print (1.7.0)
|
50
|
+
builder (3.2.2)
|
51
|
+
concurrent-ruby (1.0.4)
|
52
|
+
database_cleaner (1.5.3)
|
53
|
+
diff-lcs (1.2.5)
|
54
|
+
erubis (2.7.0)
|
55
|
+
factory_girl (4.7.0)
|
56
|
+
activesupport (>= 3.0.0)
|
57
|
+
factory_girl_rails (4.7.0)
|
58
|
+
factory_girl (~> 4.7.0)
|
59
|
+
railties (>= 3.0.0)
|
60
|
+
globalid (0.3.7)
|
61
|
+
activesupport (>= 4.1.0)
|
62
|
+
i18n (0.7.0)
|
63
|
+
loofah (2.0.3)
|
64
|
+
nokogiri (>= 1.5.9)
|
65
|
+
mail (2.6.4)
|
66
|
+
mime-types (>= 1.16, < 4)
|
67
|
+
method_source (0.8.2)
|
68
|
+
mime-types (3.1)
|
69
|
+
mime-types-data (~> 3.2015)
|
70
|
+
mime-types-data (3.2016.0521)
|
71
|
+
mini_portile2 (2.1.0)
|
72
|
+
minitest (5.10.1)
|
73
|
+
nio4r (1.2.1)
|
74
|
+
nokogiri (1.7.0)
|
75
|
+
mini_portile2 (~> 2.1.0)
|
76
|
+
rack (2.0.1)
|
77
|
+
rack-test (0.6.3)
|
78
|
+
rack (>= 1.0)
|
79
|
+
rails (5.0.1)
|
80
|
+
actioncable (= 5.0.1)
|
81
|
+
actionmailer (= 5.0.1)
|
82
|
+
actionpack (= 5.0.1)
|
83
|
+
actionview (= 5.0.1)
|
84
|
+
activejob (= 5.0.1)
|
85
|
+
activemodel (= 5.0.1)
|
86
|
+
activerecord (= 5.0.1)
|
87
|
+
activesupport (= 5.0.1)
|
88
|
+
bundler (>= 1.3.0, < 2.0)
|
89
|
+
railties (= 5.0.1)
|
90
|
+
sprockets-rails (>= 2.0.0)
|
91
|
+
rails-dom-testing (2.0.2)
|
92
|
+
activesupport (>= 4.2.0, < 6.0)
|
93
|
+
nokogiri (~> 1.6)
|
94
|
+
rails-html-sanitizer (1.0.3)
|
95
|
+
loofah (~> 2.0)
|
96
|
+
railties (5.0.1)
|
97
|
+
actionpack (= 5.0.1)
|
98
|
+
activesupport (= 5.0.1)
|
99
|
+
method_source
|
100
|
+
rake (>= 0.8.7)
|
101
|
+
thor (>= 0.18.1, < 2.0)
|
102
|
+
rake (12.0.0)
|
103
|
+
rspec-core (3.5.4)
|
104
|
+
rspec-support (~> 3.5.0)
|
105
|
+
rspec-expectations (3.5.0)
|
106
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
107
|
+
rspec-support (~> 3.5.0)
|
108
|
+
rspec-mocks (3.5.0)
|
109
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
110
|
+
rspec-support (~> 3.5.0)
|
111
|
+
rspec-rails (3.5.2)
|
112
|
+
actionpack (>= 3.0)
|
113
|
+
activesupport (>= 3.0)
|
114
|
+
railties (>= 3.0)
|
115
|
+
rspec-core (~> 3.5.0)
|
116
|
+
rspec-expectations (~> 3.5.0)
|
117
|
+
rspec-mocks (~> 3.5.0)
|
118
|
+
rspec-support (~> 3.5.0)
|
119
|
+
rspec-support (3.5.0)
|
120
|
+
sprockets (3.7.1)
|
121
|
+
concurrent-ruby (~> 1.0)
|
122
|
+
rack (> 1, < 3)
|
123
|
+
sprockets-rails (3.2.0)
|
124
|
+
actionpack (>= 4.0)
|
125
|
+
activesupport (>= 4.0)
|
126
|
+
sprockets (>= 3.0.0)
|
127
|
+
sqlite3 (1.3.12)
|
128
|
+
sr_log (1.0.0)
|
129
|
+
thor (0.19.4)
|
130
|
+
thread_safe (0.3.5)
|
131
|
+
tzinfo (1.2.2)
|
132
|
+
thread_safe (~> 0.1)
|
133
|
+
websocket-driver (0.6.4)
|
134
|
+
websocket-extensions (>= 0.1.0)
|
135
|
+
websocket-extensions (0.1.2)
|
136
|
+
|
137
|
+
PLATFORMS
|
138
|
+
ruby
|
139
|
+
|
140
|
+
DEPENDENCIES
|
141
|
+
awesome_print
|
142
|
+
database_cleaner
|
143
|
+
factory_girl_rails
|
144
|
+
log_changes!
|
145
|
+
rspec-rails (~> 3.5)
|
146
|
+
sqlite3
|
147
|
+
|
148
|
+
BUNDLED WITH
|
149
|
+
1.13.6
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2016 Sean Huber
|
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,28 @@
|
|
1
|
+
# LogChanges
|
2
|
+
Short description and motivation.
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
How to use my plugin.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'log_changes'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
```bash
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
```bash
|
21
|
+
$ gem install log_changes
|
22
|
+
```
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
Contribution directions go here.
|
26
|
+
|
27
|
+
## License
|
28
|
+
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 = 'LogChanges'
|
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("../spec/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
load 'rails/tasks/statistics.rake'
|
20
|
+
|
21
|
+
begin
|
22
|
+
require 'bundler/setup'
|
23
|
+
rescue LoadError
|
24
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
25
|
+
end
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
|
29
|
+
Rake::TestTask.new(:test) do |t|
|
30
|
+
t.libs << 'lib'
|
31
|
+
t.libs << 'test'
|
32
|
+
t.pattern = 'test/**/*_test.rb'
|
33
|
+
t.verbose = false
|
34
|
+
end
|
35
|
+
|
36
|
+
task default: :test
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/app/helpers/.keep
ADDED
File without changes
|
data/app/mailers/.keep
ADDED
File without changes
|
data/app/models/.keep
ADDED
File without changes
|
data/app/views/.keep
ADDED
File without changes
|
data/bin/rails
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails gems
|
3
|
+
# installed from the root of your application.
|
4
|
+
|
5
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
6
|
+
ENGINE_PATH = File.expand_path('../../lib/log_changes/engine', __FILE__)
|
7
|
+
|
8
|
+
# Set up gems listed in the Gemfile.
|
9
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
10
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
11
|
+
|
12
|
+
require 'rails/all'
|
13
|
+
require 'rails/engine/commands'
|
data/config/routes.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
module LogChanges
|
2
|
+
module Base
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
before_save :build_changes_str, on: [:create, :update]
|
7
|
+
after_commit :log_changes, on: [:create, :update]
|
8
|
+
end
|
9
|
+
|
10
|
+
# TODO: add created_by, created_at, updated_by, and updated_at
|
11
|
+
def log_changes
|
12
|
+
log_str = (@is_new_record ? 'New' : 'Updated') + " #{self.class.name} {id: #{id}} #{to_s}\n"
|
13
|
+
log_str += @change_log_str if @change_log_str
|
14
|
+
sr_log(
|
15
|
+
self.class.name,
|
16
|
+
"#{Time.zone.now.strftime('%-m/%-d/%Y at %-l:%M %p (%Z)')}\n#{log_str}",
|
17
|
+
dir: Rails.root.join('log', 'record_changes').to_s
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
def build_changes_str
|
22
|
+
bt_assocs = self.class.reflect_on_all_associations(:belongs_to).map{|a| [a.options[:foreign_key].present? ? a.options[:foreign_key].to_s : "#{a.name}_id".to_s, {name: a.name, class: a.options[:polymorphic].present? ? nil : a.klass}]}.to_h
|
23
|
+
|
24
|
+
@is_new_record = new_record?
|
25
|
+
h = {}
|
26
|
+
changes.each do |k, vals|
|
27
|
+
bt_assoc = bt_assocs[k.to_s]
|
28
|
+
if bt_assoc.present?
|
29
|
+
h[bt_assoc[:name]] = []
|
30
|
+
vals.each do |val|
|
31
|
+
if bt_assoc[:class].nil?
|
32
|
+
h[bt_assoc[:name]] << val
|
33
|
+
else
|
34
|
+
v = bt_assoc[:class].find_by_id( val )
|
35
|
+
h[bt_assoc[:name]] << "{class: #{bt_assoc[:class].name}, id: #{val}} #{stringify_value(v)}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
else
|
39
|
+
h[k] = vals.map{|v| stringify_value(v)}
|
40
|
+
end
|
41
|
+
end
|
42
|
+
@change_log_str = if new_record?
|
43
|
+
h.map{|key_pair| " #{key_pair[0]}: #{key_pair[1][1]}"}.join("\n")
|
44
|
+
else
|
45
|
+
h.map{|key_pair| " #{key_pair[0]}:\n FROM: #{key_pair[1][0]}\n TO: #{key_pair[1][1]}"}.join("\n")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def stringify_value val
|
50
|
+
case
|
51
|
+
when val.nil?
|
52
|
+
'nil'
|
53
|
+
when val.is_a?(Time) || val.is_a?(ActiveSupport::TimeWithZone)
|
54
|
+
val.strftime('%-m/%-d/%Y at %-l:%M %p (%Z)')
|
55
|
+
else
|
56
|
+
val.to_s
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
data/lib/log_changes.rb
ADDED
data/log_changes.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
$:.push File.expand_path('../lib', __FILE__)
|
2
|
+
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require 'log_changes/version'
|
5
|
+
|
6
|
+
# Describe your gem and declare its dependencies:
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = 'log_changes'
|
9
|
+
s.version = LogChanges::VERSION
|
10
|
+
s.authors = ['Sean Huber']
|
11
|
+
s.email = ['seanhuber@seanhuber.com']
|
12
|
+
s.homepage = 'https://github.com/seanhuber/log_changes'
|
13
|
+
s.summary = 'Writes changes to ActiveRecord records to dedicated logfiles'
|
14
|
+
s.license = 'MIT'
|
15
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
s.bindir = 'exe'
|
17
|
+
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
|
+
s.require_paths = ['lib']
|
19
|
+
|
20
|
+
s.test_files = Dir['spec/**/*']
|
21
|
+
|
22
|
+
s.add_dependency 'rails', '>= 4.1'
|
23
|
+
s.add_dependency 'sr_log', '~> 1.0'
|
24
|
+
|
25
|
+
s.add_development_dependency 'awesome_print'
|
26
|
+
s.add_development_dependency 'sqlite3'
|
27
|
+
s.add_development_dependency 'rspec-rails', '~> 3.5'
|
28
|
+
s.add_development_dependency 'factory_girl_rails'
|
29
|
+
s.add_development_dependency 'database_cleaner'
|
30
|
+
end
|
data/spec/dummy/Rakefile
ADDED
@@ -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,13 @@
|
|
1
|
+
// Action Cable provides the framework to deal with WebSockets in Rails.
|
2
|
+
// You can generate new channels where WebSocket features live using the rails generate channel command.
|
3
|
+
//
|
4
|
+
//= require action_cable
|
5
|
+
//= require_self
|
6
|
+
//= require_tree ./channels
|
7
|
+
|
8
|
+
(function() {
|
9
|
+
this.App || (this.App = {});
|
10
|
+
|
11
|
+
App.cable = ActionCable.createConsumer();
|
12
|
+
|
13
|
+
}).call(this);
|
@@ -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,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
|
7
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
8
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
9
|
+
</head>
|
10
|
+
|
11
|
+
<body>
|
12
|
+
<%= yield %>
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
data/spec/dummy/bin/rake
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
require 'fileutils'
|
4
|
+
include FileUtils
|
5
|
+
|
6
|
+
# path to your application root.
|
7
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
8
|
+
|
9
|
+
def system!(*args)
|
10
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
+
end
|
12
|
+
|
13
|
+
chdir APP_ROOT do
|
14
|
+
# This script is a starting point to setup your application.
|
15
|
+
# Add necessary setup steps to this file.
|
16
|
+
|
17
|
+
puts '== Installing dependencies =='
|
18
|
+
system! 'gem install bundler --conservative'
|
19
|
+
system('bundle check') || system!('bundle install')
|
20
|
+
|
21
|
+
# puts "\n== Copying sample files =="
|
22
|
+
# unless File.exist?('config/database.yml')
|
23
|
+
# cp 'config/database.yml.sample', 'config/database.yml'
|
24
|
+
# end
|
25
|
+
|
26
|
+
puts "\n== Preparing database =="
|
27
|
+
system! 'bin/rails db:setup'
|
28
|
+
|
29
|
+
puts "\n== Removing old logs and tempfiles =="
|
30
|
+
system! 'bin/rails log:clear tmp:clear'
|
31
|
+
|
32
|
+
puts "\n== Restarting application server =="
|
33
|
+
system! 'bin/rails restart'
|
34
|
+
end
|