redmine_with_git 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25be104e9c0c3b37180b555ca315c6f67823b290dad84ecf39329a7fcf5c6cb3
4
- data.tar.gz: 0b52c5a42db23a47750b54fdc7fd7751b1392ee861415974fb2a9aa6e38acbec
3
+ metadata.gz: e52be3e9ada1bb48f3b86fd07aa74ca17ebe3879cbb8cbcec839dd0aa1cc8552
4
+ data.tar.gz: 46b1cf44b1598a96029f444d25a08daca538e3b09ea4346070e88f6ce8dedd96
5
5
  SHA512:
6
- metadata.gz: 24aee9f362034257dc8600ecdcc9d875bea79be1daf7f41ce9416776ce2258fe73928b589ac1fa54cf690b0701d2345b3e508949284472f6d6f1fd4a617b70d2
7
- data.tar.gz: 55df434025cd75829e68acf441a238449d5ff584d3eb52a7e57711fdb5b72637f9bce29fab54a7f2859ddca6c8db3e038ffbb41f9d6b7f3581bb9ba8a87a299e
6
+ metadata.gz: 20e2702e1b74fbf0a04fff44adb099837daf4a88e516c452193bea3915b3a90abec4b2c2fa1d9532b6c04f6797034effdac70aad13a05bb7db6d26552efc27cf
7
+ data.tar.gz: 5fd8ad57fc3e7604bb06398bfdefe1bb2be1868937e772266faa3e2c1e61d81851e7693e0e3583421f241b351be3f83f772d3026c6dcee3743cc888055cc3fa8
@@ -1,7 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class RedmineWithGitController < ApplicationController
4
- before_filter :require_admin
3
+ class BackupController < ApplicationController
4
+ EXPORT_PERMISSION = 'redmine_with_git.backup.export'
5
+ IMPORT_PERMISSION = 'redmine_with_git.backup.import'
6
+
7
+ PERMISSIONS = { or: [EXPORT_PERMISSION, IMPORT_PERMISSION] }.freeze
8
+
9
+ layout 'nonproject_modules'
10
+ require_permission PERMISSIONS, only: [:index]
11
+ require_permission EXPORT_PERMISSION, only: [:export]
12
+ require_permission IMPORT_PERMISSION, only: [:import]
5
13
 
6
14
  accept_api_auth :export, :import
7
15
 
@@ -13,7 +21,10 @@ class RedmineWithGitController < ApplicationController
13
21
 
14
22
  def export
15
23
  Tempfile.open('redmine_export') do |file|
16
- ::RedmineWithGit::Dump::All.new(file.path, true)
24
+ ::RedmineWithGit::Dump::All.new(
25
+ file.path,
26
+ overwrite: ::RedmineWithGit::Dump::Base::OVERWRITE_ALLOWED
27
+ )
17
28
  send_file(file.path, filename: export_file_name, type: 'application/x-tar',
18
29
  size: file.size)
19
30
  end
@@ -32,7 +43,7 @@ class RedmineWithGitController < ApplicationController
32
43
 
33
44
  def import_respond_to_html
34
45
  if @load.errors.empty?
35
- redirect_to redmine_with_git_path, notice: 'Backup imported'
46
+ redirect_to backup_path, notice: 'Backup imported'
36
47
  else
37
48
  render :index
38
49
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module RedmineWithGitHelper
4
4
  def export_api_curl_command
5
- curl_command("curl -JLO '#{export_redmine_with_git_url(key: User.current.api_key)}'")
5
+ curl_command("curl -JLO '#{export_backup_url(key: User.current.api_key)}'")
6
6
  end
7
7
 
8
8
  def import_api_curl_command
@@ -10,7 +10,7 @@ module RedmineWithGitHelper
10
10
  curl -X POST \\
11
11
  -F '#{import_param_key}=@<PATH_TO_BACKUP_FILE>' \\
12
12
  -F 'key=#{User.current.api_key}' \\
13
- #{import_redmine_with_git_url(format: 'json')}
13
+ #{import_backup_url(format: 'json')}
14
14
  IMPORT_CURL
15
15
  end
16
16
 
@@ -0,0 +1,14 @@
1
+ <div>
2
+ <%= link_to_function(l(:button_show), "$('#redmine_with_git_api').toggle();")%>
3
+ <div id='redmine_with_git_api' class="autoscroll" >
4
+ <% if ::GroupPermission.permission?(::BackupController::EXPORT_PERMISSION) %>
5
+ <h4>Export CURL command</h4>
6
+ <%= export_api_curl_command %>
7
+ <% end %>
8
+ <% if ::GroupPermission.permission?(::BackupController::IMPORT_PERMISSION) %>
9
+ <h4>Import CURL command</h4>
10
+ <%= import_api_curl_command %>
11
+ <% end %>
12
+ </div>
13
+ </div>
14
+ <%= javascript_tag("$('#redmine_with_git_api').hide();") %>
@@ -0,0 +1 @@
1
+ <%= link_to 'Export', export_backup_path %>
@@ -1,4 +1,4 @@
1
- <%= labelled_form_for @load, url: import_redmine_with_git_path, method: :post do |f| %>
1
+ <%= labelled_form_for @load, url: import_backup_path, method: :post do |f| %>
2
2
  <%= error_messages_for @load %>
3
3
  <div class="box tabular">
4
4
  <p>
@@ -0,0 +1,13 @@
1
+ <h2>Redmine With Git</h2>
2
+ <% if ::GroupPermission.permission?(::BackupController::EXPORT_PERMISSION) %>
3
+ <h3>Export</h3>
4
+ <%= render partial: 'export' %>
5
+ <% end %>
6
+ <% if ::GroupPermission.permission?(::BackupController::IMPORT_PERMISSION) %>
7
+ <h3>Import</h3>
8
+ <%= render partial: 'import' %>
9
+ <% end %>
10
+ <% if Setting.rest_api_enabled? %>
11
+ <h3>API</h3>
12
+ <%= render partial: 'api' %>
13
+ <% end %>
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Redmine::Plugin.post_register :redmine_with_git do
4
- # Source: https://github.com/esquilo-azul/redmine_plugins_helper
5
- requires_redmine_plugin(:redmine_plugins_helper, version_or_higher: '0.5.2')
4
+ # Source: https://github.com/esquilo-azul/redmine_nonproject_modules
5
+ requires_redmine_plugin(:redmine_nonproject_modules, version_or_higher: '0.3.0')
6
6
  # Source: https://github.com/jbox-web/redmine_bootstrap_kit.git
7
7
  # Note: redmine_bootstrap_kit is a redmine_git_hosting's dependency.
8
8
  requires_redmine_plugin(:redmine_bootstrap_kit, version_or_higher: '0.2.5')
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ Redmine::MenuManager.map :redmine_with_git do |menu|
4
+ menu.push_controller(:backup)
5
+ end
@@ -1,4 +1,5 @@
1
1
  en:
2
+ label_backup: Backup
2
3
  eac_ruby_utils:
3
4
  listable:
4
5
  redmine_with_git/dump/base:
@@ -8,3 +9,7 @@ en:
8
9
  denied:
9
10
  label: Denied
10
11
  field_path: Path
12
+ permission_redmine_with_git:
13
+ backup:
14
+ export_description: Allows to export the backup package.
15
+ import_description: Allows to import a backup package.
@@ -1,4 +1,5 @@
1
1
  pt-BR:
2
+ label_backup: Backup
2
3
  eac_ruby_utils:
3
4
  listable:
4
5
  redmine_with_git/dump/base:
@@ -8,3 +9,7 @@ pt-BR:
8
9
  denied:
9
10
  label: Negado
10
11
  field_path: Caminho
12
+ permission_redmine_with_git:
13
+ backup:
14
+ export_description: Permite exportar o pacote de backup.
15
+ import_description: Permite importar um pacote de backup.
data/config/routes.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  RedmineApp::Application.routes.draw do
4
- get '/redmine_with_git', to: 'redmine_with_git#index', as: 'redmine_with_git'
5
- get '/redmine_with_git/export', to: 'redmine_with_git#export', as: 'export_redmine_with_git'
6
- post '/redmine_with_git/import', to: 'redmine_with_git#import', as: 'import_redmine_with_git'
4
+ get '/backup', to: 'backup#index', as: 'backup'
5
+ get '/backup/export', to: 'backup#export', as: 'export_backup'
6
+ post '/backup/import', to: 'backup#import', as: 'import_backup'
7
7
  end
data/init.rb CHANGED
@@ -13,10 +13,4 @@ Redmine::Plugin.register :redmine_with_git do
13
13
  version ::RedmineWithGit::VERSION
14
14
  url 'https://github.com/esquilo-azul/redmine_with_git'
15
15
  author_url 'https://github.com/esquilo-azul'
16
-
17
- Redmine::MenuManager.map :admin_menu do |menu|
18
- menu.push :redmine_with_git, { controller: 'redmine_with_git', action: 'index', id: nil },
19
- caption: 'Redmine with Git',
20
- if: proc { User.current.admin? }
21
- end
22
16
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RedmineWithGit
4
- VERSION = '0.3.0'
4
+ VERSION = '0.4.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redmine_with_git
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-22 00:00:00.000000000 Z
11
+ date: 2019-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avm-tools
@@ -64,15 +64,16 @@ executables: []
64
64
  extensions: []
65
65
  extra_rdoc_files: []
66
66
  files:
67
- - app/controllers/redmine_with_git_controller.rb
67
+ - app/controllers/backup_controller.rb
68
68
  - app/helpers/redmine_with_git_helper.rb
69
69
  - app/models/redmine_with_git/tableless/load.rb
70
- - app/views/redmine_with_git/_api.html.erb
71
- - app/views/redmine_with_git/_export.html.erb
72
- - app/views/redmine_with_git/_import.html.erb
73
- - app/views/redmine_with_git/index.html.erb
70
+ - app/views/backup/_api.html.erb
71
+ - app/views/backup/_export.html.erb
72
+ - app/views/backup/_import.html.erb
73
+ - app/views/backup/index.html.erb
74
74
  - config/initializers/000_dependencies.rb
75
75
  - config/initializers/001_patches.rb
76
+ - config/initializers/500_nonproject_modules.rb
76
77
  - config/locales/en.yml
77
78
  - config/locales/pt-BR.yml
78
79
  - config/routes.rb
@@ -1,10 +0,0 @@
1
- <div>
2
- <%= link_to_function(l(:button_show), "$('#redmine_with_git_api').toggle();")%>
3
- <div id='redmine_with_git_api' class="autoscroll" >
4
- <h4>Export CURL command</h4>
5
- <%= export_api_curl_command %>
6
- <h4>Import CURL command</h4>
7
- <%= import_api_curl_command %>
8
- </div>
9
- </div>
10
- <%= javascript_tag("$('#redmine_with_git_api').hide();") %>
@@ -1 +0,0 @@
1
- <%= link_to 'Export', export_redmine_with_git_path %>
@@ -1,9 +0,0 @@
1
- <h2>Redmine With Git</h2>
2
- <h3>Export</h3>
3
- <%= render partial: 'export' %>
4
- <h3>Import</h3>
5
- <%= render partial: 'import' %>
6
- <% if Setting.rest_api_enabled? %>
7
- <h3>API</h3>
8
- <%= render partial: 'api' %>
9
- <% end %>