twog 0.3.5 → 0.3.6

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: 68b919f5060d59cbf20d453287f3d61838f70dfe84e83b839d5c114fe411a985
4
- data.tar.gz: 27638906b18b79a26ea1cb31522d234d87c6af689e3be3dfa72e8365fdb322c7
3
+ metadata.gz: 553b805d489c88a2ba32e4110fd7fda676310db26252ce6cfadf69aa0bec0be6
4
+ data.tar.gz: 115642dc76c809d8bd2fbc85da1f6d2eadba8e27a081806b0748676a28a2fe22
5
5
  SHA512:
6
- metadata.gz: ee3112d6823b9a5fc55af44798d55f0fa5fbabc6639f8564e14d1c5d449527b607e18c4cb5857ef5ce880ac075df01c0c12108e448b4b36e9c0f6046ee218a31
7
- data.tar.gz: e3321b87f18f9c38ad48ca08110a8e81c057229f3f79fc1cafd8f558e57fb02ac3c7b31cee82d1ebe2bf0bdaa0399022b1a1804a112c1216cd6d43b21e2844a6
6
+ metadata.gz: f9122ab0d5fcb98900e77a7ec203553a9fd6a825a76318dce5acadce62117bfbebdd65da11bd6246c16134b1b2e94801dee9015c365e64e1adaa8b1545f4e5fb
7
+ data.tar.gz: b8323633414456d36ff7a513b75a39b11e12c0ddc66769af5cf3512a473e88abd83f512ef0e0b932204b565fa14852ff70c2cddac60c4f484085a09b23b67105
@@ -0,0 +1,12 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: [jmeridth] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4
+ patreon: # Replace with a single Patreon username
5
+ open_collective: # Replace with a single Open Collective username
6
+ ko_fi: # Replace with a single Ko-fi username
7
+ tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
+ community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ liberapay: # Replace with a single Liberapay username
10
+ issuehunt: # Replace with a single IssueHunt username
11
+ otechie: # Replace with a single Otechie username
12
+ custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -3,18 +3,21 @@ name: Ruby
3
3
  on: [push]
4
4
 
5
5
  jobs:
6
- build:
6
+ test:
7
7
 
8
8
  runs-on: ubuntu-latest
9
9
 
10
+ strategy:
11
+ matrix:
12
+ ruby-version: [3.0.x, 2.7.x, 2.6.x]
13
+
10
14
  steps:
11
- - uses: actions/checkout@v1
12
- - name: Set up Ruby 2.7
15
+ - uses: actions/checkout@v2
16
+ - name: Set up Ruby ${{ matrix.ruby-version }}
13
17
  uses: actions/setup-ruby@v1
14
18
  with:
15
- ruby-version: 2.7
16
- - name: Build and test with Rspec
17
- run: |
18
- gem install bundler
19
- bundle install --jobs 4 --retry 3
20
- bundle exec rspec
19
+ ruby-version: ${{ matrix.ruby-version }}
20
+ - name: Install dependencies
21
+ run: bundle install
22
+ - name: Run tests
23
+ run: bundle exec rspec
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.1
1
+ 3.0
data/Gemfile CHANGED
@@ -1,16 +1,20 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'http://rubygems.org'
2
- ruby '2.7.1'
4
+ ruby '3.0'
3
5
 
4
- gem 'rack', '~>2.0.6'
5
- gem 'nokogiri', '>= 1.10.4'
6
- gem 'twitter_oauth', '>=0.3.3'
7
- gem 'bitly', '>=0.4.0'
8
- gem 'whenever', '>=0.4.1'
9
- gem 'activesupport', '>=2.3.5'
10
- gem 'juwelier', '>= 2.4.9'
6
+ gem 'activesupport'
7
+ gem 'bitly'
8
+ gem 'juwelier'
9
+ gem 'nokogiri'
10
+ gem 'rack'
11
+ gem 'rss'
12
+ gem 'twitter_oauth'
13
+ gem 'whenever'
11
14
 
12
15
  group :development, :test do
13
16
  gem 'rake'
14
- gem 'rspec', '>=2.0.0.beta.22'
17
+ gem 'rspec'
18
+ gem 'rubocop'
15
19
  gem 'simplecov'
16
20
  end
data/Gemfile.lock CHANGED
@@ -1,38 +1,42 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- activesupport (6.0.3.1)
4
+ activesupport (6.1.3.1)
5
5
  concurrent-ruby (~> 1.0, >= 1.0.2)
6
- i18n (>= 0.7, < 2)
7
- minitest (~> 5.1)
8
- tzinfo (~> 1.1)
9
- zeitwerk (~> 2.2, >= 2.2.2)
6
+ i18n (>= 1.6, < 2)
7
+ minitest (>= 5.1)
8
+ tzinfo (~> 2.0)
9
+ zeitwerk (~> 2.3)
10
10
  addressable (2.7.0)
11
11
  public_suffix (>= 2.0.2, < 5.0)
12
- bitly (2.0.0)
12
+ ast (2.4.2)
13
+ bitly (2.0.1)
13
14
  oauth2 (>= 0.5.0, < 2.0)
14
15
  builder (3.2.4)
15
16
  chronic (0.10.2)
16
- concurrent-ruby (1.1.6)
17
+ concurrent-ruby (1.1.8)
17
18
  descendants_tracker (0.0.4)
18
19
  thread_safe (~> 0.3, >= 0.3.1)
19
- diff-lcs (1.3)
20
- docile (1.3.2)
21
- faraday (0.9.2)
20
+ diff-lcs (1.4.4)
21
+ docile (1.3.5)
22
+ faraday (1.3.0)
23
+ faraday-net_http (~> 1.0)
22
24
  multipart-post (>= 1.2, < 3)
23
- git (1.7.0)
25
+ ruby2_keywords
26
+ faraday-net_http (1.0.1)
27
+ git (1.8.1)
24
28
  rchardet (~> 1.8)
25
- github_api (0.18.2)
29
+ github_api (0.19.0)
26
30
  addressable (~> 2.4)
27
31
  descendants_tracker (~> 0.0.4)
28
- faraday (~> 0.8)
32
+ faraday (>= 0.8, < 2)
29
33
  hashie (~> 3.5, >= 3.5.2)
30
34
  oauth2 (~> 1.0)
31
35
  hashie (3.6.0)
32
36
  highline (2.0.3)
33
- i18n (1.8.2)
37
+ i18n (1.8.9)
34
38
  concurrent-ruby (~> 1.0)
35
- json (2.3.0)
39
+ json (2.5.1)
36
40
  juwelier (2.4.9)
37
41
  builder
38
42
  bundler
@@ -45,76 +49,104 @@ GEM
45
49
  rake
46
50
  rdoc
47
51
  semver2
48
- jwt (2.2.1)
52
+ jwt (2.2.2)
49
53
  kamelcase (0.0.2)
50
54
  semver2 (~> 3)
51
- mime-types (2.99.3)
52
- mini_portile2 (2.4.0)
53
- minitest (5.14.1)
54
- multi_json (1.14.1)
55
+ mime-types (3.3.1)
56
+ mime-types-data (~> 3.2015)
57
+ mime-types-data (3.2021.0225)
58
+ minitest (5.14.4)
59
+ multi_json (1.15.0)
55
60
  multi_xml (0.6.0)
56
61
  multipart-post (2.1.1)
57
- nokogiri (1.10.9)
58
- mini_portile2 (~> 2.4.0)
59
- oauth (0.5.4)
60
- oauth2 (1.4.4)
62
+ nokogiri (1.11.2-x86_64-darwin)
63
+ racc (~> 1.4)
64
+ oauth (0.5.5)
65
+ oauth2 (1.4.7)
61
66
  faraday (>= 0.8, < 2.0)
62
67
  jwt (>= 1.0, < 3.0)
63
68
  multi_json (~> 1.3)
64
69
  multi_xml (~> 0.5)
65
70
  rack (>= 1.2, < 3)
66
- psych (3.1.0)
67
- public_suffix (4.0.5)
68
- rack (2.0.9)
69
- rake (13.0.1)
71
+ parallel (1.20.1)
72
+ parser (3.0.0.0)
73
+ ast (~> 2.4.1)
74
+ psych (3.3.1)
75
+ public_suffix (4.0.6)
76
+ racc (1.5.2)
77
+ rack (2.2.3)
78
+ rainbow (3.0.0)
79
+ rake (13.0.3)
70
80
  rchardet (1.8.0)
71
- rdoc (6.2.1)
72
- rspec (3.9.0)
73
- rspec-core (~> 3.9.0)
74
- rspec-expectations (~> 3.9.0)
75
- rspec-mocks (~> 3.9.0)
76
- rspec-core (3.9.2)
77
- rspec-support (~> 3.9.3)
78
- rspec-expectations (3.9.2)
81
+ rdoc (6.3.0)
82
+ regexp_parser (2.1.1)
83
+ rexml (3.2.4)
84
+ rspec (3.10.0)
85
+ rspec-core (~> 3.10.0)
86
+ rspec-expectations (~> 3.10.0)
87
+ rspec-mocks (~> 3.10.0)
88
+ rspec-core (3.10.1)
89
+ rspec-support (~> 3.10.0)
90
+ rspec-expectations (3.10.1)
79
91
  diff-lcs (>= 1.2.0, < 2.0)
80
- rspec-support (~> 3.9.0)
81
- rspec-mocks (3.9.1)
92
+ rspec-support (~> 3.10.0)
93
+ rspec-mocks (3.10.2)
82
94
  diff-lcs (>= 1.2.0, < 2.0)
83
- rspec-support (~> 3.9.0)
84
- rspec-support (3.9.3)
95
+ rspec-support (~> 3.10.0)
96
+ rspec-support (3.10.2)
97
+ rss (0.2.9)
98
+ rexml
99
+ rubocop (1.12.0)
100
+ parallel (~> 1.10)
101
+ parser (>= 3.0.0.0)
102
+ rainbow (>= 2.2.2, < 4.0)
103
+ regexp_parser (>= 1.8, < 3.0)
104
+ rexml
105
+ rubocop-ast (>= 1.2.0, < 2.0)
106
+ ruby-progressbar (~> 1.7)
107
+ unicode-display_width (>= 1.4.0, < 3.0)
108
+ rubocop-ast (1.4.1)
109
+ parser (>= 2.7.1.5)
110
+ ruby-progressbar (1.11.0)
111
+ ruby2_keywords (0.0.4)
85
112
  semver2 (3.4.2)
86
- simplecov (0.18.5)
113
+ simplecov (0.21.2)
87
114
  docile (~> 1.1)
88
115
  simplecov-html (~> 0.11)
89
- simplecov-html (0.12.2)
116
+ simplecov_json_formatter (~> 0.1)
117
+ simplecov-html (0.12.3)
118
+ simplecov_json_formatter (0.1.2)
90
119
  thread_safe (0.3.6)
91
120
  twitter_oauth (0.4.94)
92
121
  json (>= 1.8.0)
93
122
  mime-types (>= 1.16)
94
123
  oauth (>= 0.4.7)
95
- tzinfo (1.2.7)
96
- thread_safe (~> 0.1)
124
+ tzinfo (2.0.4)
125
+ concurrent-ruby (~> 1.0)
126
+ unicode-display_width (2.0.0)
97
127
  whenever (1.0.0)
98
128
  chronic (>= 0.6.3)
99
- zeitwerk (2.3.0)
129
+ zeitwerk (2.4.2)
100
130
 
101
131
  PLATFORMS
102
- ruby
132
+ x86_64-darwin-20
103
133
 
104
134
  DEPENDENCIES
105
- activesupport (>= 2.3.5)
106
- bitly (>= 0.4.0)
107
- juwelier (>= 2.4.9)
108
- nokogiri (>= 1.10.4)
109
- rack (~> 2.0.6)
135
+ activesupport
136
+ bitly
137
+ juwelier
138
+ nokogiri
139
+ rack
110
140
  rake
111
- rspec (>= 2.0.0.beta.22)
141
+ rspec
142
+ rss
143
+ rubocop
112
144
  simplecov
113
- twitter_oauth (>= 0.3.3)
114
- whenever (>= 0.4.1)
145
+ twitter_oauth
146
+ whenever
115
147
 
116
148
  RUBY VERSION
117
- ruby 2.7.1p83
149
+ ruby 3.0.0p0
118
150
 
119
151
  BUNDLED WITH
120
- 2.1.4
152
+ 2.2.3
data/Rakefile CHANGED
@@ -1,44 +1,45 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubygems'
2
4
  require 'rspec/core/rake_task'
3
5
  require 'rubygems/package_task'
4
-
5
- task :default => ['spec:coverage']
6
+
7
+ task default: ['spec:coverage']
6
8
 
7
9
  namespace :twog do
8
- desc "Clean out the coverage and the pkg"
10
+ desc 'Clean out the coverage and the pkg'
9
11
  task :clean do
10
12
  rm_rf 'coverage'
11
13
  rm_rf 'pkg'
12
14
  end
13
15
  end
14
16
 
15
- desc "Run all specs in spec directory"
17
+ desc 'Run all specs in spec directory'
16
18
  RSpec::Core::RakeTask.new(:spec) do |spec|
17
19
  spec.pattern = FileList['spec/**/*_spec.rb']
18
20
  spec.rspec_opts = ['--color']
19
21
  end
20
22
 
21
- namespace :spec do
22
- desc "Run coverage on the spec files"
23
+ namespace :spec do
24
+ desc 'Run coverage on the spec files'
23
25
  RSpec::Core::RakeTask.new(:coverage) do |spec|
24
26
  spec.pattern = FileList['spec/**/*_spec.rb']
25
27
  spec.rspec_opts = ['--color']
26
- ENV['COVERAGE'] = "true"
28
+ ENV['COVERAGE'] = 'true'
27
29
  end
28
30
  end
29
31
 
30
32
  begin
31
33
  require 'juwelier'
32
34
  Juwelier::Tasks.new do |s|
33
- s.name = "twog"
34
- s.summary = %Q{Tool to tweet blog posts}
35
- s.email = ["jmeridth@gmail.com"]
36
- s.homepage = "http://github.com/jmeridth/twog"
37
- s.description = "Tool to tweet blog posts"
38
- s.authors = ["Jason Meridth"]
35
+ s.name = 'twog'
36
+ s.summary = %(Tool to tweet blog posts)
37
+ s.email = ['jmeridth@gmail.com']
38
+ s.homepage = 'http://github.com/jmeridth/twog'
39
+ s.description = 'Tool to tweet blog posts'
40
+ s.authors = ['Jason Meridth']
39
41
  end
40
42
  rescue LoadError
41
43
  puts "Juwelier not available. Install it with: sudo gem install juwelier --version '>= 2.4.9'"
42
44
  exit(1)
43
45
  end
44
-
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- :major: 0
3
- :minor: 3
4
- :patch: 5
5
- :build:
2
+ major: 0
3
+ minor: 3
4
+ patch: 6
5
+ build:
data/bin/twog CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
5
 
5
6
  require 'tempfile'
6
7
  require 'twog'
@@ -11,69 +12,74 @@ require 'fileutils'
11
12
  include Twog::Twog
12
13
 
13
14
  twog_dir = "#{ENV['HOME']}/.twog"
14
- FileUtils.mkdir_p twog_dir unless File.exists?(twog_dir)
15
+ FileUtils.mkdir_p twog_dir unless File.exist?(twog_dir)
15
16
  twog_cron_schedule_file = "#{twog_dir}/schedule.rb"
16
17
  twog_cron_schedule_log = "#{twog_dir}/cron.log"
17
- twog_cron_identifier = "twog"
18
+ twog_cron_identifier = 'twog'
18
19
  legacy_conf_file_name = "#{ENV['HOME']}/.twog.yaml"
19
20
  twog_conf_file = "#{twog_dir}/conf.yaml"
20
21
 
21
22
  def help
22
- puts "Invalid options. Run `twog --help` for assistance."
23
+ puts 'Invalid options. Run `twog --help` for assistance.'
23
24
  end
24
25
 
25
26
  def get_conf(conf)
26
- raise "please run 'twog --conf' to create the #{conf} file" unless File.exists?(conf)
27
+ raise "please run 'twog --conf' to create the #{conf} file" unless File.exist?(conf)
28
+
27
29
  YAML.load_file(conf)
28
30
  end
29
31
 
30
32
  options = {}
31
33
  opts = OptionParser.new do |opts|
32
- opts.banner = "Twog is a tool to tweet blog posts"
34
+ opts.banner = 'Twog is a tool to tweet blog posts'
33
35
 
34
- opts.on("-v", "--version", "Display current version") do
35
- puts "Twog " + version
36
+ opts.on('-v', '--version', 'Display current version') do
37
+ puts "Twog #{version}"
36
38
  exit 0
37
39
  end
38
40
 
39
- opts.on("--cronadd N", "Add crontab job to run twog every N minutes") do |n|
41
+ opts.on('--cronadd N', 'Add crontab job to run twog every N minutes') do |n|
40
42
  twog_cron_schedule_content = <<-EOS
41
43
  set :output, "#{twog_cron_schedule_log}"
42
44
  every #{n}.minutes do
43
45
  command "twog"
44
46
  end
45
47
  EOS
46
-
47
- answer = ""
48
- if File.exists?(twog_cron_schedule_file)
48
+
49
+ answer = ''
50
+ if File.exist?(twog_cron_schedule_file)
49
51
  puts "Cron schedule file (#{twog_cron_schedule_file}) already exists. Overwrite? [Y/n]"
50
52
  answer = gets
51
53
  end
52
-
53
- File.open(twog_cron_schedule_log, 'w') {|f| f.write("") } unless File.exists?(twog_cron_schedule_log)
54
- File.open(twog_cron_schedule_file, 'w') {|f| f.write(twog_cron_schedule_content) } if ["Y","y",""].include?(answer.chomp)
55
54
 
56
- cron_options = {:file => twog_cron_schedule_file, :identifier => twog_cron_identifier, :update => true}
55
+ File.open(twog_cron_schedule_log, 'w') { |f| f.write('') } unless File.exist?(twog_cron_schedule_log)
56
+ if ['Y', 'y', ''].include?(answer.chomp)
57
+ File.open(twog_cron_schedule_file, 'w') do |f|
58
+ f.write(twog_cron_schedule_content)
59
+ end
60
+ end
61
+
62
+ cron_options = { file: twog_cron_schedule_file, identifier: twog_cron_identifier, update: true }
57
63
  Whenever::CommandLine.execute(cron_options)
58
64
  exit 0
59
65
  end
60
-
61
- opts.on("--cronrm", "Remove twog crontab job") do
62
- File.open(twog_cron_schedule_file, 'w') {|f| f.write("") }
63
- cron_options = {:file => twog_cron_schedule_file, :identifier => twog_cron_identifier, :update => true}
66
+
67
+ opts.on('--cronrm', 'Remove twog crontab job') do
68
+ File.open(twog_cron_schedule_file, 'w') { |f| f.write('') }
69
+ cron_options = { file: twog_cron_schedule_file, identifier: twog_cron_identifier, update: true }
64
70
  Whenever::CommandLine.execute(cron_options)
65
- puts "Twog cron job removed successfully"
71
+ puts 'Twog cron job removed successfully'
66
72
  exit 0
67
73
  end
68
74
 
69
- opts.on("-o", "--output", "View the blog posts that will be tweeted") do
70
- posts = get_posts_to_tweet(get_conf(twog_conf_file))
71
- puts "No posts to tweet" if posts.length == 0
72
- posts.each {|post| puts "#{post.title} (#{Time.parse(post.date.to_s)})"; puts "#{post.link}" }
75
+ opts.on('-o', '--output', 'View the blog posts that will be tweeted') do
76
+ posts = get_posts_to_tweet(get_conf(twog_conf_file))
77
+ puts 'No posts to tweet' if posts.length.zero?
78
+ posts.each { |post| puts "#{post.title} (#{Time.parse(post.date.to_s)})"; puts post.link.to_s }
73
79
  exit 0
74
80
  end
75
81
 
76
- opts.on("-c", "--conf", "Create default conf file") do
82
+ opts.on('-c', '--conf', 'Create default conf file') do
77
83
  conf_file_contents = <<-EOS
78
84
  rss_feed: 'http://url.com/feed.rss'
79
85
  consumer_key: 'consumer key'
@@ -85,18 +91,18 @@ opts = OptionParser.new do |opts|
85
91
  last_blog_post_tweeted:
86
92
  EOS
87
93
 
88
- FileUtils.mv(legacy_conf_file_name, twog_conf_file) if File.exists?(legacy_conf_file_name)
89
- if File.exists?(twog_conf_file)
90
- puts "#{twog_conf_file} already exists"
91
- exit 0
94
+ FileUtils.mv(legacy_conf_file_name, twog_conf_file) if File.exist?(legacy_conf_file_name)
95
+ if File.exist?(twog_conf_file)
96
+ puts "#{twog_conf_file} already exists"
97
+ exit 0
92
98
  end
93
99
 
94
- File.open(twog_conf_file, 'w') {|f| f.write(conf_file_contents) }
100
+ File.open(twog_conf_file, 'w') { |f| f.write(conf_file_contents) }
95
101
  puts "Default configuration file created at #{twog_conf_file}"
96
102
  exit 0
97
103
  end
98
-
99
- opts.on("-h","-?","--help", "Display help") do
104
+
105
+ opts.on('-h', '-?', '--help', 'Display help') do
100
106
  puts opts
101
107
  exit 0
102
108
  end