slackup 0.0.7 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -11
- data/lib/slackup.rb +9 -7
- data/lib/slackup/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a4dedeb8b780ba10d0d0b0aaec15408778b6ff7
|
4
|
+
data.tar.gz: 29cec35036d341b5e8a517cfcc478ca2d59faa92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 678224011c1df666ba67826313c457fd471b2bdc4691fcc495984f8eea78990283adee62d881f1424beec509958169c4747b0bfbff429e88323d075900698b8d
|
7
|
+
data.tar.gz: f4ced7657011c11dd89310e719d8cd5c40773f846c0a0d969ce9689eb4228cdf4b226a380c5b8908f44fc4d1cad8a8694a4f9fb4da50e07d568d9be9a910f178
|
data/README.md
CHANGED
@@ -12,8 +12,14 @@ backup my slacks
|
|
12
12
|
2. Configure a file in the backup directory called `slack_teams.yml`,
|
13
13
|
though `slack_teams.yaml` and `slack_teams.json` will also work.
|
14
14
|
|
15
|
-
The config file must contain
|
16
|
-
team
|
15
|
+
The config file must contain an array (list) of team configurations,
|
16
|
+
where each team config is a dictionary (hash) as below:
|
17
|
+
|
18
|
+
| config | description |
|
19
|
+
|--------|-------|
|
20
|
+
| name (required) | the team name. e.g. `some-team` in `some-team.slackup.com`. Is used as backup directory name for the team.
|
21
|
+
| nickname (optional) | a nickname. When present, overrides `name` as the backup directory name for the team.
|
22
|
+
| token (required) | https://api.slack.com/custom-integrations/legacy-tokens
|
17
23
|
|
18
24
|
e.g.
|
19
25
|
|
@@ -21,24 +27,31 @@ slack_teams.yml
|
|
21
27
|
|
22
28
|
```yaml
|
23
29
|
---
|
24
|
-
|
25
|
-
|
30
|
+
- name: some-team
|
31
|
+
token: xxxp-some-token
|
32
|
+
- name: another-team
|
33
|
+
nickname: ateam
|
34
|
+
token: xxxp-different-token
|
26
35
|
```
|
27
36
|
|
28
37
|
slack_teams.json
|
29
38
|
|
30
39
|
```json
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
40
|
+
[
|
41
|
+
{
|
42
|
+
"name": "some-time",
|
43
|
+
"token": "xxxp-some-token"
|
44
|
+
},
|
45
|
+
{
|
46
|
+
"name": "another-team",
|
47
|
+
"nickname": "ateam",
|
48
|
+
"token": "xxxp-different-token"
|
49
|
+
}
|
50
|
+
]
|
35
51
|
```
|
36
52
|
|
37
53
|
3. Run `slackup` in your terminal
|
38
54
|
|
39
|
-
Each key/value team pair will be run in a local directory named by the key
|
40
|
-
using only the token for auth. Thus, the key (team) name can be whatever you want.
|
41
|
-
|
42
55
|
## Development
|
43
56
|
|
44
57
|
This gem is does the bare basics of backup and works for me.
|
data/lib/slackup.rb
CHANGED
@@ -20,15 +20,15 @@ class Slackup
|
|
20
20
|
|
21
21
|
SEMAPHORE = Mutex.new
|
22
22
|
|
23
|
-
def self.
|
23
|
+
def self.team_config_file
|
24
24
|
Pathname.glob(run_root.join("slack_teams.{json,yml,yaml}")).first
|
25
25
|
end
|
26
26
|
|
27
|
-
def self.
|
28
|
-
if
|
29
|
-
YAML.load(
|
27
|
+
def self.team_config
|
28
|
+
if team_config_file.readable?
|
29
|
+
YAML.load(team_config_file.read)
|
30
30
|
else
|
31
|
-
fail Error, "No team
|
31
|
+
fail Error, "No team config file found. See README for instructions."
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -43,9 +43,11 @@ class Slackup
|
|
43
43
|
client
|
44
44
|
end
|
45
45
|
|
46
|
-
def self.backup(
|
47
|
-
|
46
|
+
def self.backup(team_config = team_config())
|
47
|
+
team_config.each do |config|
|
48
48
|
fork do
|
49
|
+
name = config.fetch("nickname") { config.fetch("name") }
|
50
|
+
token = config.fetch("token")
|
49
51
|
client = configure_client(token)
|
50
52
|
new(name, client).execute
|
51
53
|
end
|
data/lib/slackup/version.rb
CHANGED