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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e065eb49b0187dd348830f1c73a3f0548e7a2906
4
- data.tar.gz: ff1f53897bb4911be878785dbdc2d954abec5596
3
+ metadata.gz: 1a4dedeb8b780ba10d0d0b0aaec15408778b6ff7
4
+ data.tar.gz: 29cec35036d341b5e8a517cfcc478ca2d59faa92
5
5
  SHA512:
6
- metadata.gz: 686a4114820035ef6a59ca866811ab93ce4f3ed72d1206f08c3c3213dd7c77d03e6b5d3175d39ddef57878729472443f93b4e405e94d372859955de56c03e939
7
- data.tar.gz: 3e02401f1c62c5613d8faf0f9af2685a59f49d25b7be35f28bc89e3e351fcc45f97396182b829832f1339626820f84626b7e63905c3c753f54853e3c40b85ea1
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 a dictionary (hash) of
16
- team names (backup directories) and associated tokens.
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
- some-team: xxxp-some-token
25
- another-team: xxxp-different-token
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
- "some-team": "xxxp-some-token",
33
- "another-team": "xxxp-different-token"
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.
@@ -20,15 +20,15 @@ class Slackup
20
20
 
21
21
  SEMAPHORE = Mutex.new
22
22
 
23
- def self.team_token_pairs_file
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.team_token_pairs
28
- if team_token_pairs_file.readable?
29
- YAML.load(team_token_pairs_file.read)
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 token pairs file found. See README for instructions."
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(team_token_pairs = team_token_pairs())
47
- team_token_pairs.each do |name, token|
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
@@ -1,3 +1,3 @@
1
1
  class Slackup
2
- VERSION = "0.0.7"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slackup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Fleischer