company_manager 0.0.4 → 0.0.5
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +48 -0
- data/Guardfile +11 -0
- data/Rakefile +5 -3
- data/bin/console +4 -4
- data/company_manager.gemspec +3 -0
- data/lib/company.rb +24 -0
- data/lib/company_manager.rb +28 -2
- data/lib/company_manager/version.rb +1 -1
- data/lib/employee.rb +13 -0
- metadata +48 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e8e3bed50b944a987cabfd580474e0f76cb6a5c
|
4
|
+
data.tar.gz: 22b8cea9f156f85c0ea46e39ed857613d97e16e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f38d2bec94f3ff1cf66e9053cd087d87840fea49aa1c1487306f1b134d374ab013b19382cc7d78eeb173da166edd32acb9ee965d1b7f2716f686a0cb555a32c
|
7
|
+
data.tar.gz: c110ff8c288f3b4a37464ad929438201b373b2279a0a94dde1a2b9e9fb6466d57f4dde6cc98cf28cc00c1ba20e765af1fe915f46f9f871edfde528009927ca73
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
+
# on 2015-02-23 06:17:38 +0100 using RuboCop version 0.27.1.
|
3
|
+
# The point is for the user to remove these configuration records
|
4
|
+
# one by one as the offenses are removed from the code base.
|
5
|
+
# Note that changes in the inspected code, or installation of new
|
6
|
+
# versions of RuboCop, may require this file to be generated again.
|
7
|
+
|
8
|
+
# Offense count: 3
|
9
|
+
Style/Documentation:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
# Offense count: 2
|
13
|
+
# Cop supports --auto-correct.
|
14
|
+
# Configuration parameters: PreferredDelimiters.
|
15
|
+
Style/PercentLiteralDelimiters:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
# Offense count: 2
|
19
|
+
Style/RegexpLiteral:
|
20
|
+
MaxSlashes: 0
|
21
|
+
|
22
|
+
# Offense count: 1
|
23
|
+
# Cop supports --auto-correct.
|
24
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
25
|
+
Style/TrailingBlankLines:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
# Offense count: 1
|
29
|
+
# Cop supports --auto-correct.
|
30
|
+
# Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, Whitelist.
|
31
|
+
Style/TrivialAccessors:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
# Offense count: 2
|
35
|
+
# Cop supports --auto-correct.
|
36
|
+
Style/UnneededPercentQ:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
Documentation:
|
40
|
+
Enabled: false
|
41
|
+
|
42
|
+
Metrics/LineLength:
|
43
|
+
Max: 120
|
44
|
+
|
45
|
+
AllCops:
|
46
|
+
Exclude:
|
47
|
+
- '**/Guardfile'
|
48
|
+
- '**/company_manager.gemspec'
|
data/Guardfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
guard :rspec, cmd: 'rspec' do
|
2
|
+
watch(%r{^lib/(.+).rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
3
|
+
watch(%r{^spec/(.+).rb$}) { |m| "spec/#{m[1]}.rb" }
|
4
|
+
watch('spec/spec_helper.rb') { "spec" }
|
5
|
+
watch('Gemfile')
|
6
|
+
end
|
7
|
+
|
8
|
+
guard :rubocop, all_on_start: false, cli: ['--format', 'clang'] do
|
9
|
+
watch(%r{.+\.rb$})
|
10
|
+
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
11
|
+
end
|
data/Rakefile
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
3
|
|
4
4
|
RSpec::Core::RakeTask.new(:spec)
|
5
5
|
|
6
|
-
task :
|
6
|
+
# I swap this bottom with 'task :delault => :spec
|
7
|
+
# If it is ok?
|
8
|
+
task default: :spec
|
data/bin/console
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'company_manager'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
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
|
10
|
+
# require 'pry'
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start(__FILE__)
|
data/company_manager.gemspec
CHANGED
@@ -33,4 +33,7 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_development_dependency "bundler", "~> 1.14"
|
34
34
|
spec.add_development_dependency "rake", "~> 10.0"
|
35
35
|
spec.add_development_dependency "rspec", "~> 3.0"
|
36
|
+
spec.add_development_dependency 'guard', '~> 2.12'
|
37
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.5'
|
38
|
+
spec.add_development_dependency 'guard-rubocop', '~> 1.2'
|
36
39
|
end
|
data/lib/company.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
module CompanyManager
|
2
|
+
class Company
|
3
|
+
def initialize(opts = {})
|
4
|
+
@name = opts[:name].to_s.strip
|
5
|
+
@id = opts[:id]
|
6
|
+
end
|
7
|
+
|
8
|
+
attr_accessor :name, :id
|
9
|
+
|
10
|
+
def employee
|
11
|
+
@employee ||= []
|
12
|
+
end
|
13
|
+
|
14
|
+
def add_employee(*employe)
|
15
|
+
employee.concat(employe)
|
16
|
+
end
|
17
|
+
|
18
|
+
def remove_employee(name)
|
19
|
+
employee.delete_if do |employe|
|
20
|
+
employe.first_name == name || employe.last_name == name
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/company_manager.rb
CHANGED
@@ -1,5 +1,31 @@
|
|
1
|
-
require
|
1
|
+
require 'company_manager/version'
|
2
|
+
require 'employee'
|
3
|
+
require 'company'
|
2
4
|
|
3
5
|
module CompanyManager
|
4
|
-
|
6
|
+
class Main
|
7
|
+
def run
|
8
|
+
loop do
|
9
|
+
each_loop_process
|
10
|
+
break if output == 'exit'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def each_loop_process
|
15
|
+
read_input
|
16
|
+
process_commands
|
17
|
+
end
|
18
|
+
|
19
|
+
attr_reader :output
|
20
|
+
|
21
|
+
def read_input
|
22
|
+
@output = $stdin.gets.chomp
|
23
|
+
end
|
24
|
+
|
25
|
+
def process_commands
|
26
|
+
case output
|
27
|
+
when 'help' then puts 'To jest pomoc'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
5
31
|
end
|
data/lib/employee.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
module CompanyManager
|
2
|
+
class Employee
|
3
|
+
def initialize(opts = {})
|
4
|
+
@first_name = opts[:first_name].to_s.strip
|
5
|
+
@last_name = opts[:last_name].to_s.strip
|
6
|
+
end
|
7
|
+
|
8
|
+
attr_accessor :first_name, :last_name
|
9
|
+
def full_name
|
10
|
+
"#{first_name} #{last_name}"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: company_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- darekcharkot
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,48 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: guard
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.12'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.12'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard-rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '4.5'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '4.5'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: guard-rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.2'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.2'
|
55
97
|
description: Company manager gem with add and remove employees
|
56
98
|
email:
|
57
99
|
- darek.charkot@gmail.com
|
@@ -61,16 +103,20 @@ extra_rdoc_files: []
|
|
61
103
|
files:
|
62
104
|
- ".gitignore"
|
63
105
|
- ".rspec"
|
106
|
+
- ".rubocop.yml"
|
64
107
|
- ".travis.yml"
|
65
108
|
- Gemfile
|
109
|
+
- Guardfile
|
66
110
|
- LICENSE.txt
|
67
111
|
- README.md
|
68
112
|
- Rakefile
|
69
113
|
- bin/console
|
70
114
|
- bin/setup
|
71
115
|
- company_manager.gemspec
|
116
|
+
- lib/company.rb
|
72
117
|
- lib/company_manager.rb
|
73
118
|
- lib/company_manager/version.rb
|
119
|
+
- lib/employee.rb
|
74
120
|
homepage: ''
|
75
121
|
licenses:
|
76
122
|
- MIT
|