fake_activity 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.reek.yml +6 -0
- data/.rubocop.yml +17 -0
- data/Gemfile +4 -2
- data/Gemfile.lock +22 -1
- data/Rakefile +4 -2
- data/analyzer.sh +26 -0
- data/bin/fake_activity +13 -0
- data/fake_activity.gemspec +15 -13
- data/lib/fake_activity/commit_generator.rb +39 -0
- data/lib/fake_activity/date_validator.rb +28 -0
- data/lib/fake_activity/type_detector.rb +26 -0
- data/lib/fake_activity/version.rb +3 -1
- data/lib/fake_activity.rb +24 -5
- metadata +40 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1859dc81da9f357ed4c1ba109c17d87ea0c615ab28b8983a817e6583e5d228c1
|
4
|
+
data.tar.gz: e62d0513489ce75eba9f79bfa663a9382241cae4a6b49454bc7447515c399830
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6eb85a29162536ca223b6f98b8f19514d49810f796ed9146cb31f9d5918d4f7cb6378f13389c9674a3a740952569d4d9affba674d3f2818dc732996367bd0e3
|
7
|
+
data.tar.gz: 812888e790076b5198c9ac5e09e9889557ed94850cc34004530b9fb86ca9d8bf2041694475ae40883cb639765086e799b15caca4b858447720e283fadde8c2d2
|
data/.reek.yml
ADDED
data/.rubocop.yml
ADDED
data/Gemfile
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
4
6
|
|
5
7
|
# Specify your gem's dependencies in fake_activity.gemspec
|
6
8
|
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,31 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fake_activity (0.1
|
4
|
+
fake_activity (0.2.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
+
coderay (1.1.2)
|
10
|
+
diff-lcs (1.3)
|
11
|
+
method_source (0.9.2)
|
12
|
+
pry (0.12.2)
|
13
|
+
coderay (~> 1.1.0)
|
14
|
+
method_source (~> 0.9.0)
|
9
15
|
rake (10.5.0)
|
16
|
+
rspec (3.8.0)
|
17
|
+
rspec-core (~> 3.8.0)
|
18
|
+
rspec-expectations (~> 3.8.0)
|
19
|
+
rspec-mocks (~> 3.8.0)
|
20
|
+
rspec-core (3.8.0)
|
21
|
+
rspec-support (~> 3.8.0)
|
22
|
+
rspec-expectations (3.8.2)
|
23
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
24
|
+
rspec-support (~> 3.8.0)
|
25
|
+
rspec-mocks (3.8.0)
|
26
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
+
rspec-support (~> 3.8.0)
|
28
|
+
rspec-support (3.8.0)
|
10
29
|
|
11
30
|
PLATFORMS
|
12
31
|
ruby
|
@@ -14,7 +33,9 @@ PLATFORMS
|
|
14
33
|
DEPENDENCIES
|
15
34
|
bundler (~> 1.16)
|
16
35
|
fake_activity!
|
36
|
+
pry
|
17
37
|
rake (~> 10.0)
|
38
|
+
rspec
|
18
39
|
|
19
40
|
BUNDLED WITH
|
20
41
|
1.16.4
|
data/Rakefile
CHANGED
data/analyzer.sh
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
HEIGLIGHT='\033[0;37m'
|
2
|
+
NO_COLOR='\033[0m'
|
3
|
+
|
4
|
+
rubocop && \
|
5
|
+
echo -e "${HEIGLIGHT}
|
6
|
+
rubocop OK
|
7
|
+
${NO_COLOR}" && \
|
8
|
+
|
9
|
+
rspec && \
|
10
|
+
echo -e "${HEIGLIGHT}
|
11
|
+
rspec OK
|
12
|
+
${NO_COLOR}" && \
|
13
|
+
|
14
|
+
reek && \
|
15
|
+
echo -e "${HEIGLIGHT}
|
16
|
+
reek OK
|
17
|
+
${NO_COLOR}" && \
|
18
|
+
|
19
|
+
bundle-audit -u && \
|
20
|
+
echo -e "${HEIGLIGHT}
|
21
|
+
bundle-audit -u OK
|
22
|
+
${NO_COLOR}" && \
|
23
|
+
|
24
|
+
echo -e "${HEIGLIGHT}
|
25
|
+
ALL OK
|
26
|
+
${NO_COLOR}"
|
data/bin/fake_activity
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "fake_activity"
|
4
|
+
|
5
|
+
arg1 = FakeActivity::DateValidator.new(ARGV[0])
|
6
|
+
arg2 = FakeActivity::DateValidator.new(ARGV[1])
|
7
|
+
|
8
|
+
if arg1.valid? && arg2.valid?
|
9
|
+
FakeActivity::ActivityGenerator.generate_activity(from: ARGV[0], to: ARGV[1])
|
10
|
+
else
|
11
|
+
puts arg1.message
|
12
|
+
puts arg2.message
|
13
|
+
end
|
data/fake_activity.gemspec
CHANGED
@@ -1,26 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
|
-
lib = File.expand_path(
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
5
|
+
require 'fake_activity/version'
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
8
|
+
spec.name = 'fake_activity'
|
8
9
|
spec.version = FakeActivity::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
10
|
+
spec.authors = ['Vladislav Hilko']
|
11
|
+
spec.email = ['vladislav.spawn@gmail.com']
|
11
12
|
|
12
|
-
spec.summary =
|
13
|
-
spec.license =
|
13
|
+
spec.summary = 'Make your github account really active!'
|
14
|
+
spec.license = 'MIT'
|
14
15
|
|
15
16
|
# Specify which files should be added to the gem when it is released.
|
16
17
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
17
|
-
spec.files = Dir.chdir(File.expand_path(
|
18
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
18
19
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
20
|
end
|
20
|
-
spec.
|
21
|
-
spec.
|
22
|
-
spec.require_paths = ["lib"]
|
21
|
+
spec.executables = ['fake_activity']
|
22
|
+
spec.require_paths = ['lib']
|
23
23
|
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.add_development_dependency
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
25
|
+
spec.add_development_dependency 'pry'
|
26
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
27
|
+
spec.add_development_dependency 'rspec'
|
26
28
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'fake_activity/type_detector'
|
4
|
+
|
5
|
+
module FakeActivity
|
6
|
+
class CommitGenerator
|
7
|
+
TYPES_REPEAT_COUNT = {
|
8
|
+
light_green: 1,
|
9
|
+
moderate_green: 6,
|
10
|
+
green: 8,
|
11
|
+
dark_green: 10
|
12
|
+
}.freeze
|
13
|
+
|
14
|
+
attr_reader :date, :type
|
15
|
+
|
16
|
+
def self.generate_commits(date)
|
17
|
+
new(date).generate_commits
|
18
|
+
end
|
19
|
+
|
20
|
+
def initialize(date)
|
21
|
+
@type = FakeActivity::TypeDetector.detect_type
|
22
|
+
@date = date.to_s
|
23
|
+
end
|
24
|
+
|
25
|
+
def generate_commits
|
26
|
+
number_of_commits.times { |num| add_commit(num) }
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def number_of_commits
|
32
|
+
@number_of_commits ||= TYPES_REPEAT_COUNT[type]
|
33
|
+
end
|
34
|
+
|
35
|
+
def add_commit(number)
|
36
|
+
`git commit -m "#{date} - #{number + 1}" --allow-empty --date=#{date}`
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FakeActivity
|
4
|
+
class DateValidator
|
5
|
+
attr_reader :date
|
6
|
+
|
7
|
+
def initialize(date)
|
8
|
+
@date = date
|
9
|
+
end
|
10
|
+
|
11
|
+
def valid?
|
12
|
+
@valid ||= check_date
|
13
|
+
end
|
14
|
+
|
15
|
+
def message
|
16
|
+
"#{date} is an invalid argument" unless valid?
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def check_date
|
22
|
+
Date.parse(date)
|
23
|
+
true
|
24
|
+
rescue ArgumentError
|
25
|
+
false
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FakeActivity
|
4
|
+
class TypeDetector
|
5
|
+
TYPES_PROBABILITY = {
|
6
|
+
light_green: (1..50),
|
7
|
+
moderate_green: (51..70),
|
8
|
+
green: (71..90),
|
9
|
+
dark_green: (91..100)
|
10
|
+
}.freeze
|
11
|
+
|
12
|
+
attr_reader :random_number
|
13
|
+
|
14
|
+
def self.detect_type
|
15
|
+
new.detect_type
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
@random_number = rand(1..100)
|
20
|
+
end
|
21
|
+
|
22
|
+
def detect_type
|
23
|
+
TYPES_PROBABILITY.each { |key, value| return key if value.include? random_number }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/fake_activity.rb
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
require 'fake_activity/date_validator'
|
6
|
+
require 'fake_activity/version'
|
7
|
+
require 'fake_activity/commit_generator'
|
2
8
|
|
3
9
|
module FakeActivity
|
4
10
|
class ActivityGenerator
|
@@ -9,13 +15,26 @@ module FakeActivity
|
|
9
15
|
end
|
10
16
|
|
11
17
|
def initialize(from:, to:)
|
12
|
-
@from = from
|
13
|
-
@to = to
|
18
|
+
@from = Date.parse(from)
|
19
|
+
@to = Date.parse(to)
|
14
20
|
end
|
15
21
|
|
16
22
|
def generate_activity
|
17
|
-
|
18
|
-
|
23
|
+
generate_commits_by_days
|
24
|
+
send_successfull_message
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def generate_commits_by_days
|
30
|
+
(from..to).each do |date_point|
|
31
|
+
FakeActivity::CommitGenerator.generate_commits(date_point)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def send_successfull_message
|
36
|
+
puts "Fake activities were successfully generated from #{from} to #{to}"
|
37
|
+
puts "You can push it to github right now: $ 'git push origin master'"
|
19
38
|
end
|
20
39
|
end
|
21
40
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fake_activity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladislav Hilko
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pry
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rake
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,23 +52,45 @@ dependencies:
|
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
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'
|
41
69
|
description:
|
42
70
|
email:
|
43
71
|
- vladislav.spawn@gmail.com
|
44
|
-
executables:
|
72
|
+
executables:
|
73
|
+
- fake_activity
|
45
74
|
extensions: []
|
46
75
|
extra_rdoc_files: []
|
47
76
|
files:
|
48
77
|
- ".gitignore"
|
78
|
+
- ".reek.yml"
|
79
|
+
- ".rubocop.yml"
|
49
80
|
- Gemfile
|
50
81
|
- Gemfile.lock
|
51
82
|
- LICENSE.txt
|
52
83
|
- README.md
|
53
84
|
- Rakefile
|
85
|
+
- analyzer.sh
|
54
86
|
- bin/console
|
87
|
+
- bin/fake_activity
|
55
88
|
- bin/setup
|
56
89
|
- fake_activity.gemspec
|
57
90
|
- lib/fake_activity.rb
|
91
|
+
- lib/fake_activity/commit_generator.rb
|
92
|
+
- lib/fake_activity/date_validator.rb
|
93
|
+
- lib/fake_activity/type_detector.rb
|
58
94
|
- lib/fake_activity/version.rb
|
59
95
|
homepage:
|
60
96
|
licenses:
|