lazylead 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1515ec779095fe067759c774a8f81a7f563d55e7f7c9dc9f8cb96644688d1a7e
4
- data.tar.gz: dfe37f6ed725f609ea1c685c85d17581a87dea40ff1bc3be7967cb15d5c81405
3
+ metadata.gz: 4564fa672731c29fe8e9dc32d2f09c56bf0b9245fce2900b4335c49442d08fb2
4
+ data.tar.gz: 58ff724cc12437d3106978913f0c2ef12a189f2e80b87ec07a2202bcd0f90267
5
5
  SHA512:
6
- metadata.gz: 24246a8ef909f298256a358e6c59778b5e9440aeb8dadfd32dbae21a079832ef3ee6e8126949803784aa2543866626ee3e71a0ee1ef5a102d725b0269aef155c
7
- data.tar.gz: 445720af7f02f9497b9baf42b2657ea4c428fd2f088d72b1db03b9679f617fc45f049ba6af22dc9e05669c41c0d262fc63d76be06df051ab7e0cbf7f79a03923
6
+ metadata.gz: e7b23097dca908102e6863d5527769bfe3d5405003cbab920da7ee6fd7f4118b554eb3d3a5f1170830dfdbf8fb08f752e6276fae4157f919f6e39ec070a91089
7
+ data.tar.gz: be8745b87907ab9ad30e9e4eb67f0ebf44ae0dcc01dcdbedefd79ab480e1222bbdc8835a397d465b5e491e995ee7ceaf685464385d7d87c0f0014900325d38ac
@@ -21,6 +21,7 @@ jobs:
21
21
  command: |
22
22
  set -e
23
23
  COMMIT_URL="https://github.com/dgroup/lazylead/commit/${CIRCLE_SHA1}"
24
+ sed -i "s/0\.0\.0/${DOCKER_RELEASE_TAGS}/g" lib/lazylead/version.rb
24
25
  docker build --build-arg release_tags="${CIRCLE_SHA1}, ${CIRCLE_BRANCH}, ${COMMIT_URL}" --build-arg version="${DOCKER_RELEASE_TAGS:7}" \
25
26
  -t dgroup/lazylead:$CIRCLE_BRANCH . \
26
27
  -f .docker/Dockerfile
@@ -40,6 +41,7 @@ jobs:
40
41
  name: "Build & push LL VCS image"
41
42
  command: |
42
43
  sed -i "s/0\.0\.0/${DOCKER_RELEASE_TAGS}/g" .docker/vcs.dockerfile
44
+ sed -i "s/0\.0\.0/${DOCKER_RELEASE_TAGS}/g" lib/lazylead/version.rb
43
45
  docker build -t dgroup/lazylead:${DOCKER_RELEASE_TAGS}-vcs . -f .docker/vcs.dockerfile
44
46
  docker push dgroup/lazylead:${DOCKER_RELEASE_TAGS}-vcs
45
47
  - run:
@@ -60,6 +60,9 @@ Available options:"
60
60
  o.string "--vcs4sql",
61
61
  "Home directory with database version control(vcs) scripts",
62
62
  default: "upgrades/sqlite"
63
+ o.integer "--max-connections",
64
+ "SQL connections pool size",
65
+ default: 5
63
66
  o.bool "--testdata",
64
67
  "Apply the database VCS migration with test data",
65
68
  default: false
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
32
32
  s.rubygems_version = "2.2"
33
33
  s.required_ruby_version = ">=2.6.5"
34
34
  s.name = "lazylead"
35
- s.version = "0.3.0"
35
+ s.version = "0.3.1"
36
36
  s.license = "MIT"
37
37
  s.summary = "Eliminate the annoying work within bug-trackers."
38
38
  s.description = "Ticketing systems (Github, Jira, etc.) are strongly
@@ -45,7 +45,7 @@ tasks instead of solving technical problems."
45
45
  s.authors = ["Yurii Dubinka"]
46
46
  s.email = "yurii.dubinka@gmail.com"
47
47
  s.homepage = "http://github.com/dgroup/lazylead"
48
- s.post_install_message = "Thanks for installing Lazylead v0.3.0!
48
+ s.post_install_message = "Thanks for installing Lazylead v0.3.1!
49
49
  Read our blog posts: https://lazylead.org
50
50
  Stay in touch with the community in Telegram: https://t.me/lazylead
51
51
  Follow us on Twitter: https://twitter.com/lazylead
@@ -37,20 +37,26 @@ module Lazylead
37
37
  # - Empty
38
38
  #
39
39
  def detect(emails, sys)
40
+ return emails if recognized?(emails)
40
41
  return PlainCC.new(emails) if plain?(emails)
41
- return EmptyCC unless emails.key? "type"
42
- return EmptyCC if emails["type"].blank? || emails["type"].nil?
42
+ return EmptyCC.new if undefined?(emails)
43
43
  type = emails["type"].constantize
44
44
  return ComponentCC.new(emails["project"], sys) if type.is_a? ComponentCC
45
45
  type.new(emails["opts"])
46
46
  end
47
47
 
48
- private
49
-
50
48
  # Detect that raw CC is a string which may has plain email addresses
51
49
  def plain?(text)
52
- (text.is_a? String) &&
53
- (text.to_s.include?(",") || text.to_s.include?("@"))
50
+ (text.is_a? String) && text.to_s.include?("@")
51
+ end
52
+
53
+ def recognized?(emails)
54
+ [EmptyCC, PlainCC, ComponentCC, PredefinedCC].member? emails.class
55
+ end
56
+
57
+ def undefined?(emails)
58
+ return true unless emails.key? "type"
59
+ emails["type"].nil? || emails["type"].blank?
54
60
  end
55
61
  end
56
62
 
@@ -48,7 +48,7 @@ module Lazylead
48
48
 
49
49
  def run(opts)
50
50
  apply_vcs_migration opts
51
- enable_active_record
51
+ enable_active_record opts
52
52
  @smtp.enable
53
53
  schedule_tasks
54
54
  end
@@ -63,10 +63,11 @@ module Lazylead
63
63
  @log.debug "Migration applied to #{@db} from #{vcs}"
64
64
  end
65
65
 
66
- def enable_active_record
66
+ def enable_active_record(opts)
67
67
  ActiveRecord::Base.establish_connection(
68
68
  adapter: "sqlite3",
69
- database: @db
69
+ database: @db,
70
+ pool: opts[:max_connections]
70
71
  )
71
72
  @log.debug "Database connection established"
72
73
  end
@@ -91,6 +91,10 @@ module Lazylead
91
91
  belongs_to :team, foreign_key: "team_id"
92
92
  belongs_to :system, foreign_key: "system"
93
93
 
94
+ # @todo #/DEV Add error handling for StandartError with support of
95
+ # verbose key from ARGV like in /bin/lazylead. That will make error
96
+ # messages more human readable. Maybe there is some integration between
97
+ # Slop and ARGV in order to avoid logic duplication.
94
98
  def exec(log = Log::NOTHING)
95
99
  log.debug("Task ##{id} '#{name}' is started")
96
100
  sys = system.connect(log)
@@ -22,7 +22,7 @@
22
22
  # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
23
23
  # OR OTHER DEALINGS IN THE SOFTWARE.
24
24
 
25
- require "json"
25
+ require "active_support"
26
26
  require "rufus-scheduler"
27
27
  require_relative "log"
28
28
  require_relative "model"
@@ -51,7 +51,9 @@ module Lazylead
51
51
  def register(task)
52
52
  raise "ll-002: task can't be a null" if task.nil?
53
53
  @trigger.cron task.cron do
54
- task.exec @log
54
+ ActiveRecord::Base.connection_pool.with_connection do
55
+ task.exec @log
56
+ end
55
57
  end
56
58
  @log.debug "Task scheduled: #{task}"
57
59
  end
@@ -34,7 +34,7 @@ module Lazylead
34
34
  @issues = issues
35
35
  end
36
36
 
37
- def issues(_, _)
37
+ def issues(*)
38
38
  @issues
39
39
  end
40
40
  end
@@ -273,7 +273,7 @@ module Lazylead
273
273
  @issues = issues
274
274
  end
275
275
 
276
- def issues(_, _)
276
+ def issues(*)
277
277
  @issues
278
278
  end
279
279
 
@@ -23,5 +23,5 @@
23
23
  # OR OTHER DEALINGS IN THE SOFTWARE.
24
24
 
25
25
  module Lazylead
26
- VERSION = "0.3.0"
26
+ VERSION = "0.3.1"
27
27
  end
data/readme.md CHANGED
@@ -19,7 +19,7 @@
19
19
  [![DevOps By Rultor.com](http://www.rultor.com/b/dgroup/lazylead)](http://www.rultor.com/p/dgroup/lazylead)
20
20
  [![EO badge](http://www.elegantobjects.org/badge.svg)](http://www.elegantobjects.org/#principles)
21
21
 
22
- ⚠️ We're still in a very early alpha version, the API may change frequently until we release version 1.0.
22
+ ⚠️ We're still in a very early alpha version, the API may change frequently until we release version `1.0`.
23
23
 
24
24
  ### Overview
25
25
  Ticketing systems (Github, Jira, etc.) are strongly integrated into our processes and everyone understands their necessity. As soon as a developer becomes a lead/technical manager, he or she faces a set of routine tasks that are related to ticketing work. On large projects this becomes a problem, more and more you spend time running around on dashboards and tickets, looking for incorrect deviations in tickets and performing routine tasks instead of solving technical problems.
@@ -61,7 +61,7 @@ Join our telegram group [lazylead.org](https://t.me/lazyleads) for discussions.
61
61
  New ideas, bugs, suggestions or questions are welcome [via GitHub issues](https://github.com/dgroup/lazylead/issues/new)!
62
62
 
63
63
  ### Get started
64
- ⚠️ We're still in a very early alpha version, the API may change frequently until we release version 1.0.
64
+ ⚠️ We're still in a very early alpha version, the API may change frequently until we release version `1.0`.
65
65
 
66
66
  Let's assume that:
67
67
  - your team is using jira as a ticketing system
@@ -29,6 +29,26 @@ require_relative "../../lib/lazylead/cc"
29
29
  require_relative "../../lib/lazylead/system/jira"
30
30
 
31
31
  module Lazylead
32
+ class CcTest < Lazylead::Test
33
+ test "plain cc detected as text" do
34
+ assert Lazylead::CC.new.plain? "a@fake.com,b@fake.com"
35
+ end
36
+ test "plain cc not found in text" do
37
+ refute Lazylead::CC.new.plain? "justatext.com,eeeee.com"
38
+ end
39
+ test "plain cc detected as object" do
40
+ assert Lazylead::CC.new.recognized? Lazylead::PlainCC.new("a@fake.com")
41
+ end
42
+ test "cc is incorrect" do
43
+ refute Lazylead::CC.new.recognized? key: "value"
44
+ end
45
+ test "cc is not found in hash" do
46
+ assert Lazylead::CC.new.undefined? key: "value"
47
+ end
48
+ test "cc type is blank" do
49
+ assert Lazylead::CC.new.undefined? "type" => " "
50
+ end
51
+ end
32
52
  class PlainCcTest < Lazylead::Test
33
53
  test "cc has valid email" do
34
54
  assert_equal "a@fake.com", Lazylead::PlainCC.new("a@fake.com").cc.first
@@ -119,7 +119,7 @@ module Lazylead
119
119
  .first.cc
120
120
  end
121
121
 
122
- test "reporter got alert about his/her tickets with expired due dates" do
122
+ test "reporter got alert about his/her tickets with expired DD" do
123
123
  Smtp.new.enable
124
124
  Task::ReporterAlert.new.run(
125
125
  NoAuthJira.new("https://jira.spring.io"),
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lazylead
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yurii Dubinka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-12 00:00:00.000000000 Z
11
+ date: 2020-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -622,7 +622,6 @@ files:
622
622
  - test/lazylead/version_test.rb
623
623
  - test/sqlite_test.rb
624
624
  - test/test.rb
625
- - todo.yml
626
625
  - upgrades/sqlite/001-install-main-lazylead-tables.sql
627
626
  - upgrades/sqlite/999.testdata.sql
628
627
  homepage: http://github.com/dgroup/lazylead
@@ -630,7 +629,7 @@ licenses:
630
629
  - MIT
631
630
  metadata: {}
632
631
  post_install_message: |-
633
- Thanks for installing Lazylead v0.3.0!
632
+ Thanks for installing Lazylead v0.3.1!
634
633
  Read our blog posts: https://lazylead.org
635
634
  Stay in touch with the community in Telegram: https://t.me/lazylead
636
635
  Follow us on Twitter: https://twitter.com/lazylead
data/todo.yml DELETED
@@ -1,6 +0,0 @@
1
- # @todo #/DEV Enable Travis CI as second CI server once the project
2
- # became a public. This might be alternative for Circle CI (just in case)
3
-
4
- # @todo #/DEV Add Github integration for lazylead with the same methods as in Jira.
5
-
6
- # @todo #/DEV Add Trello integration for lazylead with the same methods as in Jira.