amazon-s3-uri 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9c9a2c5b2828e2127d2697bea35d91942c4945da
4
+ data.tar.gz: 07e6efd8616d8d14ac03dfd34b023995f25395dd
5
+ SHA512:
6
+ metadata.gz: c3462a2eb4503cbf22f6ae84ef8f2c981f4f7160b4649ab5837c6b742202e13a9959376d5bcc50a0a22ff7759dad958b9a81bdde3f82d19d0b4145f068faacfa
7
+ data.tar.gz: 684dad41eef0e2e10f5b21a7ada0fc4d85c7aa654a1c7954fafe51035fe1cc1af64d8548af9b092cb6af068cbf87aed5e851b1fe52c00114169fce06b5579bd2
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$" />
8
+ <orderEntry type="inheritedJdk" />
9
+ <orderEntry type="sourceFolder" forTests="false" />
10
+ <orderEntry type="library" scope="PROVIDED" name="minitest (v5.8.5, RVM: ruby-2.3.4) [gem]" level="application" />
11
+ <orderEntry type="library" scope="PROVIDED" name="rake (v10.4.2, RVM: ruby-2.3.4) [gem]" level="application" />
12
+ </component>
13
+ </module>
@@ -0,0 +1,6 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="Rubocop" enabled="false" level="WARNING" enabled_by_default="false" />
5
+ </profile>
6
+ </component>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="JavaScriptSettings">
4
+ <option name="languageLevel" value="ES6" />
5
+ </component>
6
+ <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.3.4" project-jdk-type="RUBY_SDK" />
7
+ </project>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/amazon-s3-uri.iml" filepath="$PROJECT_DIR$/.idea/amazon-s3-uri.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,227 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" id="ea36aaec-f772-4e73-a6cd-66bcb811bc11" name="Default" comment="">
5
+ <change beforePath="$PROJECT_DIR$/amazon-s3-uri.gemspec" beforeDir="false" afterPath="$PROJECT_DIR$/amazon-s3-uri.gemspec" afterDir="false" />
6
+ </list>
7
+ <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
8
+ <option name="TRACKING_ENABLED" value="true" />
9
+ <option name="SHOW_DIALOG" value="false" />
10
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
11
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
12
+ <option name="LAST_RESOLUTION" value="IGNORE" />
13
+ </component>
14
+ <component name="FileEditorManager">
15
+ <leaf>
16
+ <file leaf-file-name="amazon-s3-uri.gemspec" pinned="false" current-in-tab="true">
17
+ <entry file="file://$PROJECT_DIR$/amazon-s3-uri.gemspec">
18
+ <provider selected="true" editor-type-id="text-editor">
19
+ <state relative-caret-position="285">
20
+ <caret line="19" column="62" selection-start-line="19" selection-start-column="62" selection-end-line="19" selection-end-column="62" />
21
+ </state>
22
+ </provider>
23
+ </entry>
24
+ </file>
25
+ <file leaf-file-name="uri.rb" pinned="false" current-in-tab="false">
26
+ <entry file="file://$PROJECT_DIR$/lib/amazon/uri.rb">
27
+ <provider selected="true" editor-type-id="text-editor">
28
+ <state relative-caret-position="315">
29
+ <caret line="21" lean-forward="true" selection-start-line="21" selection-end-line="21" />
30
+ </state>
31
+ </provider>
32
+ </entry>
33
+ </file>
34
+ <file leaf-file-name="Gemfile" pinned="false" current-in-tab="false">
35
+ <entry file="file://$PROJECT_DIR$/Gemfile">
36
+ <provider selected="true" editor-type-id="text-editor" />
37
+ </entry>
38
+ </file>
39
+ </leaf>
40
+ </component>
41
+ <component name="FindInProjectRecents">
42
+ <findStrings>
43
+ <find>github</find>
44
+ <find>require</find>
45
+ <find>uri.</find>
46
+ </findStrings>
47
+ </component>
48
+ <component name="Git.Settings">
49
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
50
+ </component>
51
+ <component name="IdeDocumentHistory">
52
+ <option name="CHANGED_PATHS">
53
+ <list>
54
+ <option value="$PROJECT_DIR$/lib/amazon/s3/uri.rb" />
55
+ <option value="$PROJECT_DIR$/lib/amazon-s3-uri/uri.rb" />
56
+ <option value="$PROJECT_DIR$/lib/amazon/uri.rb" />
57
+ <option value="$PROJECT_DIR$/amazon-s3-uri.gemspec" />
58
+ </list>
59
+ </option>
60
+ </component>
61
+ <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
62
+ <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
63
+ <component name="JsGulpfileManager">
64
+ <detection-done>true</detection-done>
65
+ <sorting>DEFINITION_ORDER</sorting>
66
+ </component>
67
+ <component name="ProjectFrameBounds" extendedState="6">
68
+ <option name="y" value="23" />
69
+ <option name="width" value="929" />
70
+ <option name="height" value="803" />
71
+ </component>
72
+ <component name="ProjectView">
73
+ <navigator proportions="" version="1">
74
+ <foldersAlwaysOnTop value="true" />
75
+ </navigator>
76
+ <panes>
77
+ <pane id="Scope" />
78
+ <pane id="ProjectPane">
79
+ <subPane>
80
+ <expand>
81
+ <path>
82
+ <item name="amazon-s3-uri" type="b2602c69:ProjectViewProjectNode" />
83
+ <item name="amazon-s3-uri" type="462c0819:PsiDirectoryNode" />
84
+ </path>
85
+ <path>
86
+ <item name="amazon-s3-uri" type="b2602c69:ProjectViewProjectNode" />
87
+ <item name="amazon-s3-uri" type="462c0819:PsiDirectoryNode" />
88
+ <item name="lib" type="462c0819:PsiDirectoryNode" />
89
+ </path>
90
+ <path>
91
+ <item name="amazon-s3-uri" type="b2602c69:ProjectViewProjectNode" />
92
+ <item name="amazon-s3-uri" type="462c0819:PsiDirectoryNode" />
93
+ <item name="lib" type="462c0819:PsiDirectoryNode" />
94
+ <item name="amazon" type="462c0819:PsiDirectoryNode" />
95
+ </path>
96
+ <path>
97
+ <item name="amazon-s3-uri" type="b2602c69:ProjectViewProjectNode" />
98
+ <item name="amazon-s3-uri" type="462c0819:PsiDirectoryNode" />
99
+ <item name="lib" type="462c0819:PsiDirectoryNode" />
100
+ <item name="amazon" type="462c0819:PsiDirectoryNode" />
101
+ <item name="s3" type="462c0819:PsiDirectoryNode" />
102
+ </path>
103
+ </expand>
104
+ <select />
105
+ </subPane>
106
+ </pane>
107
+ </panes>
108
+ </component>
109
+ <component name="PropertiesComponent">
110
+ <property name="WebServerToolWindowFactoryState" value="false" />
111
+ <property name="last_opened_file_path" value="$PROJECT_DIR$" />
112
+ <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
113
+ <property name="nodejs_npm_path_reset_for_default_project" value="true" />
114
+ </component>
115
+ <component name="RunDashboard">
116
+ <option name="ruleStates">
117
+ <list>
118
+ <RuleState>
119
+ <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
120
+ </RuleState>
121
+ <RuleState>
122
+ <option name="name" value="StatusDashboardGroupingRule" />
123
+ </RuleState>
124
+ </list>
125
+ </option>
126
+ </component>
127
+ <component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" />
128
+ <component name="SvnConfiguration">
129
+ <configuration />
130
+ </component>
131
+ <component name="TaskManager">
132
+ <task active="true" id="Default" summary="Default task">
133
+ <changelist id="ea36aaec-f772-4e73-a6cd-66bcb811bc11" name="Default" comment="" />
134
+ <created>1524226410947</created>
135
+ <option name="number" value="Default" />
136
+ <option name="presentableId" value="Default" />
137
+ <updated>1524226410947</updated>
138
+ <workItem from="1524226412848" duration="1969000" />
139
+ </task>
140
+ <servers />
141
+ </component>
142
+ <component name="TimeTrackingManager">
143
+ <option name="totallyTimeSpent" value="1969000" />
144
+ </component>
145
+ <component name="ToolWindowManager">
146
+ <frame x="0" y="23" width="1440" height="803" extended-state="6" />
147
+ <editor active="true" />
148
+ <layout>
149
+ <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.15808298" />
150
+ <window_info anchor="bottom" id="TODO" order="6" />
151
+ <window_info anchor="bottom" id="Docker" show_stripe_button="false" />
152
+ <window_info anchor="bottom" id="Event Log" side_tool="true" />
153
+ <window_info anchor="right" id="Database" />
154
+ <window_info anchor="bottom" id="Database Changes" show_stripe_button="false" />
155
+ <window_info anchor="bottom" id="Run" order="2" />
156
+ <window_info anchor="bottom" id="Version Control" />
157
+ <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
158
+ <window_info active="true" anchor="bottom" id="Terminal" visible="true" weight="0.3286119" />
159
+ <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
160
+ <window_info id="Favorites" side_tool="true" />
161
+ <window_info anchor="bottom" id="Find" order="1" />
162
+ <window_info anchor="right" id="Commander" order="0" weight="0.4" />
163
+ <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
164
+ <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
165
+ <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
166
+ <window_info anchor="bottom" id="Message" order="0" />
167
+ <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
168
+ </layout>
169
+ </component>
170
+ <component name="TypeScriptGeneratedFilesManager">
171
+ <option name="version" value="1" />
172
+ </component>
173
+ <component name="VcsContentAnnotationSettings">
174
+ <option name="myLimit" value="2678400000" />
175
+ </component>
176
+ <component name="editorHistoryManager">
177
+ <entry file="file://$PROJECT_DIR$/lib/amazon/s3/uri/version.rb">
178
+ <provider selected="true" editor-type-id="text-editor" />
179
+ </entry>
180
+ <entry file="file://$PROJECT_DIR$/CODE_OF_CONDUCT.md">
181
+ <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
182
+ <state split_layout="SPLIT">
183
+ <first_editor />
184
+ <second_editor />
185
+ </state>
186
+ </provider>
187
+ </entry>
188
+ <entry file="file://$PROJECT_DIR$/lib/amazon/s3/uri.rb">
189
+ <provider selected="true" editor-type-id="text-editor">
190
+ <state relative-caret-position="75">
191
+ <caret line="5" lean-forward="true" selection-start-line="5" selection-end-line="5" />
192
+ </state>
193
+ </provider>
194
+ </entry>
195
+ <entry file="file://$PROJECT_DIR$/Gemfile">
196
+ <provider selected="true" editor-type-id="text-editor" />
197
+ </entry>
198
+ <entry file="file://$PROJECT_DIR$/lib/amazon-s3-uri/uri.rb">
199
+ <provider selected="true" editor-type-id="text-editor">
200
+ <state relative-caret-position="210">
201
+ <caret line="14" lean-forward="true" selection-start-line="14" selection-end-line="14" />
202
+ </state>
203
+ </provider>
204
+ </entry>
205
+ <entry file="file://$PROJECT_DIR$/lib/amazon-s3-uri/s3/uri/version.rb">
206
+ <provider selected="true" editor-type-id="text-editor">
207
+ <state relative-caret-position="45">
208
+ <caret line="3" column="23" lean-forward="true" selection-start-line="3" selection-start-column="23" selection-end-line="3" selection-end-column="23" />
209
+ </state>
210
+ </provider>
211
+ </entry>
212
+ <entry file="file://$PROJECT_DIR$/lib/amazon/uri.rb">
213
+ <provider selected="true" editor-type-id="text-editor">
214
+ <state relative-caret-position="315">
215
+ <caret line="21" lean-forward="true" selection-start-line="21" selection-end-line="21" />
216
+ </state>
217
+ </provider>
218
+ </entry>
219
+ <entry file="file://$PROJECT_DIR$/amazon-s3-uri.gemspec">
220
+ <provider selected="true" editor-type-id="text-editor">
221
+ <state relative-caret-position="285">
222
+ <caret line="19" column="62" selection-start-line="19" selection-start-column="62" selection-end-line="19" selection-end-column="62" />
223
+ </state>
224
+ </provider>
225
+ </entry>
226
+ </component>
227
+ </project>
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.1
5
+ before_install: gem install bundler -v 1.16.1
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at mustafah.elbanna@me.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in amazon-s3-uri.gemspec
6
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Mustafah
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,43 @@
1
+ # Amazon::S3::Uri
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/amazon/s3/uri`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'amazon-s3-uri'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install amazon-s3-uri
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ 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).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/amazon-s3-uri. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the Amazon::S3::Uri project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/amazon-s3-uri/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1,36 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "amazon/s3/uri/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "amazon-s3-uri"
8
+ spec.version = Amazon::S3::Uri::VERSION
9
+ spec.authors = ["Mustafah"]
10
+ spec.email = ["mustafah.elbanna@me.com"]
11
+
12
+ spec.summary = "Helps parse a s3 URL"
13
+ spec.description = ""
14
+ spec.homepage = ""
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against " \
23
+ "public gem pushes."
24
+ end
25
+
26
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{^(test|spec|features)/})
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ spec.add_development_dependency "bundler", "~> 1.16"
34
+ spec.add_development_dependency "rake", "~> 10.0"
35
+ spec.add_development_dependency "minitest", "~> 5.0"
36
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "amazon/s3/uri"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,7 @@
1
+ module Amazon
2
+ module S3
3
+ module Uri
4
+ VERSION = "0.1.0"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,74 @@
1
+ require "amazon/s3/uri/version"
2
+ require 'uri'
3
+
4
+ module Amazon
5
+ module S3
6
+ module Uri
7
+ class AmazonS3URI
8
+ ENDPOINT_PATTERN = /^(.+\.)?s3[.-]([a-z0-9-]+)\./
9
+ attr_reader :uri, :bucket, :key, :region
10
+ def initialize(url)
11
+ if url.nil?
12
+ raise ArgumentError.new("url cannot be null")
13
+ end
14
+ @uri = URI(url)
15
+
16
+ @host = @uri.host
17
+ if @host.nil?
18
+ raise ArgumentError.new("Invalid S3 URI: no hostname: " + url)
19
+ end
20
+
21
+ matches = ENDPOINT_PATTERN.match(@host)
22
+
23
+ prefix = matches[1]
24
+
25
+ if prefix.nil? || prefix.empty?
26
+ # No bucket name in the authority; parse it from the path.
27
+ @isPathStyle = true
28
+ path = uri.path
29
+ if (path == '/')
30
+ @bucket = nil
31
+ @key = nil
32
+ else
33
+ # path genearlly in style of `/sample-bucket/temp/8746ee3e-4089-11e8-9a0b-f3d94c494e17.somaya.jpg`
34
+ index = path.index('/', 1)
35
+ if index.nil?
36
+ # path if equals /sample-bucket
37
+ # puts path
38
+ @bucket = path[1 .. -1]
39
+ @key = nil
40
+ elsif index == path.length - 1
41
+ # path if equals /sample-bucket/
42
+ @bucket = path[1 ... index]
43
+ @key = nil
44
+ else
45
+ # path if equals `/sample-bucket/temp/8746ee3e-4089-11e8-9a0b-f3d94c494e17.somaya.jpg`
46
+ @bucket = path[1 ... index]
47
+ @key = path[index + 1 .. -1]
48
+ end
49
+ end
50
+ else
51
+ @isPathStyle = false
52
+
53
+ # Remove the trailing '.' from the prefix to get the bucket.
54
+ @bucket = prefix[0 ... -1]
55
+ path = uri.path
56
+ if path.nil? || path.empty? || path == '/'
57
+ @key = nil
58
+ else
59
+ # Remove the leading '/'
60
+ @key = path[ 1 .. -1]
61
+ end
62
+ end
63
+
64
+ if matches[2] == 'amazonaws'
65
+ # No region specified
66
+ @region = nil
67
+ else
68
+ @region = matches[2]
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: amazon-s3-uri
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Mustafah
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-04-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
55
+ description: ''
56
+ email:
57
+ - mustafah.elbanna@me.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".idea/.rakeTasks"
64
+ - ".idea/amazon-s3-uri.iml"
65
+ - ".idea/inspectionProfiles/Project_Default.xml"
66
+ - ".idea/misc.xml"
67
+ - ".idea/modules.xml"
68
+ - ".idea/vcs.xml"
69
+ - ".idea/workspace.xml"
70
+ - ".travis.yml"
71
+ - CODE_OF_CONDUCT.md
72
+ - Gemfile
73
+ - LICENSE.txt
74
+ - README.md
75
+ - Rakefile
76
+ - amazon-s3-uri.gemspec
77
+ - bin/console
78
+ - bin/setup
79
+ - lib/amazon/s3/uri/version.rb
80
+ - lib/amazon/uri.rb
81
+ homepage: ''
82
+ licenses:
83
+ - MIT
84
+ metadata:
85
+ allowed_push_host: https://rubygems.org
86
+ post_install_message:
87
+ rdoc_options: []
88
+ require_paths:
89
+ - lib
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ requirements: []
101
+ rubyforge_project:
102
+ rubygems_version: 2.6.13
103
+ signing_key:
104
+ specification_version: 4
105
+ summary: Helps parse a s3 URL
106
+ test_files: []