tuberack 1.0.4 → 1.0.5

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: 8ed580ce60e9883d5e81b33d15a38b6ac9a41797
4
- data.tar.gz: 5254c2935f9ed0e9e34e42196ad0e0c412cad7b6
3
+ metadata.gz: 929015491bb576c288df1db5fb0f013239c64e5d
4
+ data.tar.gz: f35243f87c96ae462a34a5449551266854429eb3
5
5
  SHA512:
6
- metadata.gz: 01cfbe8273eb0a87f36c2a9a3852e1df3e26933be8bb5e2c860842bb59e53b4fcebf069a1293db1712c3f57b72edac249b11ea540499fa75a927130f8434f93e
7
- data.tar.gz: f5be8dbe18c4845654ac1d1c30cdf591fa4d9f4868cda767a96b5e4577bba623c63fffb76b63daeb29a133a6b3e309d38e802fe62d6e8293347e68096298680b
6
+ metadata.gz: dba51ce50a7d8c6982266084ac5d0e8ae9b58ce176f2f4545a3ced45cc6c302602ca16d47df4a97048d41fda7e9ec6ccebc35d131894e218ef7930f04d807ac2
7
+ data.tar.gz: a9178396ae4a118394509b97c2f40656d8329c7ab85d925ebe01dee432a284e7f7575b1dbaef0663d6a0f3d34958417732834a71b4e2fb79ea3d8850630eba24
data/Rakefile CHANGED
@@ -1 +1,19 @@
1
- require "bundler/gem_tasks"
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
+ Bundler::GemHelper.install_tasks
8
+
9
+ require 'rake/testtask'
10
+
11
+ Rake::TestTask.new(:test) do |t|
12
+ t.libs << 'lib'
13
+ t.libs << 'test'
14
+ t.pattern = 'test/**/*_test.rb'
15
+ t.verbose = false
16
+ end
17
+
18
+
19
+ task default: :test
data/lib/tuberack.rb CHANGED
@@ -4,5 +4,8 @@ if ENV['RAILS_ENV'] == 'test'
4
4
  require 'tuberack/test_help'
5
5
  end
6
6
 
7
+ require 'tuberack/dummy_controller'
8
+ require 'tuberack/dummy_user'
9
+
7
10
  module Tuberack
8
11
  end
@@ -0,0 +1,29 @@
1
+ require 'tuberack/dummy_user'
2
+
3
+ module Tuberack
4
+ class DummyController < ActionController::Base
5
+ before_action :changes
6
+
7
+ def current_user
8
+ @@current_user ||= DummyUser.new
9
+ end
10
+
11
+ def xeditable? object
12
+ current_user.xeditable?
13
+ end
14
+ helper_method :xeditable?
15
+
16
+ def manage?
17
+ current_user.manage?
18
+ end
19
+ helper_method :manage?
20
+
21
+ private
22
+ def changes
23
+ current_user.manage = params[:manage] =~ /(true|1)/ ? true : false if params[:manage]
24
+ current_user.xeditable = params[:xeditable] =~ /(true|1)/ ? true : false if params[:xeditable]
25
+ 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
+ end
29
+ end
@@ -0,0 +1,12 @@
1
+ module Tuberack
2
+ class DummyUser
3
+ attr_accessor :roles, :id, :xeditable, :manage
4
+
5
+ def has_role? role
6
+ roles.split(',').include? role.to_s if roles
7
+ end
8
+
9
+ def xeditable?; xeditable end
10
+ def manage?; manage end
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
1
  module Tuberack
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
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.4
4
+ version: 1.0.5
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-01 00:00:00.000000000 Z
11
+ date: 2014-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -232,6 +232,8 @@ files:
232
232
  - Readme.md
233
233
  - lib/generators/tuberack/install_generator.rb
234
234
  - lib/tuberack.rb
235
+ - lib/tuberack/dummy_controller.rb
236
+ - lib/tuberack/dummy_user.rb
235
237
  - lib/tuberack/helpers.rb
236
238
  - lib/tuberack/requirements.rb
237
239
  - lib/tuberack/test_help.rb