robit 1.0.5 → 1.0.6

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
  SHA1:
3
- metadata.gz: a0018e1ac3e0a77279b37a8d0ada8e4402d0d745
4
- data.tar.gz: 443cb2c0c9786ee2482b699a3ae64930d33b2ec5
3
+ metadata.gz: 9b702f7fa566c81565dd9c50315a8f161c40d58c
4
+ data.tar.gz: 6cac2646b5cf23bde7311d601d29756e2bdf45a7
5
5
  SHA512:
6
- metadata.gz: f83316c89feae1f27acb9b3e231fff73f9422fe4da80b2f8f5a22d4aeb88ac931a3374d4b1fc1d077a135328b52f9b80749d5af0a76e0909ff847182f2f9993b
7
- data.tar.gz: 1ec3f23c331b5a31c590f6b2295a589f072c688ffb96db855fd9864e0dbc87dd250275bc290322dab729b1f404095739a59e2c02b70401393ae787e1994e3e1d
6
+ metadata.gz: 0449177e28d85571c163d5be9194d9bed9a250502b982612614217930d5a23edb529395e3931c20190b1bbc64e3aaa16b7e390c0dcd4890dcf731783f5a7bf6e
7
+ data.tar.gz: c2c9947dee3665287cc8021b88c9d348b89d684244e5942a10a58ebc5ae47405922c144e7a024c5927f4d2ece8507fbdba708573588afcd5fd566d4d3965a77e
data/.gitignore CHANGED
@@ -6,6 +6,8 @@
6
6
  *.pid
7
7
  *.swp
8
8
  *.yml
9
+ *.json
10
+ *.lock
9
11
  .DS_Store
10
12
  .robit
11
13
  .robut_store
@@ -14,4 +16,5 @@
14
16
  Gemfile.lock
15
17
  doc
16
18
  pkg
17
- config.json
19
+ config.json
20
+ artifacts
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.5
1
+ 1.0.6
@@ -8,7 +8,7 @@ class String
8
8
  # Test => test
9
9
  # OpsOnly => ops_only
10
10
  def downcase_and_snakify
11
- self.gsub(/\s+/,'').gsub(/([A-Z])/, '_\1').delete('@').sub(/^_/, '').downcase
11
+ self.gsub(/\s+/,'').gsub(/([A-Z])/, '_\1').gsub('-','_').delete('@').sub(/^_/, '').downcase
12
12
  end
13
13
  end
14
14
 
@@ -71,20 +71,21 @@ private
71
71
  from.inspect, mentions.inspect, message.inspect
72
72
  ]
73
73
 
74
+ return if from.include? reply_to.connection.config.nick # self
75
+
74
76
  tos = mentions.select { |m| db.keys.include? m }
75
77
 
76
78
 
77
79
  tos.each do |to|
78
80
  rooms = db[to]
79
81
 
82
+ rroom, hroom = nil, nil
80
83
  rooms.each do |name|
81
- rroom, hroom = nil, nil
82
-
83
84
  if name =~ /^@/
84
- rroom = robut_room name
85
- raise if rroom.nil?
86
- hroom = hipchat_room rroom.name
87
- raise if hroom.nil?
85
+ rroom = robut_room name unless rroom
86
+ next if rroom.nil?
87
+ hroom = hipchat_room rroom.name unless hroom
88
+ next if hroom.nil?
88
89
  end
89
90
 
90
91
  subject = '%s mentioned "%s" in "%s"' % [
@@ -102,7 +103,13 @@ private
102
103
  end
103
104
  end
104
105
 
105
- reply "Notified #{to_sentence rooms}." unless rooms.empty?
106
+ if rroom.nil?
107
+ reply "Sorry, I'm having trouble accessing the HipChat room..."
108
+ elsif rooms.empty?
109
+ reply "Sorry, I'm having trouble accessing HipChat rooms..."
110
+ else
111
+ reply "Notified #{to_sentence rooms}."
112
+ end
106
113
  end
107
114
  end
108
115
 
@@ -173,7 +180,8 @@ private
173
180
 
174
181
  def robut_room name
175
182
  robut_room = reply_to.connection.rooms.select do |r|
176
- r.name =~ /^\d+_#{name.downcase_and_snakify}@/
183
+ room_name = r.name.gsub('-','_')
184
+ room_name =~ /^\d+_#{name.downcase_and_snakify}@/
177
185
  end.shift
178
186
  end
179
187
 
@@ -1,10 +1,9 @@
1
1
  FROM sczizzo/trusty-tool:latest
2
2
  MAINTAINER Sean Clemmer <sczizzo@gmail.com>
3
+ ENV DEBIAN_FRONTEND=noninteractive
3
4
 
4
5
  COPY . /build
5
6
 
6
- RUN cd /build \
7
- && /build/tasks/package/_package.sh \
8
- && rm -rf /build /tmp/* /var/lib/apt/lists/*
7
+ RUN cd /build && /build/tasks/package/_package.sh /artifacts
9
8
 
10
9
  VOLUME /artifacts
@@ -2,13 +2,19 @@
2
2
  set -x
3
3
  set -e
4
4
 
5
+ ARTIFACTS="${1:-artifacts}"
6
+
5
7
  ruby=ruby2.2
6
8
  version=$(cat VERSION)
7
9
 
10
+ rm -rf doc
8
11
  rm -rf etc
9
12
  rm -rf tmp
10
13
  rm -rf .bundle
11
14
  rm -rf .vagrant
15
+ rm -rf vendor
16
+ rm -rf pkg
17
+ mkdir -p pkg
12
18
 
13
19
  bundle update
14
20
  bundle package --all --all-platforms
@@ -25,8 +31,7 @@ bundle exec fpm -n robit \
25
31
  # gem uninstall -aIx
26
32
  # dpkg -i *.deb
27
33
  # ls -la /opt/robit
28
- # robit art
29
- # robit version
34
+ # robit --help
30
35
 
31
- mkdir -p /artifacts
32
- mv *.deb /artifacts
36
+ mkdir -p $ARTIFACTS
37
+ mv *.deb $ARTIFACTS
data/tasks/package/run.sh CHANGED
@@ -2,20 +2,22 @@
2
2
  set -x
3
3
  set -e
4
4
 
5
- project=$(basename `pwd`)
5
+ project="$(basename `pwd`)"
6
6
  artifacts="${1:-tasks/package/artifacts}"
7
7
  dockerfile="${2:-tasks/package/Dockerfile}"
8
8
  task_name="${3:-$project-package-$(date +%s)}"
9
+ base_image="$(grep '^FROM' "$dockerfile" | awk '{ print $2 }')"
9
10
 
10
11
  cleanup() {
11
12
  docker stop "$task_name"
12
13
  docker rm "$task_name"
14
+ docker rmi "$task_name"
13
15
  }
14
16
 
15
17
  trap cleanup EXIT
16
18
 
17
19
  rm -rf "$artifacts"
18
- docker pull sczizzo/trusty-tool:latest
20
+ docker pull "$base_image"
19
21
  docker build -t "$task_name" -f "$dockerfile" .
20
22
  docker run --name "$task_name" -dt "$task_name"
21
23
  docker cp "$task_name":/artifacts "$artifacts"
@@ -1,5 +1,6 @@
1
1
  FROM sczizzo/trusty-tool:latest
2
2
  MAINTAINER Sean Clemmer <sczizzo@gmail.com>
3
+ ENV DEBIAN_FRONTEND=noninteractive
3
4
 
4
5
  COPY . /build
5
6
 
data/tasks/test/run.sh CHANGED
@@ -5,6 +5,8 @@ set -e
5
5
  project=$(basename `pwd`)
6
6
  dockerfile="${1:-tasks/test/Dockerfile}"
7
7
  task_name="${2:-$project-test-$(date +%s)}"
8
+ base_image="$(grep '^FROM' "$dockerfile" | awk '{ print $2 }')"
8
9
 
9
- docker pull sczizzo/trusty-tool:latest
10
+ docker pull "$base_image"
10
11
  docker build -t "$task_name" -f "$dockerfile" .
12
+ docker rmi "$task_name"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: robit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Clemmer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-12 00:00:00.000000000 Z
11
+ date: 2016-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: twss-classifier
@@ -147,7 +147,6 @@ files:
147
147
  - ".robit.nick.yml"
148
148
  - ".ruby-version"
149
149
  - Gemfile
150
- - Gemfile.lock
151
150
  - Rakefile
152
151
  - Readme.md
153
152
  - VERSION
@@ -159,7 +158,6 @@ files:
159
158
  - robit.gemspec
160
159
  - tasks/package/Dockerfile
161
160
  - tasks/package/_package.sh
162
- - tasks/package/artifacts/robit_1.0.4_amd64.deb
163
161
  - tasks/package/post-install.sh
164
162
  - tasks/package/robit.sh
165
163
  - tasks/package/run.sh
data/Gemfile.lock DELETED
@@ -1,93 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- robit (1.0.5)
5
- awesome_print (~> 1)
6
- calc (~> 1)
7
- daybreak (~> 0)
8
- hipchat (~> 1)
9
- nokogiri (~> 1.5)
10
- rubypress (~> 1)
11
- sclemmer-robut (~> 0.6.3)
12
- trollop (~> 2)
13
- twss-classifier (~> 0)
14
-
15
- GEM
16
- remote: https://rubygems.org/
17
- specs:
18
- arr-pm (0.0.10)
19
- cabin (> 0)
20
- awesome_print (1.6.1)
21
- backports (3.6.8)
22
- cabin (0.8.1)
23
- calc (1.0.0)
24
- childprocess (0.5.9)
25
- ffi (~> 1.0, >= 1.0.11)
26
- clamp (0.6.5)
27
- coderay (1.1.0)
28
- daybreak (0.3.0)
29
- ffi (1.9.10)
30
- fpm (1.4.0)
31
- arr-pm (~> 0.0.10)
32
- backports (>= 2.6.2)
33
- cabin (>= 0.6.0)
34
- childprocess
35
- clamp (~> 0.6)
36
- ffi
37
- json (>= 1.7.7)
38
- hipchat (1.5.2)
39
- httparty
40
- mimemagic
41
- httparty (0.13.7)
42
- json (~> 1.8)
43
- multi_xml (>= 0.5.2)
44
- json (1.8.3)
45
- method_source (0.8.2)
46
- mimemagic (0.3.1)
47
- mini_portile2 (2.0.0)
48
- minitest (5.8.4)
49
- multi_xml (0.5.5)
50
- nokogiri (1.6.7.2)
51
- mini_portile2 (~> 2.0.0.rc2)
52
- pry (0.10.3)
53
- coderay (~> 1.1.0)
54
- method_source (~> 0.8.1)
55
- slop (~> 3.4)
56
- rack (1.6.4)
57
- rack-protection (1.5.3)
58
- rack
59
- rake (10.5.0)
60
- retryable-rb (1.1.0)
61
- rubygems-tasks (0.2.4)
62
- rubypress (1.2.0)
63
- retryable-rb
64
- sclemmer-robut (0.6.3)
65
- sinatra (~> 1.3)
66
- xmpp4r (~> 0.5.6)
67
- sinatra (1.4.7)
68
- rack (~> 1.5)
69
- rack-protection (~> 1.4)
70
- tilt (>= 1.3, < 3)
71
- slop (3.6.0)
72
- tilt (2.0.2)
73
- trollop (2.1.2)
74
- twss-classifier (0.0.1)
75
- version (1.0.0)
76
- xmpp4r (0.5.6)
77
- yard (0.8.7.6)
78
-
79
- PLATFORMS
80
- ruby
81
-
82
- DEPENDENCIES
83
- fpm
84
- minitest
85
- pry
86
- rake
87
- robit!
88
- rubygems-tasks
89
- version
90
- yard
91
-
92
- BUNDLED WITH
93
- 1.11.2