sharepoint_api 1.0.2 → 1.0.3

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
  SHA256:
3
- metadata.gz: 5c05bcfa82a6db67d9f534913826d123879b36617cf08414f324397882847848
4
- data.tar.gz: 5002313d37f643cb89780d5fdb22dee5804e7366ba46f50f5b938fb1976a5db9
3
+ metadata.gz: a04ca042235cb062f83374dc540fd27d12b2068bb356bf52b54716e48b15c905
4
+ data.tar.gz: 6923a225c514c6a53c8f08d7b95e072fc75272db591f232c4148ed7eece95c95
5
5
  SHA512:
6
- metadata.gz: 9b7867fdb75d7afee66c3d23660dc600ffa2227a33a7da16f15a45ae9d3019b7ff7ec7ab3ec5604f5a30b17f3878df2fc7cb30f6ff2da95c5b14fb520042b5b9
7
- data.tar.gz: a0a4201b08b3eb6c1c3713a92ecdfefe0413ffcd0372eca2f3e8a4bd4e5f039cbf12f7e5b5aedc555dd83bc599d67543f9fc5acb26b4e8bc2fbb278a74984349
6
+ metadata.gz: 96c52d86e21e98b0e2e2430b151fe91a253412b98dac1d2952b983e8fa37e605839cd58ea3c6e640901a4fcb14caa58637ff1391e1a068f44894d69d0102df1e
7
+ data.tar.gz: 37a24f9c97d3e279be6a438dadd276030d319b62964347570f9ab2d3a81320b31cd82da3b04a95f0b9b2495364ef56f87d4e8ee36a8f150d2d7d3576eabffdb4
data/.pryrc ADDED
@@ -0,0 +1,46 @@
1
+ #!/usr/env/bin ruby
2
+
3
+ # user = `echo "$USER"`.strip
4
+ class ProgrammerError < StandardError; end
5
+
6
+ if defined?(Pry)
7
+ Pry.config.editor = 'vim'
8
+
9
+ # Hit enter to repeat the last command.
10
+ Pry::Commands.command(/^$/, 'Repeat last command.') do
11
+ pry_instance.run_command Pry.history.to_a.last
12
+ end
13
+
14
+ Pry::Commands.command('args', 'Display local variables.') do
15
+ pry_instance.run_command 'ls -l'
16
+ end
17
+
18
+ Pry.commands.alias_command 'ss', 'show-source'
19
+ Pry.commands.alias_command 'q', 'quit'
20
+ Pry.commands.alias_command 'w', 'whereami'
21
+ Pry.commands.alias_command 'r', 'reload-code'
22
+ Pry.commands.alias_command 'ed', 'edit'
23
+ Pry.commands.alias_command 'ec', 'edit -c' # open current file in editor
24
+ end
25
+
26
+ if defined?(PryByebug)
27
+ Pry.commands.alias_command 'b', 'backtrace'
28
+ Pry.commands.alias_command 'c', 'continue'
29
+ Pry.commands.alias_command 'n', 'next'
30
+ Pry.commands.alias_command 's', 'step'
31
+ end
32
+
33
+ class String
34
+ def gitize
35
+ gsub(/\W+$/, ''). # kill trailing whitespace
36
+ gsub(/\W+/, '-'). # replace whitespace with -
37
+ gsub(/([A-Z])/, '-\1'). # prepend dash to capitals
38
+ gsub(/^-/, ''). # strip leading dash
39
+ gsub(/-+/, '-'). # compress multiple dashes to a single dash
40
+ downcase
41
+ end
42
+
43
+ def prize
44
+ gsub(/\W+$/, '').gsub(/\W+/, ' ').gsub(/\b(?<!['’`])[a-z]/, &:capitalize)
45
+ end
46
+ end
@@ -1,3 +1,6 @@
1
+ ## [1.0.3] - 2021-01-12
2
+ * Handle edge case where FileInfo file#modified_by refers to a user that no longer exists.
3
+
1
4
  ## [1.0.2] - 2021-01-04
2
5
  * Handle edge case where FileInfo file/file version refers to a user that no longer exists.
3
6
 
data/Gemfile CHANGED
@@ -5,9 +5,14 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
5
5
  # Specify your gem's dependencies in sharepoint_api.gemspec
6
6
  gemspec
7
7
 
8
- gem 'faker'
8
+ gem 'faker', '~> 2.15'
9
+ gem 'guard', '~> 2.16'
10
+ gem 'guard-rspec', '~> 4.7'
11
+ gem 'pry', '~> 0.13.1'
12
+ gem 'pry-byebug', '~> 3.9'
13
+ gem 'pry-rescue', '~> 1.5'
9
14
  gem 'rake', '~> 13.0'
10
15
  gem 'rspec', '~> 3.6'
11
- gem 'rspec-collection_matchers'
16
+ gem 'rspec-collection_matchers', '~> 1.2'
12
17
  gem 'rubocop', '~> 1.5'
13
18
  gem 'rubocop-rspec', '~> 2.0'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sharepoint_api (1.0.2)
4
+ sharepoint_api (1.0.3)
5
5
  addressable (~> 2.7)
6
6
  proof-sharepoint-ruby (~> 1.0)
7
7
 
@@ -11,21 +11,61 @@ GEM
11
11
  addressable (2.7.0)
12
12
  public_suffix (>= 2.0.2, < 5.0)
13
13
  ast (2.4.1)
14
+ byebug (11.1.3)
15
+ coderay (1.1.3)
14
16
  concurrent-ruby (1.1.7)
15
17
  curb (0.9.10)
16
18
  diff-lcs (1.4.4)
17
19
  faker (2.15.1)
18
20
  i18n (>= 1.6, < 2)
21
+ ffi (1.14.2)
22
+ formatador (0.2.5)
23
+ guard (2.16.2)
24
+ formatador (>= 0.2.4)
25
+ listen (>= 2.7, < 4.0)
26
+ lumberjack (>= 1.0.12, < 2.0)
27
+ nenv (~> 0.1)
28
+ notiffany (~> 0.0)
29
+ pry (>= 0.9.12)
30
+ shellany (~> 0.0)
31
+ thor (>= 0.18.1)
32
+ guard-compat (1.2.1)
33
+ guard-rspec (4.7.3)
34
+ guard (~> 2.1)
35
+ guard-compat (~> 1.1)
36
+ rspec (>= 2.99.0, < 4.0)
19
37
  i18n (1.8.5)
20
38
  concurrent-ruby (~> 1.0)
39
+ interception (0.5)
40
+ listen (3.4.0)
41
+ rb-fsevent (~> 0.10, >= 0.10.3)
42
+ rb-inotify (~> 0.9, >= 0.9.10)
43
+ lumberjack (1.2.8)
44
+ method_source (1.0.0)
45
+ nenv (0.3.0)
46
+ notiffany (0.1.3)
47
+ nenv (~> 0.1)
48
+ shellany (~> 0.0)
21
49
  parallel (1.20.1)
22
50
  parser (2.7.2.0)
23
51
  ast (~> 2.4.1)
24
52
  proof-sharepoint-ruby (1.0.0)
25
53
  curb (~> 0.8, <= 0.9.10)
54
+ pry (0.13.1)
55
+ coderay (~> 1.1)
56
+ method_source (~> 1.0)
57
+ pry-byebug (3.9.0)
58
+ byebug (~> 11.0)
59
+ pry (~> 0.13.0)
60
+ pry-rescue (1.5.2)
61
+ interception (>= 0.5)
62
+ pry (>= 0.12.0)
26
63
  public_suffix (4.0.6)
27
64
  rainbow (3.0.0)
28
65
  rake (13.0.1)
66
+ rb-fsevent (0.10.4)
67
+ rb-inotify (0.10.1)
68
+ ffi (~> 1.0)
29
69
  regexp_parser (2.0.0)
30
70
  rexml (3.2.4)
31
71
  rspec (3.10.0)
@@ -58,19 +98,26 @@ GEM
58
98
  rubocop (~> 1.0)
59
99
  rubocop-ast (>= 1.1.0)
60
100
  ruby-progressbar (1.10.1)
101
+ shellany (0.0.1)
102
+ thor (1.0.1)
61
103
  unicode-display_width (1.7.0)
62
104
 
63
105
  PLATFORMS
64
106
  ruby
65
107
 
66
108
  DEPENDENCIES
67
- faker
109
+ faker (~> 2.15)
110
+ guard (~> 2.16)
111
+ guard-rspec (~> 4.7)
112
+ pry (~> 0.13.1)
113
+ pry-byebug (~> 3.9)
114
+ pry-rescue (~> 1.5)
68
115
  rake (~> 13.0)
69
116
  rspec (~> 3.6)
70
- rspec-collection_matchers
117
+ rspec-collection_matchers (~> 1.2)
71
118
  rubocop (~> 1.5)
72
119
  rubocop-rspec (~> 2.0)
73
120
  sharepoint_api!
74
121
 
75
122
  BUNDLED WITH
76
- 1.17.2
123
+ 2.2.4
@@ -0,0 +1,42 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %w(app lib config test spec features) \
6
+ # .select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
+
8
+ ## Note: if you are using the `directories` clause above and you are not
9
+ ## watching the project directory ('.'), then you will want to move
10
+ ## the Guardfile to a watched dir and symlink it back, e.g.
11
+ #
12
+ # $ mkdir config
13
+ # $ mv Guardfile config/
14
+ # $ ln -s config/Guardfile .
15
+ #
16
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
+
18
+ # Note: The cmd option is now required due to the increasing number of ways
19
+ # rspec may be run, below are examples of the most common uses.
20
+ # * bundler: 'bundle exec rspec'
21
+ # * bundler binstubs: 'bin/rspec'
22
+ # * spring: 'bin/rspec' (This will use spring if running and you have
23
+ # installed the spring binstubs per the docs)
24
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
25
+ # * 'just' rspec: 'rspec'
26
+
27
+ guard :rspec, cmd: 'echo -e "\033c"; bundle exec rspec' do
28
+ require 'guard/rspec/dsl'
29
+ dsl = Guard::RSpec::Dsl.new(self)
30
+
31
+ # Feel free to open issues for suggestions and improvements
32
+
33
+ # RSpec files
34
+ rspec = dsl.rspec
35
+ watch(rspec.spec_helper) { rspec.spec_dir }
36
+ watch(rspec.spec_support) { rspec.spec_dir }
37
+ watch(rspec.spec_files)
38
+
39
+ # Ruby files
40
+ ruby = dsl.ruby
41
+ dsl.watch_spec_files_for(ruby.lib_files)
42
+ end
data/README.md CHANGED
@@ -39,25 +39,27 @@ api = SharepointApi.new(
39
39
 
40
40
  api.fetch_content_types # or whatever method you want to test.
41
41
  ```
42
+
42
43
  ## Development
43
44
 
44
45
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
45
46
 
46
47
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
47
48
 
49
+ > NOTE: run `bundle install` and commit the changes to the Gemfile.lock before deploying a new version.
50
+
48
51
  ## Testing
49
52
 
50
- Run the test suite:
51
- `rspec`
53
+ Start the test suite watcher:
54
+ `bundle exec guard`
52
55
 
53
- Run the tests for just one file:
54
- `rspec spec/sharepoint_api/items_spec.rb`
56
+ Run the tests for just one file just enter the filename in the Guard console.
57
+ `spec/sharepoint_api/items_spec.rb`
55
58
 
56
59
  ## Contributing
57
60
 
58
61
  Bug reports and pull requests are welcome on GitHub at https://github.com/anlek/sharepoint_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/anlek/sharepoint_api/blob/master/CODE_OF_CONDUCT.md).
59
62
 
60
-
61
63
  ## License
62
64
 
63
65
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -7,8 +7,8 @@ require "sharepoint_api"
7
7
  # with your gem easier. You can also use a different console, if you like.
8
8
 
9
9
  # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
10
+ require "pry"
11
+ Pry.start
12
12
 
13
- require "irb"
14
- IRB.start(__FILE__)
13
+ # require "irb"
14
+ # IRB.start(__FILE__)
@@ -0,0 +1,38 @@
1
+ [XXXXX](https://proof-tech.atlassian.net/browse/XXXXX)
2
+
3
+ ### Overview
4
+
5
+ Please include a summary of the changes in this pull request.
6
+ List any dependencies that are required before this change is applied.
7
+
8
+ ### Solution
9
+
10
+ How did you solve the problem?
11
+ Call out any particular implementation choices or design decisions you made
12
+
13
+ ### Screenshots
14
+
15
+ [insert screenshots here]
16
+
17
+ ### Testing Instructions
18
+
19
+ Describe, for your colleagues, how they can test your code locally on their system
20
+
21
+ ### Pre-Merge Checklist
22
+
23
+ - [ ] I have updated the version and changelog in a different PR than bug fixes and features.
24
+ - [ ] The work here reflects the user stories in the JIRA ticket(s) listed at the top of this pull request
25
+ - [ ] This pull request has been referenced via URL in the JIRA ticket(s) listed
26
+ - [ ] I have performed a self-review of the code I have written here
27
+ - [ ] I have done end-to-end QA testing of sections of the code I have altered
28
+ - [ ] My changes generate no new warnings / errors in the console
29
+ - [ ] I have written/updated Ruby tests for the areas of the code base that I have modified
30
+ - [ ] I am prepared for this code to go to production today (or there is a WIP label on the pull request)
31
+ - [ ] I am prepared to write hotfixes or rollback my code if something goes wrong
32
+
33
+ ### Gem Deployment Instructions
34
+
35
+ 1. `bundle exec rake install`
36
+ 2. `bundle exec rake release`
37
+
38
+ Reminder that deploy instructions are in the [here](https://github.com/proofgov/sharepoint_api#development).
@@ -1,5 +1,9 @@
1
+ require_relative 'sharepoint_error'
2
+
1
3
  class SharepointApi
2
4
  class FileInfo
5
+ class FileInfoError < SharepointError; end
6
+
3
7
  extend Forwardable
4
8
  attr_reader :version, :version_id, :file, :updated_at
5
9
 
@@ -31,7 +35,7 @@ class SharepointApi
31
35
  version_id,
32
36
  created_at: updated_at,
33
37
  current: true,
34
- creator_login: file.modified_by&.login_name
38
+ creator_login: safe_modified_by(file)&.login_name
35
39
  )
36
40
 
37
41
  return @all_versions unless version > 1
@@ -63,5 +67,13 @@ class SharepointApi
63
67
  **attrs
64
68
  )
65
69
  end
70
+
71
+ def safe_modified_by(file)
72
+ file.modified_by
73
+ rescue Sharepoint::SPException => e
74
+ return nil if e.message =~ /User cannot be found/
75
+
76
+ raise(FileInfoError, e.message)
77
+ end
66
78
  end
67
79
  end
@@ -1,3 +1,3 @@
1
1
  class SharepointApi
2
- VERSION = '1.0.2'.freeze
2
+ VERSION = '1.0.3'.freeze
3
3
  end
@@ -16,16 +16,16 @@ Gem::Specification.new do |spec|
16
16
  spec.metadata['source_code_uri'] = 'https://github.com/proofgov/sharepoint_api'
17
17
  spec.metadata['changelog_uri'] = 'https://github.com/proofgov/sharepoint_api/blob/master/CHANGELOG.md'
18
18
 
19
- spec.add_runtime_dependency('proof-sharepoint-ruby', '~> 1.0')
20
19
  spec.add_runtime_dependency('addressable', '~> 2.7')
20
+ spec.add_runtime_dependency('proof-sharepoint-ruby', '~> 1.0')
21
21
 
22
22
  # Specify which files should be added to the gem when it is released.
23
23
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
24
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
25
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
26
  end
27
- spec.bindir = 'exe'
28
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.bindir = 'bin'
28
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
29
29
 
30
30
  spec.require_paths = ['lib']
31
31
  end
metadata CHANGED
@@ -1,67 +1,72 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sharepoint_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kalek
8
8
  - Marlen Brunner
9
9
  - Danella Olsen
10
- autorequire:
11
- bindir: exe
10
+ autorequire:
11
+ bindir: bin
12
12
  cert_chain: []
13
- date: 2021-01-04 00:00:00.000000000 Z
13
+ date: 2021-01-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: proof-sharepoint-ruby
16
+ name: addressable
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: '1.0'
21
+ version: '2.7'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - "~>"
27
27
  - !ruby/object:Gem::Version
28
- version: '1.0'
28
+ version: '2.7'
29
29
  - !ruby/object:Gem::Dependency
30
- name: addressable
30
+ name: proof-sharepoint-ruby
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: '2.7'
35
+ version: '1.0'
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: '2.7'
42
+ version: '1.0'
43
43
  description: A tool to make it easier to talk to sharepoint (via the proof-sharepoint-ruby
44
44
  gem)
45
45
  email:
46
46
  - akalek@proofgov.com
47
47
  - mbrunner@proofgov.com
48
48
  - dolsen@proofgov.com
49
- executables: []
49
+ executables:
50
+ - console
51
+ - setup
50
52
  extensions: []
51
53
  extra_rdoc_files: []
52
54
  files:
53
55
  - ".gitignore"
56
+ - ".pryrc"
54
57
  - ".rspec"
55
58
  - ".rubocop.yml"
56
59
  - CHANGELOG.md
57
60
  - CODE_OF_CONDUCT.md
58
61
  - Gemfile
59
62
  - Gemfile.lock
63
+ - Guardfile
60
64
  - LICENSE.txt
61
65
  - README.md
62
66
  - Rakefile
63
67
  - bin/console
64
68
  - bin/setup
69
+ - docs/pull_request_template.md
65
70
  - lib/sharepoint_api.rb
66
71
  - lib/sharepoint_api/file_info.rb
67
72
  - lib/sharepoint_api/file_system.rb
@@ -80,7 +85,7 @@ metadata:
80
85
  homepage_uri: https://github.com/proofgov/sharepoint_api
81
86
  source_code_uri: https://github.com/proofgov/sharepoint_api
82
87
  changelog_uri: https://github.com/proofgov/sharepoint_api/blob/master/CHANGELOG.md
83
- post_install_message:
88
+ post_install_message:
84
89
  rdoc_options: []
85
90
  require_paths:
86
91
  - lib
@@ -95,8 +100,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
100
  - !ruby/object:Gem::Version
96
101
  version: '0'
97
102
  requirements: []
98
- rubygems_version: 3.0.3
99
- signing_key:
103
+ rubygems_version: 3.2.4
104
+ signing_key:
100
105
  specification_version: 4
101
106
  summary: SharepointApi allows you to interact with sharepoint in a simpler DSL.
102
107
  test_files: []