friends 0.0.1

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: afa08d3f4c3b0c3cf97e75321e94d788ba282d93
4
+ data.tar.gz: c0653597da81b0f6132af10ab97faf2358484d91
5
+ SHA512:
6
+ metadata.gz: a71a226dbad93f72e9cd4a48babe3186ad4c73d7d3483f85ebef94b3053e170ccded2b9ce42873898137b72808d4ef1ce6e6a4ccd6729292c0040ca05a92b099
7
+ data.tar.gz: 492a51f2a1abc0eaf8bf533bb2a4f24f7c2dce9a965c4a5cb8d9767658cf7b23be8f64ef86c613dbef27e9a29a8204a9cf342c7c146a0f70a381cb0d155710d6
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ *.gem
File without changes
@@ -0,0 +1,264 @@
1
+ AccessorMethodName:
2
+ Enabled: false
3
+
4
+ Alias:
5
+ Enabled: false
6
+
7
+ AllCops:
8
+ Exclude:
9
+ - "vendor/**/*"
10
+ - "spec/dummy/**/*"
11
+ - "db/schema.rb"
12
+ - "db/migrate/**/*"
13
+ RunRailsCops: false
14
+
15
+ AmbiguousOperator:
16
+ Enabled: false
17
+
18
+ AmbiguousRegexpLiteral:
19
+ Enabled: false
20
+
21
+ ArrayJoin:
22
+ Enabled: false
23
+
24
+ AsciiComments:
25
+ Enabled: false
26
+
27
+ AsciiIdentifiers:
28
+ Enabled: false
29
+
30
+ AssignmentInCondition:
31
+ Enabled: true
32
+
33
+ Attr:
34
+ Enabled: false
35
+
36
+ BlockNesting:
37
+ Enabled: false
38
+
39
+ BracesAroundHashParameters:
40
+ Enabled: false
41
+
42
+ CaseEquality:
43
+ Enabled: false
44
+
45
+ CharacterLiteral:
46
+ Enabled: false
47
+
48
+ ClassLength:
49
+ Enabled: false
50
+
51
+ ClassVars:
52
+ Enabled: false
53
+
54
+ CollectionMethods:
55
+ PreferredMethods:
56
+ find: detect
57
+ reduce: inject
58
+ collect: map
59
+ find_all: select
60
+
61
+ ColonMethodCall:
62
+ Enabled: false
63
+
64
+ CommentAnnotation:
65
+ Enabled: false
66
+
67
+ ConditionPosition:
68
+ Enabled: false
69
+
70
+ CyclomaticComplexity:
71
+ Enabled: false
72
+
73
+ Delegate:
74
+ Enabled: false
75
+
76
+ DeprecatedClassMethods:
77
+ Enabled: false
78
+
79
+ DeprecatedHashMethods:
80
+ Enabled: false
81
+
82
+ Documentation:
83
+ Enabled: false
84
+
85
+ DotPosition:
86
+ EnforcedStyle: trailing
87
+
88
+ DoubleNegation:
89
+ Enabled: false
90
+
91
+ ElseLayout:
92
+ Enabled: false
93
+
94
+ EmptyLiteral:
95
+ Enabled: false
96
+
97
+ Encoding:
98
+ Enabled: false
99
+
100
+ EvenOdd:
101
+ Enabled: false
102
+
103
+ FileName:
104
+ Enabled: false
105
+
106
+ FlipFlop:
107
+ Enabled: false
108
+
109
+ FormatString:
110
+ Enabled: false
111
+
112
+ GlobalVars:
113
+ Enabled: false
114
+
115
+ HandleExceptions:
116
+ Enabled: false
117
+
118
+ IfUnlessModifier:
119
+ Enabled: false
120
+
121
+ IfWithSemicolon:
122
+ Enabled: false
123
+
124
+ InvalidCharacterLiteral:
125
+ Enabled: false
126
+
127
+ Lambda:
128
+ Enabled: false
129
+
130
+ LambdaCall:
131
+ Enabled: false
132
+
133
+ LineEndConcatenation:
134
+ Enabled: false
135
+
136
+ LineLength:
137
+ Max: 80
138
+
139
+ LiteralInCondition:
140
+ Enabled: false
141
+
142
+ LiteralInInterpolation:
143
+ Enabled: false
144
+
145
+ Loop:
146
+ Enabled: false
147
+
148
+ MethodLength:
149
+ Enabled: false
150
+
151
+ ModuleFunction:
152
+ Enabled: false
153
+
154
+ NegatedIf:
155
+ Enabled: false
156
+
157
+ NegatedWhile:
158
+ Enabled: false
159
+
160
+ Next:
161
+ Enabled: false
162
+
163
+ NilComparison:
164
+ Enabled: false
165
+
166
+ Not:
167
+ Enabled: false
168
+
169
+ NumericLiterals:
170
+ Enabled: false
171
+
172
+ OneLineConditional:
173
+ Enabled: false
174
+
175
+ OpMethod:
176
+ Enabled: false
177
+
178
+ ParameterLists:
179
+ Enabled: false
180
+
181
+ ParenthesesAsGroupedExpression:
182
+ Enabled: false
183
+
184
+ PercentLiteralDelimiters:
185
+ PreferredDelimiters:
186
+ '%': '{}'
187
+
188
+ PerlBackrefs:
189
+ Enabled: false
190
+
191
+ PredicateName:
192
+ NamePrefixBlacklist:
193
+ - is_
194
+
195
+ Proc:
196
+ Enabled: false
197
+
198
+ RaiseArgs:
199
+ Enabled: false
200
+
201
+ RedundantReturn:
202
+ AllowMultipleReturnValues: true
203
+
204
+ RegexpLiteral:
205
+ Enabled: false
206
+
207
+ RequireParentheses:
208
+ Enabled: false
209
+
210
+ SelfAssignment:
211
+ Enabled: false
212
+
213
+ SignalException:
214
+ EnforcedStyle: only_raise
215
+
216
+ SingleLineBlockParams:
217
+ Enabled: false
218
+
219
+ SingleLineMethods:
220
+ Enabled: false
221
+
222
+ SpecialGlobalVars:
223
+ Enabled: false
224
+
225
+ StringLiterals:
226
+ EnforcedStyle: double_quotes
227
+
228
+ Style/MultilineBlockChain:
229
+ Enabled: false
230
+
231
+ VariableInterpolation:
232
+ Enabled: false
233
+
234
+ TrailingComma:
235
+ Enabled: false
236
+
237
+ TrivialAccessors:
238
+ Enabled: false
239
+
240
+ UnderscorePrefixedVariableName:
241
+ Enabled: false
242
+
243
+ VariableInterpolation:
244
+ Enabled: false
245
+
246
+ Void:
247
+ Enabled: false
248
+
249
+ WhenThen:
250
+ Enabled: false
251
+
252
+ WhileUntilModifier:
253
+ Enabled: false
254
+
255
+ WordArray:
256
+ Enabled: false
257
+
258
+ GuardClause:
259
+ Enabled: false
260
+
261
+ # Renaming `has_something?` to `something?` obfuscates whether it is a "is-a" or
262
+ # # a "has-a" relationship.
263
+ PredicateName:
264
+ Enabled: false
@@ -0,0 +1 @@
1
+ 2.1.4
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ addons:
3
+ code_climate:
4
+ repo_token: d744a74c96e3e5c763ed776709aff0662ac2f3e8274c01e439e09b38c8be4225
5
+ notifications:
6
+ email: false
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Jacob Evelyn
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,31 @@
1
+ [![Code Climate](https://codeclimate.com/github/JacobEvelyn/friends/badges/gpa.svg)](https://codeclimate.com/github/JacobEvelyn/friends) [![Test Coverage](https://codeclimate.com/github/JacobEvelyn/friends/badges/coverage.svg)](https://codeclimate.com/github/JacobEvelyn/friends) [![Build Status](https://travis-ci.org/JacobEvelyn/friends.svg)](https://travis-ci.org/JacobEvelyn/friends)
2
+
3
+ # Friends
4
+
5
+ Spend time with the people you care about. Introvert-tested. Extrovert-approved.
6
+
7
+ ## Installation
8
+
9
+ $ gem install friends
10
+
11
+ ## Usage
12
+
13
+ $ friends --help
14
+
15
+ ## Contributing
16
+
17
+ 1. Fork it (https://github.com/JacobEvelyn/friends/fork)
18
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
19
+ 3. Commit your changes (`git commit -am "Add some feature"`)
20
+ 4. Push to the branch (`git push origin my-new-feature`)
21
+ 5. Create a new Pull Request
22
+
23
+ **Make sure your changes have appropriate tests (`rake test`) and
24
+ conform to the Rubocop style specified. We use
25
+ [overcommit](https://github.com/causes/overcommit) to enforce good
26
+ code.**
27
+
28
+ ## License
29
+
30
+ Friends is released under the
31
+ [MIT License](https://github.com/JacobEvelyn/friends/blob/master/LICENSE.txt).
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.test_files = FileList["test/*_spec.rb"]
6
+ end
7
+
8
+ task default: :test
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "friends"
4
+
5
+ Friends::Extrovert.start(ARGV)
@@ -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 "friends/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "friends"
8
+ spec.version = Friends::VERSION
9
+ spec.authors = ["Jacob Evelyn"]
10
+ spec.email = ["jacobevelyn@gmail.com"]
11
+ spec.summary = %q{Spend time with the people you care about.}
12
+ spec.description = %q{Spend time with the people you care about. Introvert-tested. Extrovert-approved.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = ["friends"]
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "thor"
22
+
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "bundler", "~> 1.7"
25
+ spec.add_development_dependency "codeclimate-test-reporter"
26
+ end
@@ -0,0 +1,3 @@
1
+ ### Friends:
2
+ - Ben Yavitt
3
+ - Zane
@@ -0,0 +1,4 @@
1
+ require "friends/extrovert"
2
+
3
+ module Friends
4
+ end
@@ -0,0 +1,29 @@
1
+ # Extrovert is the public interface for the friends script. It interacts with
2
+ # an Introvert for backend computations.
3
+
4
+ require "friends/introvert"
5
+
6
+ require "thor"
7
+
8
+ module Friends
9
+ class Extrovert < Thor
10
+ def initialize(*args)
11
+ super
12
+ @introvert = Introvert.new
13
+ end
14
+
15
+ attr_reader :introvert
16
+
17
+ class_option :verbose, type: :boolean
18
+
19
+ desc "clean", "Cleans your friends.md file"
20
+ def clean
21
+ introvert.clean
22
+ end
23
+
24
+ desc "list", "List all friends"
25
+ def list
26
+ puts introvert.friends.map(&:name)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,11 @@
1
+ # Friend represents a friend. You know, a real-life friend!
2
+
3
+ module Friends
4
+ class Friend
5
+ def initialize(name:)
6
+ @name = name
7
+ end
8
+
9
+ attr_accessor :name
10
+ end
11
+ end
@@ -0,0 +1,76 @@
1
+ # Introvert is the internal handler for the friends script.
2
+
3
+ require "friends/friend"
4
+
5
+ module Friends
6
+ class Introvert
7
+ FRIENDS_HEADER = "### Friends:"
8
+
9
+ # @return [String] the name of the friends.md file
10
+ def filename
11
+ "friends.md"
12
+ end
13
+
14
+ # @return [Array] the list of all Friends
15
+ def friends
16
+ return @friends if @friends
17
+
18
+ read_file(filename: filename, friends_only: true)
19
+ @friends
20
+ end
21
+
22
+ # Process the friends.md file and store its contents in internal data
23
+ # structures.
24
+ # @param filename [String] the name of the friends file
25
+ # @param friends_only [Boolean] true if we should only read the friends list
26
+ def read_file(filename:, friends_only: false)
27
+ state = :initial
28
+ line_num = 0
29
+
30
+ # Loop through all lines in the file and process them.
31
+ File.foreach(filename) do |line|
32
+ line_num += 1
33
+ line.chomp! # Remove trailing newline from each line.
34
+
35
+ case state
36
+ when :initial
37
+ bad_line(FRIENDS_HEADER, line_num) unless line == FRIENDS_HEADER
38
+
39
+ state = :reading_friends
40
+ @friends = []
41
+ when :reading_friends
42
+ if line == "### Events:"
43
+ state = :reading_events
44
+ else
45
+ match = line.match(/- (?<name>.+)/)
46
+ bad_line("- [Friend Name]", line_num) unless match && match[:name]
47
+ @friends << Friend.new(name: match[:name])
48
+ end
49
+ end
50
+ end
51
+ end
52
+
53
+ # Write out the friends file with cleaned/sorted data.
54
+ def clean
55
+ names = friends.sort_by(&:name).map { |friend| "- #{friend.name}" }
56
+ File.open(filename, "w") do |file|
57
+ file.puts(FRIENDS_HEADER)
58
+ names.each { |name| file.puts(name) }
59
+ end
60
+ end
61
+
62
+ private
63
+
64
+ # Raise an error that a line in the friends file is malformed.
65
+ # @param expected [String] the expected contents of the line
66
+ # @param line_num [Integer] the line number
67
+ def bad_line(expected, line_num)
68
+ error "Expected \"#{expected}\" on line #{line_num}"
69
+ end
70
+
71
+ # Output the given message and exit the program.
72
+ def error(message)
73
+ Gossip.error(message)
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,3 @@
1
+ module Friends
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,11 @@
1
+ require_relative "helper"
2
+
3
+ describe Friends::Friend do
4
+ describe "#name" do
5
+ subject { Friends::Friend.new(name: "Jacob") }
6
+
7
+ it "returns name" do
8
+ subject.name.must_equal "Jacob"
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ require "codeclimate-test-reporter"
2
+ CodeClimate::TestReporter.start
3
+
4
+ require "friends"
5
+
6
+ require "minitest/autorun"
7
+ require "minitest/pride"
metadata ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: friends
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jacob Evelyn
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
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: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: codeclimate-test-reporter
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Spend time with the people you care about. Introvert-tested. Extrovert-approved.
70
+ email:
71
+ - jacobevelyn@gmail.com
72
+ executables:
73
+ - friends
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".overcommit.yml"
79
+ - ".rubocop.yml"
80
+ - ".ruby-version"
81
+ - ".travis.yml"
82
+ - Gemfile
83
+ - LICENSE.txt
84
+ - README.md
85
+ - Rakefile
86
+ - bin/friends
87
+ - friends.gemspec
88
+ - friends.md
89
+ - lib/friends.rb
90
+ - lib/friends/extrovert.rb
91
+ - lib/friends/friend.rb
92
+ - lib/friends/introvert.rb
93
+ - lib/friends/version.rb
94
+ - test/friend_spec.rb
95
+ - test/helper.rb
96
+ homepage: ''
97
+ licenses:
98
+ - MIT
99
+ metadata: {}
100
+ post_install_message:
101
+ rdoc_options: []
102
+ require_paths:
103
+ - lib
104
+ required_ruby_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ required_rubygems_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ requirements: []
115
+ rubyforge_project:
116
+ rubygems_version: 2.2.2
117
+ signing_key:
118
+ specification_version: 4
119
+ summary: Spend time with the people you care about.
120
+ test_files:
121
+ - test/friend_spec.rb
122
+ - test/helper.rb