# Generated from aki-operations-1.0.0.gem by gem2rpm -*- rpm-spec -*- %global gem_name aki-operations Name: rubygem-%{gem_name} Version: 1.0.0 Release: 1%{?dist} Summary: # Rails Operations Manage your users' operations (permissions to execute some actions) in your Ruby on Rails application. ## Requirements Prior to installing, please make sure these gems can be installed on your system: - rails (v5.2+) If you wish to run this gem locally, the following gems are also to consider: - bootstrap (v4.1+) - jquery-rails (v4.3+) - jquery-ui-rails (v6.0+) - bootstrap4-kaminari-views - sqlite3 (v1.3.6+) - sass-rails (v5.0+) - select2-rails - web-console ## Installation Add this line to your application's Gemfile: ```ruby gem 'operations' ``` And then execute: ```bash $ bundle ``` Or install it yourself as: ```bash $ gem install operations ``` ## Usage Here are the most relevant API entries from this Gem: ```ruby ### From Operations module Operations.operations_list # All valid Operations::Operation from Rails config Operations.from_string(name) # Gets the Operations::Operation by string Operations.allows?(user, name) # Checks if the user can execute the operation string Operations.user_roles # All users roles defined in the Rails config ### From Operations::Operation class operation = Operations::Operation.new do |operation| # Your operation name operation.name = 'my_operation' # Allows :admin, :technician, :regular and :guest. # These can be set in your config/application.rb with the # variable config.user_roles. Example: # # module MyApp # class Application < Rails::Application # config.user_roles += {name: 'my_other_scope'} # end # end operation.scope = :admin end # Or operation = Operations::Operation.new{name: :my_operation, scope: :admin} # Instance variable allowed_users = operation.users # Returns a list of users based on the scope is_valid = operation.is_valid? # For validation purposes ### Core extensions # Convert a string to a list of Operations::Operations "bf9[..]a248".to_operation # From a UUID (example truncated) "{\"name\":\"my_operation\",\"scope\":\"admin\"}".to_operation # From a valid JSON string ``` ## Contributing Do you wish to contribute? It's simple! All you need to do is: - Fork this project - Work your magic - **RUN TESTS** - _Don't forget to synchronize with the master branch!_ - Push to your fork - Make a pull request! ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT) License: MIT URL: https://git.rakuten-it.com Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem BuildRequires: ruby(release) BuildRequires: rubygems-devel BuildRequires: ruby # BuildRequires: rubygem(bootstrap) >= 4.1 # BuildRequires: rubygem(bootstrap) < 5 # BuildRequires: rubygem(bootstrap) >= 4.1.3 # BuildRequires: rubygem(jquery-rails) >= 4.3 # BuildRequires: rubygem(jquery-rails) < 5 # BuildRequires: rubygem(jquery-rails) >= 4.3.3 # BuildRequires: rubygem(jquery-ui-rails) >= 6.0 # BuildRequires: rubygem(bootstrap4-kaminari-views) # BuildRequires: rubygem(sqlite3) >= 1.3.6 # BuildRequires: rubygem(sqlite3) < 1.4 # BuildRequires: rubygem(sass-rails) >= 5.0 # BuildRequires: rubygem(sass-rails) < 6 # BuildRequires: rubygem(select2-rails) # BuildRequires: rubygem(web-console) BuildArch: noarch %description Manage your users' operations (permissions to execute some actions) in your application. %package doc Summary: Documentation for %{name} Requires: %{name} = %{version}-%{release} BuildArch: noarch %description doc Documentation for %{name}. %prep %setup -q -n %{gem_name}-%{version} %build # Create the gem as gem install only works on a gem file gem build ../%{gem_name}-%{version}.gemspec # %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir # by default, so that we can move it into the buildroot in %%install %gem_install %install mkdir -p %{buildroot}%{gem_dir} cp -a .%{gem_dir}/* \ %{buildroot}%{gem_dir}/ %check pushd .%{gem_instdir} # Run the test suite. popd %files %dir %{gem_instdir} %license %{gem_instdir}/MIT-LICENSE %{gem_instdir}/app %{gem_instdir}/config %{gem_libdir} %exclude %{gem_cache} %{gem_spec} %files doc %doc %{gem_docdir} %doc %{gem_instdir}/README.md %{gem_instdir}/Rakefile %changelog * Sun Sep 12 2021 mockbuilder - 1.0.0-1 - Initial package