crumple 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6aacc371b1cfa5aa8c1ef9ecd60d0b64cb91c8cd
4
+ data.tar.gz: 7ffe38f12233ab4eb53a7fa55c097bcbd8267015
5
+ SHA512:
6
+ metadata.gz: 4b28f0cee85c140823ac6b0d38de605cb74cbd577b688503e73726cdbeec731f7a503d119a185158f1dd6b37ab0c9e63f0864d636fe9962c25e2660d76a25674
7
+ data.tar.gz: fed9d20a363c1a5771aca2caf5328a58dfabb55e31fbb596d96d9d5eb44ed34910c6026b88b132a73389852a7e3a397ed70e433da9c0eebdf8cc8c2c78ae6ac2
@@ -0,0 +1 @@
1
+ repo_token: FO1CsufG0eQlntsMCtF62k28QeAAqAwIL
@@ -0,0 +1 @@
1
+ /Users/matthewohara/challenges/dump/
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,278 @@
1
+ AllCops:
2
+ Exclude:
3
+ - db/schema.rb
4
+ #DisplayCopNames: true
5
+
6
+ AccessorMethodName:
7
+ Enabled: false
8
+
9
+ ActionFilter:
10
+ Enabled: false
11
+
12
+ Alias:
13
+ Enabled: false
14
+
15
+ ArrayJoin:
16
+ Enabled: false
17
+
18
+ AsciiComments:
19
+ Enabled: false
20
+
21
+ AsciiIdentifiers:
22
+ Enabled: false
23
+
24
+ Attr:
25
+ Enabled: false
26
+
27
+ BlockNesting:
28
+ Enabled: false
29
+
30
+ CaseEquality:
31
+ Enabled: false
32
+
33
+ CharacterLiteral:
34
+ Enabled: false
35
+
36
+ ClassAndModuleChildren:
37
+ Enabled: false
38
+
39
+ ClassLength:
40
+ Enabled: false
41
+
42
+ ClassVars:
43
+ Enabled: false
44
+
45
+ CollectionMethods:
46
+ PreferredMethods:
47
+ find: detect
48
+ reduce: inject
49
+ collect: map
50
+ find_all: select
51
+
52
+ ColonMethodCall:
53
+ Enabled: false
54
+
55
+ CommentAnnotation:
56
+ Enabled: false
57
+
58
+ CyclomaticComplexity:
59
+ Enabled: false
60
+
61
+ Delegate:
62
+ Enabled: false
63
+
64
+ DeprecatedHashMethods:
65
+ Enabled: false
66
+
67
+ Documentation:
68
+ Enabled: false
69
+
70
+ DotPosition:
71
+ EnforcedStyle: trailing
72
+
73
+ DoubleNegation:
74
+ Enabled: false
75
+
76
+ EachWithObject:
77
+ Enabled: false
78
+
79
+ EmptyLiteral:
80
+ Enabled: false
81
+
82
+ Encoding:
83
+ Enabled: false
84
+
85
+ EvenOdd:
86
+ Enabled: false
87
+
88
+ FileName:
89
+ Enabled: false
90
+
91
+ FlipFlop:
92
+ Enabled: false
93
+
94
+ FormatString:
95
+ Enabled: false
96
+
97
+ GlobalVars:
98
+ Enabled: false
99
+
100
+ GuardClause:
101
+ Enabled: false
102
+
103
+ IfUnlessModifier:
104
+ Enabled: false
105
+
106
+ IfWithSemicolon:
107
+ Enabled: false
108
+
109
+ InlineComment:
110
+ Enabled: false
111
+
112
+ Lambda:
113
+ Enabled: false
114
+
115
+ LambdaCall:
116
+ Enabled: false
117
+
118
+ LineEndConcatenation:
119
+ Enabled: false
120
+
121
+ LineLength:
122
+ Max: 80
123
+
124
+ MethodLength:
125
+ Enabled: false
126
+
127
+ ModuleFunction:
128
+ Enabled: false
129
+
130
+ NegatedIf:
131
+ Enabled: false
132
+
133
+ NegatedWhile:
134
+ Enabled: false
135
+
136
+ Next:
137
+ Enabled: false
138
+
139
+ NilComparison:
140
+ Enabled: false
141
+
142
+ Not:
143
+ Enabled: false
144
+
145
+ NumericLiterals:
146
+ Enabled: false
147
+
148
+ OneLineConditional:
149
+ Enabled: false
150
+
151
+ OpMethod:
152
+ Enabled: false
153
+
154
+ ParameterLists:
155
+ Enabled: false
156
+
157
+ PercentLiteralDelimiters:
158
+ Enabled: false
159
+
160
+ PerlBackrefs:
161
+ Enabled: false
162
+
163
+ PredicateName:
164
+ NamePrefixBlacklist:
165
+ - is_
166
+
167
+ Proc:
168
+ Enabled: false
169
+
170
+ RaiseArgs:
171
+ Enabled: false
172
+
173
+ RegexpLiteral:
174
+ Enabled: false
175
+
176
+ SelfAssignment:
177
+ Enabled: false
178
+
179
+ SingleLineBlockParams:
180
+ Enabled: false
181
+
182
+ SingleLineMethods:
183
+ Enabled: false
184
+
185
+ SignalException:
186
+ Enabled: false
187
+
188
+ SpecialGlobalVars:
189
+ Enabled: false
190
+
191
+ StringLiterals:
192
+ Enabled: false
193
+
194
+ VariableInterpolation:
195
+ Enabled: false
196
+
197
+ TrailingComma:
198
+ Enabled: false
199
+
200
+ TrivialAccessors:
201
+ Enabled: false
202
+
203
+ VariableInterpolation:
204
+ Enabled: false
205
+
206
+ WhenThen:
207
+ Enabled: false
208
+
209
+ WhileUntilModifier:
210
+ Enabled: false
211
+
212
+ WordArray:
213
+ Enabled: false
214
+
215
+ # Lint
216
+
217
+ AmbiguousOperator:
218
+ Enabled: false
219
+
220
+ AmbiguousRegexpLiteral:
221
+ Enabled: false
222
+
223
+ AssignmentInCondition:
224
+ Enabled: false
225
+
226
+ ConditionPosition:
227
+ Enabled: false
228
+
229
+ DeprecatedClassMethods:
230
+ Enabled: false
231
+
232
+ ElseLayout:
233
+ Enabled: false
234
+
235
+ HandleExceptions:
236
+ Enabled: false
237
+
238
+ InvalidCharacterLiteral:
239
+ Enabled: false
240
+
241
+ LiteralInCondition:
242
+ Enabled: false
243
+
244
+ LiteralInInterpolation:
245
+ Enabled: false
246
+
247
+ Loop:
248
+ Enabled: false
249
+
250
+ ParenthesesAsGroupedExpression:
251
+ Enabled: false
252
+
253
+ RequireParentheses:
254
+ Enabled: false
255
+
256
+ UnderscorePrefixedVariableName:
257
+ Enabled: false
258
+
259
+ Void:
260
+ Enabled: false
261
+
262
+ Style/AlignParameters:
263
+ EnforcedStyle: with_fixed_indentation
264
+
265
+ Style/SymbolProc:
266
+ Enabled: false
267
+
268
+ Style/MultilineOperationIndentation:
269
+ EnforcedStyle: indented
270
+
271
+ Style/EmptyLinesAroundBlockBody:
272
+ Enabled: false
273
+
274
+ Style/UnneededPercentQ:
275
+ Enabled: false
276
+
277
+ Metrics/AbcSize:
278
+ Enabled: false
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ before_install: gem install bundler -v 1.10.6
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in crumple.gemspec
4
+ gemspec
5
+ gem "fileutils"
6
+ group :test do
7
+ gem "coveralls", require: false
8
+ gem 'fakefs', require: "fakefs/safe"
9
+ end
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Matt0Hara
4
+
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
@@ -0,0 +1,46 @@
1
+ ![Codeship Status for Matt0Hara/Crumple](https://codeship.com/projects/5f790d70-63de-0133-91d7-4e7188597f7b/status?branch=master)![Code Climate](https://codeclimate.com/github/Matt0hara/Crumple.png) [![Coverage Status](https://coveralls.io/repos/Matt0hara/Crumple/badge.svg?branch=master&service=github)](https://coveralls.io/github/Matt0hara/Crumple?branch=master)
2
+
3
+ # Crumple
4
+
5
+ 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/crumple`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+
7
+ TODO: Delete this and the text above, and describe your gem
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'crumple'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle install
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install crumple
24
+
25
+ ## Usage
26
+ * To export a file:
27
+ crumple FILENAME
28
+
29
+ * To change dump directory:
30
+ crumple -d directory
31
+
32
+ * To view the current dump directory:
33
+ crumple -g
34
+
35
+
36
+ ## Development
37
+ Tests are failing right now due to a conflict with fakefs, a gem used for testing! Gem works fine otherwise.
38
+
39
+ ## Contributing
40
+
41
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Matt0Hara/crumple.
42
+
43
+
44
+ ## License
45
+
46
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,5 @@
1
+ require "rspec/core/rake_task"
2
+ require "bundler/gem_tasks"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "crumple"
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
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env ruby
2
+ require "fileutils"
3
+ require "crumple"
4
+
5
+ options = {}
6
+
7
+ opt_parser = OptionParser.new do |opt|
8
+ opt.banner = "Hey guys!"
9
+ opt.separator ""
10
+ opt.separator "Commands"
11
+ opt.separator " Simply input a filename to export it!"
12
+ opt.separator ""
13
+ opt.separator "Options"
14
+
15
+ opt.on("-d","--dir","set dump directory") do
16
+ options[:set_dump_dir] = true
17
+ end
18
+
19
+ opt.on("-g","--getdir","get dump_dir") do
20
+ options[:get_dump_dir] = true
21
+ end
22
+
23
+ opt.on("-h","--help","help") do
24
+ puts opt_parser
25
+ end
26
+ end
27
+
28
+ opt_parser.parse!
29
+
30
+ mover = Crumple::Mover.new
31
+
32
+ if options[:set_dump_dir]
33
+ mover.set_dump_dir(ARGV[0])
34
+ elsif options[:get_dump_dir]
35
+ puts mover.get_dump_dir
36
+ elsif
37
+ mover.set_target_file(ARGV[0])
38
+ mover.dump
39
+ end
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'crumple/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "crumple"
8
+ spec.version = Crumple::VERSION
9
+ spec.authors = ["Matt0Hara\n"]
10
+ spec.email = ["mohara2@worcester.edu"]
11
+
12
+ spec.summary = %q{A gem that throws away unwanted files, but keeps them
13
+ for future use.}
14
+ spec.homepage = "https://github.com/Matt0Hara/crumple"
15
+ spec.license = "MIT"
16
+
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ spec.bindir = "bin"
20
+ spec.executables = ["crumple"]
21
+ # spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.10"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec"
27
+ spec.add_development_dependency "capybara"
28
+ end
@@ -0,0 +1,53 @@
1
+ require "crumple/version"
2
+ require "fileutils"
3
+
4
+ module Crumple
5
+ class Mover
6
+ attr_accessor :target_file
7
+ attr_reader :dump_dir
8
+
9
+ def initialize
10
+ @target_file = target_file
11
+ @dump_dir = get_dump_dir
12
+ end
13
+
14
+ def set_target_file(file)
15
+ @target_file = file
16
+ end
17
+
18
+ def get_target_file
19
+ @target_file
20
+ end
21
+
22
+ def set_dump_dir(new_dump_dir)
23
+ config_file = ".crumpleconfig.txt"
24
+ FileUtils.touch(config_file) unless File.exist?(config_file)
25
+ File.open(config_file, "w") do |file|
26
+ file.print("#{new_dump_dir}")
27
+ end
28
+ @dump_dir = get_dump_dir
29
+ end
30
+
31
+ def get_dump_dir
32
+ config_file = ".crumpleconfig.txt"
33
+ if File.exist?(config_file)
34
+ unless File.read(config_file).nil?
35
+ return File.read(config_file)
36
+ end
37
+ else
38
+ "~/Documents/crumpledump/"
39
+ end
40
+ end
41
+
42
+ def dump
43
+ if File.exist?(@target_file)
44
+ unless Dir.exist?(@dump_dir)
45
+ FileUtils.mkdir_p(@dump_dir)
46
+ end
47
+ FileUtils.mv(@target_file, @dump_dir)
48
+ else
49
+ raise "File does not exist!"
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,3 @@
1
+ module Crumple
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: crumple
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - 'Matt0Hara
8
+
9
+ '
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2015-11-20 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: bundler
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - "~>"
20
+ - !ruby/object:Gem::Version
21
+ version: '1.10'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - "~>"
27
+ - !ruby/object:Gem::Version
28
+ version: '1.10'
29
+ - !ruby/object:Gem::Dependency
30
+ name: rake
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - "~>"
34
+ - !ruby/object:Gem::Version
35
+ version: '10.0'
36
+ type: :development
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '10.0'
43
+ - !ruby/object:Gem::Dependency
44
+ name: rspec
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ type: :development
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ - !ruby/object:Gem::Dependency
58
+ name: capybara
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ type: :development
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ description:
72
+ email:
73
+ - mohara2@worcester.edu
74
+ executables:
75
+ - crumple
76
+ extensions: []
77
+ extra_rdoc_files: []
78
+ files:
79
+ - ".coveralls.yaml"
80
+ - ".crumpleconfig.txt"
81
+ - ".gitignore"
82
+ - ".hound.yaml"
83
+ - ".travis.yml"
84
+ - Gemfile
85
+ - LICENSE.txt
86
+ - README.md
87
+ - Rakefile
88
+ - bin/console
89
+ - bin/crumple
90
+ - bin/setup
91
+ - crumple.gemspec
92
+ - lib/crumple.rb
93
+ - lib/crumple/version.rb
94
+ homepage: https://github.com/Matt0Hara/crumple
95
+ licenses:
96
+ - MIT
97
+ metadata: {}
98
+ post_install_message:
99
+ rdoc_options: []
100
+ require_paths:
101
+ - lib
102
+ required_ruby_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ requirements: []
113
+ rubyforge_project:
114
+ rubygems_version: 2.4.8
115
+ signing_key:
116
+ specification_version: 4
117
+ summary: A gem that throws away unwanted files, but keeps them for future use.
118
+ test_files: []