chom 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rubocop.yml +273 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +42 -0
- data/Rakefile +10 -0
- data/bin/console +7 -0
- data/bin/setup +9 -0
- data/chom.gemspec +26 -0
- data/exe/chom +3 -0
- data/lib/chom.rb +55 -0
- data/lib/chom/version.rb +5 -0
- metadata +130 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c1cc091de534a70bdd5eec5eea81e56f7ed37130
|
4
|
+
data.tar.gz: 18eedf9fb794f0e00aa196bfe83936f2d806e55f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cefec073222ac44f00a0d3cb9266b71cc8927b49f2ecca0b23c97a347e08b5d8a6f928a5cc5d22685a6a2926cc382c2bbcc6fbe1a1ff4f02a1eee93daf23f929
|
7
|
+
data.tar.gz: 414adf10d66c140db8462baf4ce8e909ed5cca3163ac1c9c2204b158a583e19120e3bd7109edacd566d2933f84b3b86fabb8fd3a1497546a0991c04354d5e68c
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,273 @@
|
|
1
|
+
require: rubocop-rspec
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
TargetRubyVersion: 2.3
|
5
|
+
DisplayCopNames: true
|
6
|
+
|
7
|
+
Rails:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
# Lint/AmbiguousOperator:
|
11
|
+
# Lint/AmbiguousRegexpLiteral:
|
12
|
+
# Lint/AssignmentInCondition:
|
13
|
+
# Lint/BlockAlignment:
|
14
|
+
# Lint/CircularArgumentReference:
|
15
|
+
# Lint/ConditionPosition:
|
16
|
+
# Lint/Debugger:
|
17
|
+
# Lint/DefEndAlignment:
|
18
|
+
# Lint/DeprecatedClassMethods:
|
19
|
+
# Lint/DuplicatedKey:
|
20
|
+
# Lint/DuplicateMethods:
|
21
|
+
# Lint/EachWithObjectArgument:
|
22
|
+
# Lint/ElseLayout:
|
23
|
+
# Lint/EmptyEnsure:
|
24
|
+
# Lint/EmptyInterpolation:
|
25
|
+
# Lint/EndAlignment:
|
26
|
+
# Lint/EndInMethod:
|
27
|
+
# Lint/EnsureReturn:
|
28
|
+
# Lint/Eval:
|
29
|
+
# Lint/FloatOutOfRange:
|
30
|
+
# Lint/FormatParameterMismatch:
|
31
|
+
# Lint/HandleExceptions:
|
32
|
+
# Lint/ImplicitStringConcatenation:
|
33
|
+
# Lint/IneffectiveAccessModifier:
|
34
|
+
# Lint/InvalidCharacterLiteral:
|
35
|
+
# Lint/LiteralInCondition:
|
36
|
+
# Lint/LiteralInInterpolation:
|
37
|
+
# Lint/Loop:
|
38
|
+
# Lint/NestedMethodDefinition:
|
39
|
+
# Lint/NextWithoutAccumulator:
|
40
|
+
# Lint/ParenthesesAsGroupedExpression:
|
41
|
+
# Lint/RandOne:
|
42
|
+
# Lint/RequireParentheses:
|
43
|
+
# Lint/RescueException:
|
44
|
+
# Lint/ShadowingOuterLocalVariable:
|
45
|
+
# Lint/StringConversionInInterpolation:
|
46
|
+
# Lint/UnderscorePrefixedVariableName:
|
47
|
+
# Lint/UnneededDisable:
|
48
|
+
# Lint/UnreachableCode:
|
49
|
+
# Lint/UnusedBlockArgument:
|
50
|
+
# Lint/UnusedMethodArgument:
|
51
|
+
# Lint/UselessAccessModifier:
|
52
|
+
# Lint/UselessAssignment:
|
53
|
+
# Lint/UselessComparison:
|
54
|
+
# Lint/UselessElseWithoutRescue:
|
55
|
+
# Lint/UselessSetterCall:
|
56
|
+
# Lint/Void:
|
57
|
+
# Metrics/AbcSize:
|
58
|
+
# Metrics/BlockNesting:
|
59
|
+
# Metrics/ClassLength:
|
60
|
+
# Metrics/CyclomaticComplexity:
|
61
|
+
Metrics/LineLength:
|
62
|
+
Enabled: true
|
63
|
+
Max: 120
|
64
|
+
Metrics/MethodLength:
|
65
|
+
Enabled: true
|
66
|
+
Max: 12
|
67
|
+
# Metrics/ModuleLength:
|
68
|
+
# Metrics/ParameterLists:
|
69
|
+
# Metrics/PerceivedComplexity:
|
70
|
+
# Performance/Casecmp:
|
71
|
+
# Performance/DoubleStartEndWith:
|
72
|
+
# Performance/EndWith:
|
73
|
+
# Performance/LstripRstrip:
|
74
|
+
# Performance/RangeInclude:
|
75
|
+
# Performance/RedundantBlockCall:
|
76
|
+
# Performance/RedundantMatch:
|
77
|
+
# Performance/RedundantMerge:
|
78
|
+
# Performance/RedundantSortBy:
|
79
|
+
# Performance/StartWith:
|
80
|
+
# Performance/StringReplacement:
|
81
|
+
# Performance/TimesMap:
|
82
|
+
# Rails/ActionFilter:
|
83
|
+
# Rails/Date:
|
84
|
+
# Rails/Delegate:
|
85
|
+
# Rails/FindBy:
|
86
|
+
# Rails/FindEach:
|
87
|
+
# Rails/HasAndBelongsToMany:
|
88
|
+
# Rails/Output:
|
89
|
+
# Rails/PluralizationGrammar:
|
90
|
+
# Rails/ReadWriteAttribute:
|
91
|
+
# Rails/ScopeArgs:
|
92
|
+
# Rails/TimeZone:
|
93
|
+
# Rails/UniqBeforePluck:
|
94
|
+
# Rails/Validation:
|
95
|
+
# RSpec/AnyInstance:
|
96
|
+
# RSpec/DescribeClass:
|
97
|
+
# RSpec/DescribedClass:
|
98
|
+
# RSpec/DescribeMethod:
|
99
|
+
# RSpec/ExampleLength:
|
100
|
+
# RSpec/ExampleWording:
|
101
|
+
# RSpec/FilePath:
|
102
|
+
# RSpec/Focus:
|
103
|
+
# RSpec/InstanceVariable:
|
104
|
+
# RSpec/MultipleDescribes:
|
105
|
+
# RSpec/NotToNot:
|
106
|
+
# RSpec/VerifiedDoubles:
|
107
|
+
# Style/AccessModifierIndentation:
|
108
|
+
# Style/AccessorMethodName:
|
109
|
+
# Style/Alias:
|
110
|
+
# Style/AlignArray:
|
111
|
+
# Style/AlignHash:
|
112
|
+
# Style/AlignParameters:
|
113
|
+
# Style/AndOr:
|
114
|
+
# Style/ArrayJoin:
|
115
|
+
# Style/AsciiComments:
|
116
|
+
# Style/AsciiIdentifiers:
|
117
|
+
# Style/Attr:
|
118
|
+
# Style/BarePercentLiterals:
|
119
|
+
# Style/BeginBlock:
|
120
|
+
# Style/BlockComments:
|
121
|
+
# Style/BlockDelimiters:
|
122
|
+
# Style/BlockEndNewline:
|
123
|
+
# Style/BracesAroundHashParameters:
|
124
|
+
# Style/CaseEquality:
|
125
|
+
# Style/CaseIndentation:
|
126
|
+
# Style/CharacterLiteral:
|
127
|
+
# Style/ClassAndModuleCamelCase:
|
128
|
+
# Style/ClassAndModuleChildren:
|
129
|
+
# Style/ClassCheck:
|
130
|
+
# Style/ClassMethods:
|
131
|
+
# Style/ClassVars:
|
132
|
+
# Style/ColonMethodCall:
|
133
|
+
# Style/CommentAnnotation:
|
134
|
+
# Style/CommentIndentation:
|
135
|
+
# Style/ConditionalAssignment:
|
136
|
+
# Style/ConstantName:
|
137
|
+
# Style/DefWithParentheses:
|
138
|
+
# Style/DeprecatedHashMethods:
|
139
|
+
Style/Documentation:
|
140
|
+
Enabled: false
|
141
|
+
# Style/DotPosition:
|
142
|
+
# Style/DoubleNegation:
|
143
|
+
# Style/EachWithObject:
|
144
|
+
# Style/ElseAlignment:
|
145
|
+
# Style/EmptyElse:
|
146
|
+
# Style/EmptyLineBetweenDefs:
|
147
|
+
# Style/EmptyLines:
|
148
|
+
# Style/EmptyLinesAroundAccessModifier:
|
149
|
+
# Style/EmptyLinesAroundBlockBody:
|
150
|
+
# Style/EmptyLinesAroundClassBody:
|
151
|
+
# Style/EmptyLinesAroundMethodBody:
|
152
|
+
# Style/EmptyLinesAroundModuleBody:
|
153
|
+
# Style/EmptyLiteral:
|
154
|
+
# Style/EndBlock:
|
155
|
+
# Style/EndOfLine:
|
156
|
+
# Style/EvenOdd:
|
157
|
+
# Style/ExtraSpacing:
|
158
|
+
# Style/FileName:
|
159
|
+
# Style/FirstMethodParameterLineBreak:
|
160
|
+
# Style/FlipFlop:
|
161
|
+
# Style/For:
|
162
|
+
# Style/FormatString:
|
163
|
+
Style/FrozenStringLiteralComment:
|
164
|
+
Enabled: false
|
165
|
+
# Style/GlobalVars:
|
166
|
+
# Style/GuardClause:
|
167
|
+
# Style/HashSyntax:
|
168
|
+
# Style/IdenticalConditionalBranches:
|
169
|
+
# Style/IfInsideElse:
|
170
|
+
# Style/IfUnlessModifier:
|
171
|
+
# Style/IfWithSemicolon:
|
172
|
+
# Style/IndentArray:
|
173
|
+
# Style/IndentAssignment:
|
174
|
+
# Style/IndentationConsistency:
|
175
|
+
# Style/IndentationWidth:
|
176
|
+
# Style/IndentHash:
|
177
|
+
# Style/InfiniteLoop:
|
178
|
+
# Style/Lambda:
|
179
|
+
# Style/LambdaCall:
|
180
|
+
# Style/LeadingCommentSpace:
|
181
|
+
# Style/LineEndConcatenation:
|
182
|
+
# Style/MethodCallParentheses:
|
183
|
+
# Style/MethodDefParentheses:
|
184
|
+
# Style/MethodName:
|
185
|
+
# Style/ModuleFunction:
|
186
|
+
# Style/MultilineArrayBraceLayout:
|
187
|
+
# Style/MultilineBlockChain:
|
188
|
+
# Style/MultilineBlockLayout:
|
189
|
+
# Style/MultilineHashBraceLayout:
|
190
|
+
# Style/MultilineIfThen:
|
191
|
+
# Style/MultilineMethodCallBraceLayout:
|
192
|
+
# Style/MultilineMethodCallIndentation:
|
193
|
+
# Style/MultilineMethodDefinitionBraceLayout:
|
194
|
+
# Style/MultilineOperationIndentation:
|
195
|
+
# Style/MultilineTernaryOperator:
|
196
|
+
# Style/MutableConstant:
|
197
|
+
# Style/NegatedIf:
|
198
|
+
# Style/NegatedWhile:
|
199
|
+
# Style/NestedModifier:
|
200
|
+
# Style/NestedParenthesizedCalls:
|
201
|
+
# Style/NestedTernaryOperator:
|
202
|
+
# Style/Next:
|
203
|
+
# Style/NilComparison:
|
204
|
+
# Style/NonNilCheck:
|
205
|
+
# Style/Not:
|
206
|
+
# Style/NumericLiterals:
|
207
|
+
# Style/OneLineConditional:
|
208
|
+
# Style/OpMethod:
|
209
|
+
# Style/ParallelAssignment:
|
210
|
+
# Style/ParenthesesAroundCondition:
|
211
|
+
# Style/PercentLiteralDelimiters:
|
212
|
+
# Style/PercentQLiterals:
|
213
|
+
# Style/PerlBackrefs:
|
214
|
+
# Style/PredicateName:
|
215
|
+
# Style/Proc:
|
216
|
+
# Style/RaiseArgs:
|
217
|
+
# Style/RedundantBegin:
|
218
|
+
# Style/RedundantException:
|
219
|
+
# Style/RedundantFreeze:
|
220
|
+
# Style/RedundantParentheses:
|
221
|
+
# Style/RedundantReturn:
|
222
|
+
# Style/RedundantSelf:
|
223
|
+
# Style/RegexpLiteral:
|
224
|
+
# Style/RescueModifier:
|
225
|
+
# Style/SelfAssignment:
|
226
|
+
# Style/Semicolon:
|
227
|
+
# Style/SignalException:
|
228
|
+
# Style/SingleLineBlockParams:
|
229
|
+
# Style/SingleLineMethods:
|
230
|
+
# Style/SpaceAfterColon:
|
231
|
+
# Style/SpaceAfterComma:
|
232
|
+
# Style/SpaceAfterMethodName:
|
233
|
+
# Style/SpaceAfterNot:
|
234
|
+
# Style/SpaceAfterSemicolon:
|
235
|
+
# Style/SpaceAroundEqualsInParameterDefault:
|
236
|
+
# Style/SpaceAroundKeyword:
|
237
|
+
# Style/SpaceAroundOperators:
|
238
|
+
# Style/SpaceBeforeBlockBraces:
|
239
|
+
# Style/SpaceBeforeComma:
|
240
|
+
# Style/SpaceBeforeComment:
|
241
|
+
# Style/SpaceBeforeFirstArg:
|
242
|
+
# Style/SpaceBeforeSemicolon:
|
243
|
+
# Style/SpaceInsideBlockBraces:
|
244
|
+
# Style/SpaceInsideBrackets:
|
245
|
+
# Style/SpaceInsideHashLiteralBraces:
|
246
|
+
# Style/SpaceInsideParens:
|
247
|
+
# Style/SpaceInsideRangeLiteral:
|
248
|
+
# Style/SpaceInsideStringInterpolation:
|
249
|
+
# Style/SpecialGlobalVars:
|
250
|
+
# Style/StabbyLambdaParentheses:
|
251
|
+
# Style/StringLiterals:
|
252
|
+
# Style/StringLiteralsInInterpolation:
|
253
|
+
# Style/StringMethods:
|
254
|
+
# Style/SymbolArray:
|
255
|
+
# Style/SymbolProc:
|
256
|
+
# Style/Tab:
|
257
|
+
# Style/TrailingBlankLines:
|
258
|
+
# Style/TrailingCommaInArguments:
|
259
|
+
# Style/TrailingCommaInLiteral:
|
260
|
+
# Style/TrailingUnderscoreVariable:
|
261
|
+
# Style/TrailingWhitespace:
|
262
|
+
# Style/TrivialAccessors:
|
263
|
+
# Style/UnlessElse:
|
264
|
+
# Style/UnneededCapitalW:
|
265
|
+
# Style/UnneededInterpolation:
|
266
|
+
# Style/UnneededPercentQ:
|
267
|
+
# Style/VariableInterpolation:
|
268
|
+
# Style/VariableName:
|
269
|
+
# Style/WhenThen:
|
270
|
+
# Style/WhileUntilDo:
|
271
|
+
# Style/WhileUntilModifier:
|
272
|
+
# Style/WordArray:
|
273
|
+
# Style/ZeroLengthPredicate:
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at sean@smallcity.ca. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Sean Lerner
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# Chom
|
2
|
+
|
3
|
+
Chom is a command line utility that alters the permissions of your current directory and its subdirectories to work properly with your
|
4
|
+
web server.
|
5
|
+
|
6
|
+
Specificaly, it executes:
|
7
|
+
|
8
|
+
$ chown -R g+w .
|
9
|
+
$ chmod -R <username>:www .
|
10
|
+
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Install it from the command line:
|
15
|
+
|
16
|
+
$ gem install chom
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
|
20
|
+
From the command line, go into the directory you'd like to alter the permissions of, and execute:
|
21
|
+
|
22
|
+
$ chom
|
23
|
+
|
24
|
+
If permissions weren't able to be altered properly, chom will exit and suggest you attempt with sudo:
|
25
|
+
|
26
|
+
$ sudo chom
|
27
|
+
|
28
|
+
## Development
|
29
|
+
|
30
|
+
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.
|
31
|
+
|
32
|
+
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).
|
33
|
+
|
34
|
+
## Contributing
|
35
|
+
|
36
|
+
Bug reports and pull requests are welcome on GitLab at https://gitlab.com/seanlerner/chom. 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.
|
37
|
+
|
38
|
+
|
39
|
+
## License
|
40
|
+
|
41
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
42
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
data/bin/setup
ADDED
data/chom.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'chom/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'chom'
|
8
|
+
spec.version = Chom::VERSION
|
9
|
+
spec.authors = ['Sean Lerner']
|
10
|
+
spec.email = ['sean@smallcity.ca']
|
11
|
+
|
12
|
+
spec.summary = 'Utility to chown and chmod a folder recursive so web app has write access to folder.'
|
13
|
+
spec.homepage = 'https://gitlab.com/seanlerner/chom'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = 'exe'
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.12'
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
23
|
+
spec.add_development_dependency 'minitest', '~> 5.0'
|
24
|
+
spec.add_development_dependency 'pry', '~> 0.10'
|
25
|
+
spec.add_development_dependency 'yard', '~> 0.8'
|
26
|
+
end
|
data/exe/chom
ADDED
data/lib/chom.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'chom/version'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
# Chom is a command line utility that alters the permissions of your current directory and its subdirectories to work
|
5
|
+
# properly with your web server.
|
6
|
+
#
|
7
|
+
# Specificaly, it executes:
|
8
|
+
# $ chown -R g+w .
|
9
|
+
# $ chmod -R <username>:www .
|
10
|
+
|
11
|
+
module Chom
|
12
|
+
# The App class stores Chom's functionality. It is executed with Chom::App.new.run.
|
13
|
+
class App
|
14
|
+
attr_reader :user
|
15
|
+
|
16
|
+
# Creates Chom instance and assigns logged in user's username to @user.
|
17
|
+
def initialize
|
18
|
+
@user = Etc.getlogin
|
19
|
+
end
|
20
|
+
|
21
|
+
# Chom command line utility executes run to recursively chown and chmod the current directory.
|
22
|
+
def run
|
23
|
+
chown_dir_and_files_recursively
|
24
|
+
chmod_dir_and_files_recursively
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
# Recursively changes ownership of current directory to the logged in user with the group www.
|
30
|
+
def chown_dir_and_files_recursively
|
31
|
+
print "Attempting 'chown -R g+w .' as '#{@user}'... "
|
32
|
+
FileUtils.chmod_R 'g+w', '.'
|
33
|
+
puts 'Success!'
|
34
|
+
rescue Errno::EPERM
|
35
|
+
puts 'Failed.'
|
36
|
+
suggest_running_as_sudo_and_exit
|
37
|
+
end
|
38
|
+
|
39
|
+
# Recursively changes permissions of current directory to be group writable.
|
40
|
+
def chmod_dir_and_files_recursively
|
41
|
+
print "Attempting 'chmod -R #{@user}:www' as '#{@user}'... "
|
42
|
+
FileUtils.chown_R @user, 'www', '.'
|
43
|
+
puts 'Success!'
|
44
|
+
rescue Errno::EPERM
|
45
|
+
puts 'Failed.'
|
46
|
+
suggest_running_as_sudo_and_exit
|
47
|
+
end
|
48
|
+
|
49
|
+
# Suggests running chom using sudo if regular execution fails due to lack of rights.
|
50
|
+
def suggest_running_as_sudo_and_exit
|
51
|
+
puts "Try running with 'sudo chom'."
|
52
|
+
exit false
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/chom/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: chom
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sean Lerner
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-06-19 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.12'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.12'
|
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
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.10'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.10'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: yard
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.8'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.8'
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- sean@smallcity.ca
|
86
|
+
executables:
|
87
|
+
- chom
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- ".rubocop.yml"
|
93
|
+
- CODE_OF_CONDUCT.md
|
94
|
+
- Gemfile
|
95
|
+
- LICENSE.txt
|
96
|
+
- README.md
|
97
|
+
- Rakefile
|
98
|
+
- bin/console
|
99
|
+
- bin/setup
|
100
|
+
- chom.gemspec
|
101
|
+
- exe/chom
|
102
|
+
- lib/chom.rb
|
103
|
+
- lib/chom/version.rb
|
104
|
+
homepage: https://gitlab.com/seanlerner/chom
|
105
|
+
licenses:
|
106
|
+
- MIT
|
107
|
+
metadata: {}
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options: []
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
requirements: []
|
123
|
+
rubyforge_project:
|
124
|
+
rubygems_version: 2.5.1
|
125
|
+
signing_key:
|
126
|
+
specification_version: 4
|
127
|
+
summary: Utility to chown and chmod a folder recursive so web app has write access
|
128
|
+
to folder.
|
129
|
+
test_files: []
|
130
|
+
has_rdoc:
|