Browse Source

s/emojis/emoji

master
Dylan Baker 4 years ago
parent
commit
3619359aac

+ 1
- 1
lib/slack_mattermost_emoji/mattermost_client.rb View File

8
       @username = username
8
       @username = username
9
       @password = password
9
       @password = password
10
       @domain = domain
10
       @domain = domain
11
-      @emoji_path = File.expand_path(emoji_path || './slack-emojis')
11
+      @emoji_path = File.expand_path(emoji_path || './slack-emoji')
12
       @user_id = nil
12
       @user_id = nil
13
       @token = nil
13
       @token = nil
14
       @log = log
14
       @log = log

+ 4
- 4
lib/slack_mattermost_emoji/slack_client.rb View File

8
       @username = username
8
       @username = username
9
       @password = password
9
       @password = password
10
       @domain = domain
10
       @domain = domain
11
-      @download_path = File.expand_path(download_path || './slack-emojis')
11
+      @download_path = File.expand_path(download_path || './slack-emoji')
12
       @log = log
12
       @log = log
13
       @authenticated = false
13
       @authenticated = false
14
 
14
 
42
       @authenticated = true
42
       @authenticated = true
43
     end
43
     end
44
 
44
 
45
-    def download_emojis
46
-      print "Finding emojis... " if @log
45
+    def download_emoji
46
+      print "Finding emoji... " if @log
47
 
47
 
48
       token = @driver.execute_script(<<~JS)
48
       token = @driver.execute_script(<<~JS)
49
         const config = JSON.parse(window.localStorage.localConfig_v2);
49
         const config = JSON.parse(window.localStorage.localConfig_v2);
62
       emoji_count = data['emoji'].size
62
       emoji_count = data['emoji'].size
63
       digits = emoji_count.to_s.size
63
       digits = emoji_count.to_s.size
64
 
64
 
65
-      puts "found #{emoji_count} emojis" if @log
65
+      puts "found #{emoji_count} emoji" if @log
66
 
66
 
67
       data['emoji'].each_with_index do |emoji, index|
67
       data['emoji'].each_with_index do |emoji, index|
68
         next if URI(image_url).scheme == 'alias'
68
         next if URI(image_url).scheme == 'alias'

+ 1
- 1
slack_mattermost_emoji.gemspec View File

6
   spec.authors       = ["Dylan Baker"]
6
   spec.authors       = ["Dylan Baker"]
7
   spec.email         = ["dylan@simulacrum.party"]
7
   spec.email         = ["dylan@simulacrum.party"]
8
 
8
 
9
-  spec.summary       = %q{A tool for importing custom emojis from Slack into Mattermost}
9
+  spec.summary       = %q{A tool for importing custom emoji from Slack into Mattermost}
10
   spec.homepage      = "TODO: Put your gem's website or public repo URL here."
10
   spec.homepage      = "TODO: Put your gem's website or public repo URL here."
11
   spec.homepage      = "https://git.simulacrum.party/simulacrumparty/slack_mattermost_emoji"
11
   spec.homepage      = "https://git.simulacrum.party/simulacrumparty/slack_mattermost_emoji"
12
   spec.license       = "MIT"
12
   spec.license       = "MIT"

+ 1
- 1
spec/mattermost_client_spec.rb View File

32
     expect { client.authenticate }.to raise_error('Invalid Mattermost credentials')
32
     expect { client.authenticate }.to raise_error('Invalid Mattermost credentials')
33
   end
33
   end
34
 
34
 
35
-  it 'should upload emojis to mattermost' do
35
+  it 'should upload emoji to mattermost' do
36
     client = SlackMattermostEmoji::MattermostClient.new(
36
     client = SlackMattermostEmoji::MattermostClient.new(
37
       username: ENV['MATTERMOST_USERNAME'],
37
       username: ENV['MATTERMOST_USERNAME'],
38
       password: ENV['MATTERMOST_PASSWORD'],
38
       password: ENV['MATTERMOST_PASSWORD'],

+ 3
- 3
spec/slack_client_spec.rb View File

34
     expect { client.authenticate }.to raise_error('Invalid Slack credentials')
34
     expect { client.authenticate }.to raise_error('Invalid Slack credentials')
35
   end
35
   end
36
 
36
 
37
-  it 'should download emojis from slack' do
37
+  it 'should download emoji from slack' do
38
     download_path = File.expand_path('~/Desktop/slack-emoji')
38
     download_path = File.expand_path('~/Desktop/slack-emoji')
39
     FileUtils.rm_rf(download_path) if Dir.exist?(download_path)
39
     FileUtils.rm_rf(download_path) if Dir.exist?(download_path)
40
 
40
 
47
     )
47
     )
48
     client.authenticate
48
     client.authenticate
49
 
49
 
50
-    emojis = client.download_emojis
51
-    emojis.each do |name, image_url|
50
+    emoji = client.download_emoji
51
+    emoji.each do |name, image_url|
52
       next if URI(image_url).scheme == 'alias'
52
       next if URI(image_url).scheme == 'alias'
53
 
53
 
54
       extension = File.extname(image_url)
54
       extension = File.extname(image_url)

Loading…
Cancel
Save