emoji_sub 0.1.0 → 0.2.0

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
  SHA256:
3
- metadata.gz: a1f89458d20fe54dd6b7b2a20840cec05f7d4584eae58c0756c0a8c78f116b9d
4
- data.tar.gz: 83490523c30b2dfe4afdd6c36822bdf468e9b510efd9dc0c976c7167c71dfeca
3
+ metadata.gz: 7de8cfebd03d2b8fcb5200d0d22d7ba24da54cdb1a718cf5fe101ba40a5671ea
4
+ data.tar.gz: f2069d0428b38d59ddd9a05d5ae597472c31dcdd3a7572a4886c35e6aadae430
5
5
  SHA512:
6
- metadata.gz: d6b6501f9b5c4ceb2b77a9f73d2b53f18450c4e063e5e2b44cc27e69db4aeeeff336579af21b202bfd2560e7e6cb40f7f48fac6009ef19abc54b07cf1330dc82
7
- data.tar.gz: 44b10917c640e016c165fb87370a64d399207770ebd7e19d22dc1270aa61cdce63ba222e301a5b2fc866bf7d8cffabec6bf458027934f6c2714f0c9b7a884a87
6
+ metadata.gz: deeeb7b86c4eacf419a72ecf7594cc377fe0dce08206946b698951264363b6f8166d8a21facba636b0d975ab552303d31ca3dca371f3112e27a8141354cd3462
7
+ data.tar.gz: 1be05961c5b9bed283a36b149a9bf92dfbd54ba7000ca5333d4b2b6d3e2c38cef07f86ad0ada0b2b9a1c82d9a400fb8c314ef2173cae2b11fac26cd861caf780
@@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.2.0] - 2020-08-22
8
+
9
+ Last night I wrote a script to scrape down all the emoji definitions w/ shortcodes from emojipedia. I refined it, added specs, and created a rake task for it.
10
+
11
+ ### Added
12
+
13
+ - `EmojiScrapr` (available for development use only)
14
+ - specs
15
+
7
16
  ## [0.1.0] - 2020-08-21
8
17
 
9
18
  This is the first release. The goal is to get a method that works for substitution of
@@ -15,4 +24,5 @@ emoji HTML entities (hex-unicode) for slack shortcut format (:this_kind:)
15
24
  - data/emoji.yml file,
16
25
  - Specs covering basic funcitonality
17
26
 
18
- [0.1.0]: https://github.com/olivierlacan/keep-a-changelog/releases/tag/v0.1.0
27
+ [0.2.0]: https://github.com/armahillo/emoji_sub/compare/v0.1.0...v0.2.0
28
+ [0.1.0]: https://github.com/armahillo/emoji_sub/releases/tag/v0.1.0
data/Gemfile CHANGED
@@ -5,3 +5,9 @@ gemspec
5
5
 
6
6
  gem "rake", "~> 12.0"
7
7
  gem "rspec", "~> 3.0"
8
+
9
+ # For EmojiScrapr
10
+ gem 'mechanize'
11
+
12
+ # For testing with mechanize. The @chrisk fork updates it
13
+ gem 'fakeweb', git: 'https://github.com/chrisk/fakeweb.git'
@@ -1,12 +1,42 @@
1
+ GIT
2
+ remote: https://github.com/chrisk/fakeweb.git
3
+ revision: 2b08c1ff2714ec13a12f3497d67fcefce95c2cbe
4
+ specs:
5
+ fakeweb (1.3.0)
6
+
1
7
  PATH
2
8
  remote: .
3
9
  specs:
4
- emoji_sub (0.1.0)
10
+ emoji_sub (0.2.0)
5
11
 
6
12
  GEM
7
13
  remote: https://rubygems.org/
8
14
  specs:
15
+ connection_pool (2.2.3)
9
16
  diff-lcs (1.4.4)
17
+ domain_name (0.5.20190701)
18
+ unf (>= 0.0.5, < 1.0.0)
19
+ http-cookie (1.0.3)
20
+ domain_name (~> 0.5)
21
+ mechanize (2.7.6)
22
+ domain_name (~> 0.5, >= 0.5.1)
23
+ http-cookie (~> 1.0)
24
+ mime-types (>= 1.17.2)
25
+ net-http-digest_auth (~> 1.1, >= 1.1.1)
26
+ net-http-persistent (>= 2.5.2)
27
+ nokogiri (~> 1.6)
28
+ ntlm-http (~> 0.1, >= 0.1.1)
29
+ webrobots (>= 0.0.9, < 0.2)
30
+ mime-types (3.3.1)
31
+ mime-types-data (~> 3.2015)
32
+ mime-types-data (3.2020.0512)
33
+ mini_portile2 (2.4.0)
34
+ net-http-digest_auth (1.4.1)
35
+ net-http-persistent (4.0.0)
36
+ connection_pool (~> 2.2)
37
+ nokogiri (1.10.10)
38
+ mini_portile2 (~> 2.4.0)
39
+ ntlm-http (0.1.1)
10
40
  rake (12.3.3)
11
41
  rspec (3.9.0)
12
42
  rspec-core (~> 3.9.0)
@@ -21,12 +51,18 @@ GEM
21
51
  diff-lcs (>= 1.2.0, < 2.0)
22
52
  rspec-support (~> 3.9.0)
23
53
  rspec-support (3.9.3)
54
+ unf (0.1.4)
55
+ unf_ext
56
+ unf_ext (0.0.7.7)
57
+ webrobots (0.1.2)
24
58
 
25
59
  PLATFORMS
26
60
  ruby
27
61
 
28
62
  DEPENDENCIES
29
63
  emoji_sub!
64
+ fakeweb!
65
+ mechanize
30
66
  rake (~> 12.0)
31
67
  rspec (~> 3.0)
32
68
 
data/Rakefile CHANGED
@@ -4,3 +4,31 @@ require "rspec/core/rake_task"
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
6
  task :default => :spec
7
+
8
+ namespace :scrape do
9
+
10
+ desc "Pull down all emoji into YML files (long execution: 3-4 hours)"
11
+ task :all do
12
+ require 'development/emoji_scrapr'
13
+ destination_dir = '/tmp/'
14
+ scrapr = EmojiScrapr.new
15
+ duration = scrapr.scrape_all
16
+ ensure
17
+ puts "Done! #{duration} secs"
18
+ puts "Saved to: " + scrapr.save
19
+ end
20
+
21
+ def harvest(destination = DUMP_PATH)
22
+ @categories.each do |section, url|
23
+ @all_emoji[section] = collect_emoji_list(url)
24
+ dump_to_yaml(section + '_urls', scrapr.all_emoji.fetch(section,[]))
25
+ collect_all_emoji(section)
26
+ dump_to_yaml(section, scrapr.all_emoji.fetch(section,[]))
27
+ end
28
+ end
29
+
30
+ def collect_all_emoji(section , delay = 2)
31
+
32
+ scrape_all_emoji_in_category(@all_emoji[section], delay)
33
+ end
34
+ end
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  # Specify which files should be added to the gem when it is released.
20
20
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
21
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
22
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec|lib\/development)/}) }
23
23
  end
24
24
  spec.bindir = "exe"
25
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
@@ -1,5 +1,5 @@
1
1
  require "emoji_sub/version"
2
- require 'YAML'
2
+ require 'yaml'
3
3
 
4
4
  module EmojiSub
5
5
  EMOJI_MAPPING_YAML = "data/emoji.yaml"
@@ -1,3 +1,3 @@
1
1
  module EmojiSub
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emoji_sub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Hill