fuel 0.3.22 → 0.3.23

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
  SHA1:
3
- metadata.gz: d92d0d5ad55c1d570ec773365cb797443132eb82
4
- data.tar.gz: 0916c94b1e4892e76bb9dcdeaca580a0fe02d074
3
+ metadata.gz: 62060296c0ba614342471200beaa58af5cf7eb8c
4
+ data.tar.gz: 8f033712ddb57da8513cf10a29fbd01fa7f0d489
5
5
  SHA512:
6
- metadata.gz: c37c873ff701c0dd1c62776db9e285f55af854803facab0383f90e841e74213f8cb305cf9bd8d4d2b14b3c870e5d1af84e472a4fc967174267285a22ff641af5
7
- data.tar.gz: f12aab0950beee7594802c3875e932a00d98d4494f63ef1527a7c47dbaf2bf8740688fc093dd6fb9c51f25e0c2086f7178bdfbcad310d2f9153132e0f180c216
6
+ metadata.gz: f8f900dfc2630664711d737582a1d59dd5bd97dc656e61653fcf428e98e0afce46ef97f3046b0dab923f713763654ab90f5cb15efd07790f06ee6a187fccaa2c
7
+ data.tar.gz: eeb434e558cc73ed1f884c070ea7398b98dc774d059ee676b40dbf368ac66fa553b2203a04b2c8f37df16c04d99a0f5f0980818bbb1e62210aac475544670843
@@ -15,8 +15,8 @@ module Fuel
15
15
 
16
16
  def create
17
17
  @params_hash = Rails.version[0].to_i < 4 ? params[:fuel_author] : author_params
18
- @author = Fuel::Author.new(@params_hash)
19
18
  set_start_date
19
+ @author = Fuel::Author.new(@params_hash)
20
20
 
21
21
  if @author.save
22
22
  redirect_to fuel.admin_authors_path, notice: "Your author was successfully #{@message}."
@@ -31,8 +31,8 @@ module Fuel
31
31
 
32
32
  def update
33
33
  @params_hash = Rails.version[0].to_i < 4 ? params[:fuel_author] : author_params
34
- @author.attributes = @params_hash
35
34
  set_start_date
35
+ @author.attributes = @params_hash
36
36
 
37
37
  if @author.save
38
38
  redirect_to fuel.admin_authors_path, notice: "Author was updated and #{@message}"
@@ -57,8 +57,8 @@ module Fuel
57
57
 
58
58
  def set_start_date
59
59
  start_date_string = @params_hash[:start_date]
60
- start_datetime = DateTime.strptime(start_date_string, "%m/%d/%Y")
61
- @author.start_date = start_datetime if start_datetime
60
+ start_datetime = start_date_string.present? ? DateTime.strptime(start_date_string, "%m/%d/%Y") : nil
61
+ @params_hash[:start_date] = start_datetime
62
62
  end
63
63
 
64
64
  def author_params
@@ -15,8 +15,9 @@ module Fuel
15
15
 
16
16
  def create
17
17
  @params_hash = Rails.version[0].to_i < 4 ? params[:fuel_post] : post_params
18
+ update_published_at
18
19
  @post = Fuel::Post.new(@params_hash)
19
- update_published
20
+ set_message
20
21
 
21
22
  if @post.save
22
23
  redirect_to fuel.admin_posts_path, notice: "Your blog post was successfully #{@message}."
@@ -31,8 +32,9 @@ module Fuel
31
32
 
32
33
  def update
33
34
  @params_hash = Rails.version[0].to_i < 4 ? params[:fuel_post] : post_params
35
+ update_published_at
34
36
  @post.attributes = @params_hash
35
- update_published
37
+ set_message
36
38
 
37
39
  if @post.save
38
40
  redirect_to fuel.edit_admin_post_path(@post), notice: "Post was updated and #{@message}"
@@ -62,10 +64,13 @@ module Fuel
62
64
  params.require(:fuel_post).permit(:tag, :author_id, :content, :title, :teaser, :featured_image, :published, :published_at)
63
65
  end
64
66
 
65
- def update_published
67
+ def update_published_at
66
68
  published_at_string = @params_hash[:published_at]
67
69
  published_at_datetime = DateTime.strptime(published_at_string, "%m/%d/%Y")
68
- @post.published_at = published_at_datetime if published_at_datetime
70
+ @params_hash[:published_at] = published_at_datetime
71
+ end
72
+
73
+ def set_message
69
74
  @message = @post.published ? "posted" : "saved"
70
75
  end
71
76
 
data/lib/blog_importer.rb CHANGED
@@ -25,10 +25,12 @@ class BlogImporter
25
25
  parsed_json.each do |post|
26
26
  puts "Importing #{post['title']}"
27
27
  post.delete("id")
28
- author_name = post["author"].dup
28
+ author_first_name = post["author"]["first_name"]
29
+ author_last_name = post["author"]["last_name"]
30
+ author_full_name = "#{author_first_name} #{author_last_name}"
29
31
  image_url = post["prioritized_featured_image_url"].present? ? post["prioritized_featured_image_url"].dup : nil
30
32
  post.delete("prioritized_featured_image_url")
31
- member = author_name_to_member[author_name]
33
+ member = author_name_to_member[author_full_name]
32
34
  author = Fuel::Author.find_by_email(member[:email])
33
35
  post["author_id"] = author.id
34
36
  post.delete("author")
@@ -42,21 +44,19 @@ class BlogImporter
42
44
 
43
45
  def author_name_to_member
44
46
  @key_to_member ||= {
45
- "BH" => ExampleAuthor::BRENDAN,
46
- "Brendan" => ExampleAuthor::BRENDAN,
47
- "Tom" => ExampleAuthor::TOM,
48
- "TC" => ExampleAuthor::TOM,
49
- "Ryan" => ExampleAuthor::RYAN,
50
- "Scott" => ExampleAuthor::SCOTT,
51
- "Kurt" => ExampleAuthor::KURT,
52
- "Katie" => ExampleAuthor::KATIE,
53
- "Scott " => ExampleAuthor::SCOTT,
54
- "Monique" => ExampleAuthor::MONIQUE,
55
- "Jack " => ExampleAuthor::JACK,
56
- "Dave" => ExampleAuthor::DAVE
47
+ "Brendan Hennessy" => Fuel::Author.find_by_email("brendan@launchpadlab.com"),
48
+ "Tom Cullen" => Fuel::Author.find_by_email("tom@launchpadlab.com"),
49
+ "Ryan Francis" => Fuel::Author.find_by_email("ryan@launchpadlab.com"),
50
+ "Scott Weisman" => Fuel::Author.find_by_email("scott@launchpadlab.com"),
51
+ "Kurt Cunningham" => Fuel::Author.find_by_email("kurt@launchpadlab.com"),
52
+ "Katie Astrauskas" => Fuel::Author.find_by_email("katie@launchpadlab.com"),
53
+ "Monique Marchwiany" => Fuel::Author.find_by_email("monique@launchpadlab.com"),
54
+ "Jack Miller" => Fuel::Author.find_by_email("jack@launchpadlab.com"),
55
+ "Dave Corwin" => Fuel::Author.find_by_email("dave@launchpadlab.com")
57
56
  }
58
57
  end
59
58
 
59
+
60
60
  def create_authors
61
61
  [ExampleAuthor::BRENDAN, ExampleAuthor::TOM, ExampleAuthor::RYAN, ExampleAuthor::SCOTT, ExampleAuthor::KURT, ExampleAuthor::DAVE, ExampleAuthor::KATIE, ExampleAuthor::MONIQUE, ExampleAuthor::JACK].each do |member_const|
62
62
  member = member_const.dup
data/lib/fuel/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Fuel
2
- VERSION = "0.3.22"
2
+ VERSION = "0.3.23"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fuel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.22
4
+ version: 0.3.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Francis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-09 00:00:00.000000000 Z
11
+ date: 2015-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails