octospy 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66a3c3615824ecfbdef2e8a16a9f3e635176583b
4
- data.tar.gz: 98a7bc1a73bcc382107a29d8832bf71228ec3fca
3
+ metadata.gz: c874824f5ed9d1cbfc20596aeac3b6beac49e824
4
+ data.tar.gz: 93e9b711dbf83baa39b9a92e951ed172cc5b5a92
5
5
  SHA512:
6
- metadata.gz: e08504e4ee353010971d1ecae483b1cccf477ce6dea702d32442d9393eafef8cbbd5b5fe240f57e0b8e85bf227b2aeda1c69a9e82fa79c1807e12c44907fca19
7
- data.tar.gz: 3c964b19e168d43521c57778aa86708ba6a4f88f0324d8bd1bde0285ac3a9a388259a21d1ed3a834e47b28c03649ae51da9a7d132905c4b859996c44acb5971e
6
+ metadata.gz: fdad245ae5c213b971a6dc65a89479a3f1f7546c89aa39f9cf7d7ae38ef13ace811e837d0c13b427536ad87e3d6c7f3d5b48c890928328c4417ff06ff84f67dc
7
+ data.tar.gz: c64fad9937309ea56a26f10b1bc7ff9d3f8d6aff3fbb39f2d80cbd7f92a50bd47d5949b8e1f40654bd8e1efdb31c1069d1044a75d253f5339e187fac4af3b6b2
data/README.md CHANGED
@@ -45,7 +45,7 @@ Usage
45
45
  -----
46
46
 
47
47
  ```sh
48
- $ cp .emv.example .env
48
+ $ cp .env.example .env
49
49
  ```
50
50
 
51
51
  edit `.env`:
@@ -21,30 +21,37 @@ module Cinch
21
21
  end
22
22
 
23
23
  def start_with_message(m)
24
+ channel = ::Octospy::Recordable.channel(m.channel.name)
25
+
26
+ if channel.nil? || channel.repos.nil? || channel.repos.empty?
27
+ m.reply 'no repository watched'
28
+ return
29
+ end
30
+
24
31
  if m.channel.job_thread_alive?
25
- m.reply 'I have already started'
32
+ m.reply 'already started'
26
33
  return
27
34
  end
28
35
 
29
36
  start(m)
30
- m.reply 'I started'
37
+ m.reply 'started'
31
38
  end
32
39
 
33
40
  def stop_with_message(m)
34
41
  unless m.channel.job_thread_alive?
35
- m.reply 'I have not started'
42
+ m.reply 'not started'
36
43
  return
37
44
  end
38
45
 
39
46
  stop(m)
40
- m.reply 'I stopped'
47
+ m.reply 'stopped'
41
48
  end
42
49
 
43
50
  def restart_with_message(m)
44
51
  if restart(m)
45
- m.reply 'I restarted'
52
+ m.reply 'restarted'
46
53
  else
47
- m.reply 'I have not started'
54
+ m.reply 'not started'
48
55
  end
49
56
  end
50
57
 
@@ -24,7 +24,7 @@ module Cinch
24
24
  ::Octospy::Recordable.channel(m.channel.name).add_repo(repo)
25
25
 
26
26
  restart(m)
27
- m.reply "I started to watch the #{repo} events"
27
+ m.reply "started to watch the #{repo} events"
28
28
  end
29
29
 
30
30
  def watch_repositories(m, owner)
@@ -43,7 +43,7 @@ module Cinch
43
43
  }
44
44
 
45
45
  if repos.count > 0
46
- m.reply "I started to watch events of #{repos.count} repositories"
46
+ m.reply "started to watch events of #{repos.count} repositories"
47
47
  restart(m)
48
48
  end
49
49
  end
@@ -52,14 +52,14 @@ module Cinch
52
52
  repo = "#{owner}/#{project}"
53
53
 
54
54
  unless ::Octokit.repository?(repo)
55
- m.reply "Sorry, '#{repo}' not found"
55
+ m.reply "sorry, '#{repo}' not found"
56
56
  return
57
57
  end
58
58
 
59
59
  ::Octospy::Recordable.channel(m.channel.name).remove_repo(repo)
60
60
 
61
61
  restart(m)
62
- m.reply "I stopped to watch the #{repo} events"
62
+ m.reply "stopped to watch the #{repo} events"
63
63
  end
64
64
 
65
65
  def unwatch_repositories(m, owner)
@@ -81,13 +81,14 @@ module Cinch
81
81
  end
82
82
 
83
83
  def unwatch_all(m)
84
+ ::Octospy::Recordable.remove_channel(m.channel.name)
84
85
  end
85
86
 
86
87
  def show_watched_repositories(m)
87
88
  channel = ::Octospy::Recordable.channel(m.channel.name)
88
89
 
89
90
  if channel.nil? || channel.repos.nil? || channel.repos.empty?
90
- m.reply 'nothing!'
91
+ m.reply 'nothing'
91
92
  return
92
93
  end
93
94
 
@@ -45,7 +45,8 @@ module Octospy
45
45
  @port = ENV['PORT']
46
46
  @ssl = !!ENV['SSL']
47
47
  @password = ENV['PASSWORD']
48
- @worker_interval = ENV['WORKER_INTERVAL'] || 30 #sec
48
+ @worker_interval = ENV['WORKER_INTERVAL'] ?
49
+ ENV['WORKER_INTERVAL'].to_i : 30 #sec
49
50
  @github_login = ENV['GITHUB_LOGIN']
50
51
  @github_token = ENV['GITHUB_TOKEN']
51
52
  @channels = ENV['CHANNELS'] ?
@@ -15,7 +15,7 @@ module Octospy
15
15
  @repos << name if repos.empty? || !repos.include?(name)
16
16
  end
17
17
 
18
- def del_repo(name)
18
+ def remove_repo(name)
19
19
  @repos.delete(name.to_sym) if !repos.empty? && repos.include?(name)
20
20
  end
21
21
  end
@@ -19,7 +19,7 @@ module Octospy
19
19
  channels << Channel.new(name) unless channels_include? name
20
20
  end
21
21
 
22
- def del_channel(name)
22
+ def remove_channel(name)
23
23
  channels.delete_if { |channel| channel.name.to_s == name.to_s }
24
24
  end
25
25
 
@@ -1,3 +1,3 @@
1
1
  module Octospy
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -16,7 +16,7 @@ module Octospy
16
16
  watch_repositories
17
17
  sleep Octospy.worker_interval
18
18
  rescue => e
19
- @block.call e.message
19
+ @block.call "Octospy Error: #{e.message}"
20
20
  sleep Octospy.worker_interval
21
21
  end
22
22
  end
data/lib/octospy.rb CHANGED
@@ -52,6 +52,6 @@ module Octospy
52
52
  end
53
53
  end
54
54
 
55
- Dotenv.load
55
+ Dotenv.load ENV['DOTENV'] || '.env'
56
56
  Octospy.setup
57
57
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octospy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - linyows
@@ -324,7 +324,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
324
324
  version: '0'
325
325
  requirements: []
326
326
  rubyforge_project:
327
- rubygems_version: 2.2.0
327
+ rubygems_version: 2.2.2
328
328
  signing_key:
329
329
  specification_version: 4
330
330
  summary: Octospy notifies the repository activity to an IRC channel.