tuberack 1.0.5 → 1.0.6

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: 929015491bb576c288df1db5fb0f013239c64e5d
4
- data.tar.gz: f35243f87c96ae462a34a5449551266854429eb3
3
+ metadata.gz: 696a3bcb324d0642ad2bc732cfe73a98d03b6b82
4
+ data.tar.gz: cfe1fdf6f5e48d93219f9406aaa2ad92d74ee830
5
5
  SHA512:
6
- metadata.gz: dba51ce50a7d8c6982266084ac5d0e8ae9b58ce176f2f4545a3ced45cc6c302602ca16d47df4a97048d41fda7e9ec6ccebc35d131894e218ef7930f04d807ac2
7
- data.tar.gz: a9178396ae4a118394509b97c2f40656d8329c7ab85d925ebe01dee432a284e7f7575b1dbaef0663d6a0f3d34958417732834a71b4e2fb79ea3d8850630eba24
6
+ metadata.gz: 8fac9b1ee564eaea4c64730d50eb255590f2f6023f7fe2bd0a1fc34a4208cf33ba4fc5122c347f47d4ca50dfe9a50430d63b6e51f52841a332c5c85a0a9fa0b3
7
+ data.tar.gz: dadd90dc01bedc29e9bd9b97d5e8595fe77c340de8636321cb71550605243256f850c7893e9900c9fb57008a4d3b2b2729fb72552c6bb6b76ff79c0aeba06a74
data/Rakefile CHANGED
@@ -4,6 +4,9 @@ rescue LoadError
4
4
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
5
  end
6
6
 
7
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
8
+ load 'rails/tasks/engine.rake'
9
+
7
10
  Bundler::GemHelper.install_tasks
8
11
 
9
12
  require 'rake/testtask'
data/lib/tuberack.rb CHANGED
@@ -1,11 +1,12 @@
1
+ require 'tuberack/engine'
2
+ require 'tuberack/dummy_controller'
3
+ require 'tuberack/dummy_user'
4
+
1
5
  if ENV['RAILS_ENV'] == 'test'
2
6
  require 'tuberack/requirements'
3
7
  require 'tuberack/helpers'
4
8
  require 'tuberack/test_help'
5
9
  end
6
10
 
7
- require 'tuberack/dummy_controller'
8
- require 'tuberack/dummy_user'
9
-
10
11
  module Tuberack
11
12
  end
@@ -20,10 +20,18 @@ module Tuberack
20
20
 
21
21
  private
22
22
  def changes
23
+ @@current_user = set_user if params[:user]
23
24
  current_user.manage = params[:manage] =~ /(true|1)/ ? true : false if params[:manage]
24
25
  current_user.xeditable = params[:xeditable] =~ /(true|1)/ ? true : false if params[:xeditable]
25
26
  current_user.roles = params[:role] == 'clear' ? nil : params[:role] if params[:role]
26
- current_user.id = params[:user_id] == 'clear' ? nil : params[:user_id] if params[:user_id]
27
+ end
28
+
29
+ def set_user
30
+ if params[:user].to_i == 0
31
+ nil
32
+ else
33
+ DummyUser.find_or_create_by(id: params[:user].to_i) unless current_user.id == params[:user].to_i
34
+ end
27
35
  end
28
36
  end
29
37
  end
@@ -1,6 +1,6 @@
1
1
  module Tuberack
2
- class DummyUser
3
- attr_accessor :roles, :id, :xeditable, :manage
2
+ class DummyUser < ActiveRecord::Base
3
+ attr_accessor :roles, :xeditable, :manage
4
4
 
5
5
  def has_role? role
6
6
  roles.split(',').include? role.to_s if roles
@@ -0,0 +1,11 @@
1
+ module Tuberack
2
+ class Engine < ::Rails::Engine
3
+ initializer :append_migrations do |app|
4
+ unless app.root.to_s.match root.to_s
5
+ config.paths["db/migrate"].expanded.each do |expanded_path|
6
+ app.config.paths["db/migrate"] << expanded_path
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module Tuberack
2
- VERSION = "1.0.5"
2
+ VERSION = "1.0.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tuberack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - JiriKolarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-03 00:00:00.000000000 Z
11
+ date: 2014-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -234,6 +234,7 @@ files:
234
234
  - lib/tuberack.rb
235
235
  - lib/tuberack/dummy_controller.rb
236
236
  - lib/tuberack/dummy_user.rb
237
+ - lib/tuberack/engine.rb
237
238
  - lib/tuberack/helpers.rb
238
239
  - lib/tuberack/requirements.rb
239
240
  - lib/tuberack/test_help.rb