papercallio 0.4.1 → 0.5.0

This diff has not been reviewed by any users.
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: b6cee3ecf95f39c4c1848c07bf6ffad221c74b62
4
- data.tar.gz: a97dbc23ad1767d9b7fff6aa500c6dea367763c8
3
+ metadata.gz: 499c391e80f588eb789ffac026e97aae1658a9fa
4
+ data.tar.gz: 95106b1d0517328347356f42fd4f9c5c93614160
5
5
  SHA512:
6
- metadata.gz: 1bdfd98da5a1b51ededa0f16d006192cf207840fab6615ecd7fcba6332378d6c07830bf4186bec6fdef964905bf5ef527dbbbad793350d244eb7bbfe52043d41
7
- data.tar.gz: 436399f33a6e855d36d74c5b26d575d42c78f158f69407c2bd8365920fbb5342d41bed8ab9c69f3cbc49a879d4b403f387c6db6d38c31e5a41a2d26dfdb24cc6
6
+ metadata.gz: 46f0303ea0e2084db18f183ea1ab403b4364958b2cb51bef6dda8cc39ac9f2af0968ca51dca555885a7660e8140f2a768e6ba30bf850a96b6bea638cbb071872
7
+ data.tar.gz: 3e1962a097ee3b5980f9824fa54f6b6171f098538d308e88239d6f3831daef6854cd28de6614412d52e913b73c778d5e0497d4c215422a00ea51124541b96569
data/.gitignore CHANGED
@@ -54,3 +54,9 @@ build-iPhoneSimulator/
54
54
  *.xlsx
55
55
  *.ods
56
56
  *.csv#
57
+ speakers/
58
+ speakers/**.*
59
+ program/
60
+ program/**.*
61
+ images/
62
+ images/**.*
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- papercallio (0.4.1)
4
+ papercallio (0.5.0)
5
5
  descriptive_statistics (~> 2.5)
6
6
  gli (= 2.16.0)
7
7
  httparty (~> 0.15)
@@ -46,6 +46,7 @@ command :submissions do |c|
46
46
  c.switch 'needs_rating', :desc => 'Filter results needs rating. Default (false).'
47
47
  c.switch 'include_feedback', :desc => 'Include the feedback for all submissions in the csv (Not currently implemented).'
48
48
  c.switch 'include_ratings', :desc => 'Include the ratings for all submissions in the csv'
49
+ c.switch 'devopsdays_output', :desc => 'Output the markdown for accepted speakers and submissions for the DevOpsDays website. Default (false). NOTE: may need to use --state=accepted if no longer in submitted state.'
49
50
 
50
51
  c.flag 'state', :default_value => nil,
51
52
  :arg_name => 'state of submissions. ',
@@ -64,6 +65,7 @@ command :submissions do |c|
64
65
  c.action do |global_options,options,args|
65
66
  pcc = PaperCallClient.new(api_token, options)
66
67
  response = pcc.submissions
68
+ %w(speakers program images).each{|dir| FileUtils.mkdir_p( "./#{dir}")} if options[:devopsdays_output]
67
69
 
68
70
  submissions = []
69
71
  headers = []
@@ -134,6 +136,10 @@ command :submissions do |c|
134
136
  end
135
137
  headerset = true
136
138
  submissions << line if include_line
139
+ if options[:devopsdays_output]
140
+ dodo = DevOpsDaysOutput.new(line) #if line[:state] == 'accepted'
141
+ #dodo.download_twitter_image
142
+ end
137
143
  line = {}
138
144
  end
139
145
  File.open(global_options[:file], 'w') do |f|
@@ -150,6 +156,10 @@ command :submissions do |c|
150
156
  end
151
157
  end
152
158
  puts "submissions have been output to #{global_options[:file]}"
159
+ if options[:devopsdays_output]
160
+ puts "Since `--devopsdays_output` flag was used a folder for 'speakers' and 'program' should have your markdown"
161
+ puts "NOTE if you have already moved things to accepted, may have to use the `--state=accepted` flag"
162
+ end
153
163
  end
154
164
  end
155
165
 
@@ -1,5 +1,6 @@
1
1
  require 'papercallio/version.rb'
2
2
  require 'papercallio/client.rb'
3
+ require 'papercallio/devopsdays_output.rb'
3
4
 
4
5
  # Add requires for other files you add to your project here, so
5
6
  # you just need to require this one file in your bin file
@@ -0,0 +1,76 @@
1
+ require 'httparty'
2
+ require 'open-uri'
3
+
4
+ class DevOpsDaysOutput
5
+ include HTTParty
6
+ base_uri 'https://api.twitter.com'
7
+
8
+
9
+ def initialize(submission)
10
+ #puts submission['talk_talk_format']
11
+ @submission = submission
12
+ @talk_type = "talk" if submission['talk_talk_format'].include?('Talk')
13
+ @talk_type = "ignite" if submission['talk_talk_format'].include?('Ignite')
14
+ @reformat_name = submission['profile_name'].downcase.tr(" ", "-")
15
+ @file_name = "#{@reformat_name}.md"
16
+ @options = { screen_name: submission['profile_twitter'] }
17
+ output_program
18
+ output_speaker
19
+ #puts submission['profile_twitter']
20
+ #if submission['profile_twitter']
21
+ # download_twitter_image
22
+ #else
23
+ # puts "no twitter profile for #{submission['profile_name']}, so did not attempt to download"
24
+ #end
25
+ end
26
+
27
+ def output_program
28
+ session_markdown = [
29
+ "+++",
30
+ "Talk_date = \"\"",
31
+ "Talk_start_time = \"\"",
32
+ "Talk_end_time = \"\"",
33
+ "Title = \"#{@submission['talk_title']}\"",
34
+ "Type = \"#{@talk_type}\"",
35
+ "Speakers = [\"#{@submission['profile_name']}\"]",
36
+ "+++",
37
+ "#{@submission['talk_description']}"
38
+ ].join("\n") + "\n"
39
+
40
+ File.open("program/#{@file_name}", 'w') do |f|
41
+ f.puts session_markdown
42
+ end
43
+ end
44
+
45
+ def output_speaker
46
+ speaker_markdown = [
47
+ "+++",
48
+ "Title = \"#{@submission['profile_name']}\"",
49
+ "Twitter = \"#{@submission['profile_twitter']}\"",
50
+ "Website = \"#{@submission['profile_url']}\"",
51
+ "type = \"speaker\"",
52
+ "linktitle = \"#{@reformat_name}\"",
53
+ "image = \"#{@reformat_name}.jpg\"",
54
+ "+++",
55
+ "#{@submission['profile_bio']}"
56
+ ].join("\n") + "\n"
57
+
58
+ File.open("speakers/#{@file_name}", 'w') do |f|
59
+ f.puts speaker_markdown
60
+ end
61
+
62
+ end
63
+
64
+ def download_twitter_image
65
+ twitter_info = self.class.get('/1.1/users/show.json', @options)
66
+ puts twitter_info
67
+ twitter_image_url = twitter_info['profile_image_url_https']
68
+ puts twitter_info['profile_image_url_https']
69
+ download = open(URI.parse(twitter_image_url))
70
+ # likely should honor the original format jpg/gif/png or whatever
71
+ IO.copy_stream(download, "images/#{@reformat_name}.jpg")
72
+ # if no twitter image, then should likely look to see if website is linked in then try to pull from there
73
+ end
74
+
75
+
76
+ end
@@ -1,3 +1,3 @@
1
1
  module Papercallio
2
- VERSION = '0.4.1'
2
+ VERSION = '0.5.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: papercallio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - aaronblythe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-12 00:00:00.000000000 Z
11
+ date: 2017-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -130,6 +130,7 @@ files:
130
130
  - features/support/env.rb
131
131
  - lib/papercallio.rb
132
132
  - lib/papercallio/client.rb
133
+ - lib/papercallio/devopsdays_output.rb
133
134
  - lib/papercallio/version.rb
134
135
  - papercallio.gemspec
135
136
  - papercallio.rdoc