cackle 0.0.2 → 0.0.3

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: 795976ed8d1dad277d90976a5b9c3b50043b847b
4
- data.tar.gz: 73aeafd4731b674daa22a5645b2251c0cbbadfca
3
+ metadata.gz: c203cde289fd456717fc18b216f13b58c00bec2b
4
+ data.tar.gz: e9981d7f891a64e081047896111e7948aa37315c
5
5
  SHA512:
6
- metadata.gz: 8f1e8f3470be58a6abc29fc528c6aa767357c3846e4a520d7e417e60f76fc2ffb1c2c201ee950bab56a11fa917edf27864620427d9632b7f372dd4ed6d36381d
7
- data.tar.gz: 66fe2a831c2b9f0340f736a3428c77b0e05d4c9e8674cad1174fe80d367a5b6055ccfc7cd435fe1f4267826c18109ca3a097eb0819e206491b2e641ee74e69a1
6
+ metadata.gz: c6f6567432e1aba96aa01985679660e378528cf33e2d4700b883ee5099a19b5e7680e0d1e26e465bbd50047779b7f2618e7860f5fd0cc901b6248ef35cd5b246
7
+ data.tar.gz: 1e22c05051f38bbdaff1066f3938e87d32aa64b7dae097f8c5bbd7ed709ece104185f1e1d471350c11a370d925ac288c9339bf58b70f67db8cde0de90ab41e95
data/README.md CHANGED
@@ -19,17 +19,22 @@ gem 'cackle'
19
19
 
20
20
  Generate and run migration
21
21
  ```
22
- rails g cacke_migration
22
+ rails g cackle:migration
23
23
  rake db:migrate
24
24
  ```
25
+
26
+ Copy views to app/views for customization (optional)
27
+ ```
28
+ rails g cackle:views
29
+ ```
30
+
25
31
  Create config file config/cackle.yml
26
- See http://cackle.me/help/comment-sync to get your keys
32
+ See http://cackle.me/help/comment-sync to find your keys
27
33
 
28
34
  ```yml
29
35
  site_id: 12345 # Site ID
30
36
  site_api_key: blah-blah-blah # Account API Key
31
- account_api_key: blah-blah-blah # Site API Key
32
- jquery_off: true # Disable including jQuery if you already have it loaded
37
+ account_api_key: blah-blah-blah # Site API Key
33
38
 
34
39
  recent: # configuretion for recent comments block
35
40
  mcSize: 10 # how many comments to display
@@ -44,19 +44,4 @@
44
44
  · #{time_ago_in_words date} назад
45
45
  - else
46
46
  · #{date.strftime("%d.%m")}
47
- = date.strftime("%H:%M")
48
-
49
- :javascript
50
- var mcSite = '#{@config['site_id']}';
51
- var mcSize = '#{@config['recent']['mcSize']}';
52
- var mcAvatarSize = '#{@config['recent']['mcAvatarSize']}';;
53
- var mcTextSize = '#{@config['recent']['mcTextSize']}';
54
- var mcTitleSize = '#{@config['recent']['mcTitleSize']}';
55
- var mcJqueryOff = #{@config['recent']['mcJqueryOff']};
56
- (function() {
57
- var mc = document.createElement('script');
58
- mc.type = 'text/javascript';
59
- mc.async = true;
60
- mc.src = 'http://cackle.me/mc.last-min.js';
61
- (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(mc);
62
- })();
47
+ = date.strftime("%H:%M")
@@ -1,3 +1,3 @@
1
1
  module Cackle
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -1,4 +1,4 @@
1
- class CackleMigrationGenerator < Rails::Generators::Base
1
+ class Cackle::MigrationGenerator < Rails::Generators::Base
2
2
  require 'rails/generators'
3
3
  require 'rails/generators/migration'
4
4
 
@@ -0,0 +1,10 @@
1
+ class Cackle::ViewsGenerator < Rails::Generators::Base
2
+ require 'rails/generators/base'
3
+
4
+ public_task :copy_views
5
+ source_root File.expand_path('../../../app/views', __FILE__)
6
+
7
+ def copy_views
8
+ directory 'cackle', 'app/views/cackle'
9
+ end
10
+ end
@@ -1,15 +1,24 @@
1
1
  require 'open-uri'
2
2
 
3
3
  namespace :cackle do
4
+
5
+ def say text
6
+ if Rails.env.development?
7
+ puts text
8
+ end
9
+ end
10
+
4
11
  def load_config
5
- @config = YAML::load(File.open('config/cackle.yml'))
12
+ begin
13
+ @config = YAML::load(File.open('config/cackle.yml'))
14
+ rescue Errno::ENOENT
15
+ raise "Create config/cackle.yml first"
16
+ end
6
17
  @path = "http://cackle.me/api/comment/mutable_list?siteApiKey=#{@config['site_api_key']}&accountApiKey=#{@config['account_api_key']}"
7
- raise "Create config/cackle.yml first" unless @config
8
-
9
- puts "will use: "
10
- puts @config['site_id']
11
- puts @config['site_api_key']
12
- puts @config['account_api_key']
18
+ say "will use: "
19
+ say @config['site_id']
20
+ say @config['site_api_key']
21
+ say @config['account_api_key']
13
22
  end
14
23
 
15
24
  def create_comment c
@@ -35,7 +44,7 @@ namespace :cackle do
35
44
  comment.anonym_email = c['anonym']['email']
36
45
  end
37
46
  if comment.save
38
- puts "created #{comment.comment_id}"
47
+ say "created #{comment.comment_id}"
39
48
  end
40
49
  end
41
50
 
@@ -52,8 +61,8 @@ namespace :cackle do
52
61
  comments.each do |c|
53
62
  create_comment c
54
63
  end
55
- end while (comments.size == 100)
56
- puts "Total #{CackleComment.count} in base"
64
+ end while (comments.size == 100)
65
+ say "Total #{CackleComment.count} in base"
57
66
  end
58
67
 
59
68
  desc 'Synchronize comments database'
@@ -63,7 +72,7 @@ namespace :cackle do
63
72
  max = CackleComment.maximum('updated_at')
64
73
  raise "run bootstrap first" unless max
65
74
 
66
- puts "maximum found in base: #{max}"
75
+ say "maximum found in base: #{max}"
67
76
  @url = @path + "&modified=#{max.to_i*1000}"
68
77
 
69
78
  response = open(@url).read
@@ -73,14 +82,14 @@ namespace :cackle do
73
82
  comment = CackleComment.find_by_comment_id(c['id'])
74
83
  if comment
75
84
  if (time = Time.strptime((c['modified'][0..9]).to_s, "%s")) > comment.updated_at
76
- puts "updating: #{c['id']}"
85
+ say "updating: #{c['id']}"
77
86
  comment.update_attributes(
78
87
  message: c['message'],
79
88
  status: c['status'],
80
89
  updated_at: time)
81
90
  comment.save
82
91
  else
83
- puts "comment: #{c['id']} already exist"
92
+ say "comment: #{c['id']} already exist"
84
93
  end
85
94
  else
86
95
  create_comment c
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cackle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artyom Nikolaev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-16 00:00:00.000000000 Z
11
+ date: 2014-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -56,8 +56,9 @@ files:
56
56
  - lib/cackle.rb
57
57
  - lib/cackle/railtie.rb
58
58
  - lib/cackle/version.rb
59
- - lib/generators/cackle_migration/cackle_migration_generator.rb
60
- - lib/generators/cackle_migration/templates/migration.rb
59
+ - lib/generators/cackle/migration_generator.rb
60
+ - lib/generators/cackle/templates/migration.rb
61
+ - lib/generators/cackle/views_generator.rb
61
62
  - lib/tasks/cackle_tasks.rake
62
63
  - test/cackle_test.rb
63
64
  - test/dummy/README.rdoc
@@ -94,7 +95,7 @@ files:
94
95
  - test/dummy/public/500.html
95
96
  - test/dummy/public/favicon.ico
96
97
  - test/test_helper.rb
97
- homepage: http://a22.in
98
+ homepage: http://github.com/iRet/cackle
98
99
  licenses: []
99
100
  metadata: {}
100
101
  post_install_message: