dradis-plugins 3.7.0 → 3.8.0

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: b4465a6abfcfcc1f72c2507db25a1fec1c078539
4
- data.tar.gz: 451a8b3b7676968c4f2cd9640ed975b02cb31d77
3
+ metadata.gz: 43412fef9a1ce0d5e24d02546a75dedacb209213
4
+ data.tar.gz: e29e14fa8aca8562f45ae97a23cf71ca5f1ce900
5
5
  SHA512:
6
- metadata.gz: 38544da5415a6f1107a641b549e20b088767a58c040e97842a3f314813d2563fb313ceeaeb0dc2e60060760928d6f6cff23a1d2d55109a49674cbd31261e9b34
7
- data.tar.gz: 918e42243f03461549f368abf0e2f59ce60a6dcf0428ed56bd3b77645d5c94d41fdbc12e6374c78eb2f38ef44c811e66c3709a888ece8866059b7258c1a992a2
6
+ metadata.gz: 05c9887fc3115911747e0ecd66f3981daf5564d8c8bcac2ac67df7f5fb0306d257cf7a05831fe716ad106a995f6f82307388a42631f99dd69fe376e2370f9738
7
+ data.tar.gz: d3f77b273aae02f01ec14d030d87d3d2579dc38664c830b6e46824c1f6a45f37741cd286ddb1b2e5f31d2b45d61a21779fee81dc3b7d975d9c9f569a13f5d286
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## Dradis Framework 3.8 (September, 2017) ##
2
+
3
+ * Add ContentService#all_content_blocks method to access the current project's
4
+ content blocks.
5
+
6
+ * Add ContentService#create_content_blocks method to create content blocks
7
+ with.
8
+
9
+ * Add default_user_id attribute to the importer.
10
+
1
11
  ## Dradis Framework 3.7 (July, 2017) ##
2
12
 
3
13
  * Add ContentService#all_properties method to access the current project's
@@ -1,5 +1,6 @@
1
1
  require 'dradis/plugins/content_service/boards'
2
2
  require 'dradis/plugins/content_service/categories'
3
+ require 'dradis/plugins/content_service/content_blocks'
3
4
  require 'dradis/plugins/content_service/core'
4
5
  require 'dradis/plugins/content_service/evidence'
5
6
  require 'dradis/plugins/content_service/issues'
@@ -11,13 +12,14 @@ module Dradis::Plugins::ContentService
11
12
  class Base
12
13
  include Core
13
14
 
14
- include Boards if defined?(Dradis::Pro)
15
+ include Boards if defined?(Dradis::Pro)
15
16
  include Categories
17
+ include ContentBlocks if defined?(Dradis::Pro)
16
18
  include Evidence
17
19
  include Issues
18
20
  include Nodes
19
21
  include Notes
20
- include Properties if defined?(Dradis::Pro)
22
+ include Properties if defined?(Dradis::Pro)
21
23
 
22
24
  ActiveSupport.run_load_hooks(:content_service, self)
23
25
  end
@@ -0,0 +1,44 @@
1
+ module Dradis::Plugins::ContentService
2
+ module ContentBlocks
3
+ extend ActiveSupport::Concern
4
+
5
+ def all_content_blocks
6
+ ContentBlock.where(project_id: project.id)
7
+ end
8
+
9
+ def create_content_block(args={})
10
+ block_group = args.fetch(:block_group, default_content_block_group)
11
+ content = args.fetch(:content, default_content_block_content)
12
+ user_id = args.fetch(:user_id)
13
+
14
+ content_block = ContentBlock.new(
15
+ content: content,
16
+ block_group: block_group,
17
+ project_id: project.id,
18
+ user_id: user_id
19
+ )
20
+
21
+ if content_block.valid?
22
+ content_block.save
23
+ else
24
+ try_rescue_from_length_validation(
25
+ model: content_block,
26
+ field: :content,
27
+ text: content,
28
+ msg: 'Error in create_content_block()',
29
+ tail: plugin_details
30
+ )
31
+ end
32
+ end
33
+
34
+ private
35
+
36
+ def default_content_block_content
37
+ "create_content_block() invoked by #{plugin} without a :content parameter"
38
+ end
39
+
40
+ def default_content_block_group
41
+ "create_content_block() invoked by #{plugin} without a :block_group parameter"
42
+ end
43
+ end
44
+ end
@@ -7,7 +7,7 @@ module Dradis
7
7
 
8
8
  module VERSION
9
9
  MAJOR = 3
10
- MINOR = 7
10
+ MINOR = 8
11
11
  TINY = 0
12
12
  PRE = nil
13
13
 
@@ -5,7 +5,15 @@ module Dradis
5
5
  module Plugins
6
6
  module Upload
7
7
  class Importer
8
- attr_accessor :content_service, :logger, :options, :plugin, :project, :template_service
8
+ attr_accessor(
9
+ :content_service,
10
+ :default_user_id,
11
+ :logger,
12
+ :options,
13
+ :plugin,
14
+ :project,
15
+ :template_service
16
+ )
9
17
 
10
18
  def initialize(args={})
11
19
  @options = args
@@ -13,6 +21,7 @@ module Dradis
13
21
  @logger = args.fetch(:logger, Rails.logger)
14
22
  @plugin = args[:plugin] || default_plugin
15
23
  @project = args.key?(:project_id) ? Project.find(args[:project_id]) : nil
24
+ @default_user_id = args[:default_user_id] || -1
16
25
 
17
26
  @content_service = args.fetch(:content_service, default_content_service)
18
27
  @template_service = args.fetch(:template_service, default_template_service)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dradis-plugins
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 3.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Martin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-27 00:00:00.000000000 Z
11
+ date: 2017-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -76,6 +76,7 @@ files:
76
76
  - lib/dradis/plugins/content_service/base.rb
77
77
  - lib/dradis/plugins/content_service/boards.rb
78
78
  - lib/dradis/plugins/content_service/categories.rb
79
+ - lib/dradis/plugins/content_service/content_blocks.rb
79
80
  - lib/dradis/plugins/content_service/core.rb
80
81
  - lib/dradis/plugins/content_service/evidence.rb
81
82
  - lib/dradis/plugins/content_service/issues.rb