change-log 0.0.2 → 0.0.3

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: 5d28c518959559f38238447798ea9d4411b3d1ee
4
- data.tar.gz: f058ea66fdbcbc6fe273146715e31d17c7272150
3
+ metadata.gz: 49861ca6d7888388de485200429d27d17820ab42
4
+ data.tar.gz: fbeb0b7c9e79b505c135e98d5723d1c1e0f24242
5
5
  SHA512:
6
- metadata.gz: ac27c2deba965ae351b17f41ef92aa680d6dd9d1a05162ba8966d7fd1437b7f0f51a8af02acb403fd80130630800f120b74f9adb70ab7aaf5abe091d05665dfe
7
- data.tar.gz: 81ce28ae28a52c2cd8b1445aa4f4fecde3b63a58dbaba4a68586cebc876f5eecb0fe78d1788b6f021793c49cf1d5e061e489c9aa48ee0f5132d53e9b43ddaa04
6
+ metadata.gz: 32f998c690bc249716b82440f21dcddb7498e4e3867bc9744cadc2b808417711974dde2bfedb4ee83c04a2c71f9a9270679ac68edcd788df147af3164fb8b651
7
+ data.tar.gz: 771791e035af7299e2b2af71314f37b832dc775e2e515f9d08ca2e232a1b1fd6e021b5b3c83535b99d389d797f190cd1994920a3c623fdf8f4b8128a3340b802
@@ -3,15 +3,7 @@ module ChangeLog
3
3
  layout ChangeLog.config.layout
4
4
 
5
5
  def index
6
- @items = _model.fetch(params)
7
- end
8
-
9
- def _model
10
- if ChangeLog.config.orm == 'activerecord'
11
- @change_log_model = ChangeLog::ActiverecordModel
12
- else
13
- @change_log_model = ChangeLog::MongoidModel
14
- end
6
+ @items = ChangeLog::Base.fetch(params)
15
7
  end
16
8
  end
17
9
  end
@@ -0,0 +1 @@
1
+ require "change_log/#{ChangeLog.config.orm}_model"
@@ -1,5 +1,5 @@
1
1
  module ChangeLog
2
- class ActiverecordModel < ActiveRecord::Base
2
+ class Base < ActiveRecord::Base
3
3
 
4
4
  def self.fetch(options)
5
5
  self.order('time desc')
@@ -1,3 +1,3 @@
1
1
  module ChangeLog
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -29,7 +29,7 @@ ChangeLog.config do |config|
29
29
  end if defined? ChangeLog
30
30
 
31
31
  <% if @orm == 'mongoid' -%>
32
- ChangeLog::MongoidModel.store_in collection: :'<%= [@table_prefix, 'change_logs'].compact.join('_') %>'
32
+ ChangeLog::Base.store_in collection: :'<%= [@table_prefix, 'change_logs'].compact.join('_') %>'
33
33
  <% else %>
34
- ChangeLog::ActiverecordModel.table_name = '<%= [@table_prefix, 'change_logs'].compact.join('_') %>'
34
+ ChangeLog::Base.table_name = '<%= [@table_prefix, 'change_logs'].compact.join('_') %>'
35
35
  <% end -%>
@@ -13,7 +13,7 @@ namespace :change_log do
13
13
  require 'git'
14
14
  repo_path = args.repo_path || Rails.root
15
15
  repo = Git.open(repo_path)
16
- last_release = base_model.last_release
16
+ last_release = ChangeLog::Base.last_release
17
17
  if last_release
18
18
  records = repo.log.since(last_release.time).select { |c| c.message =~ /#{ChangeLog.config.commit_prefix}/ }
19
19
  else
@@ -56,8 +56,8 @@ namespace :change_log do
56
56
  end
57
57
  formatted_message << "\n </div>"
58
58
 
59
- base_model.create(version: version, author: record.author, message: formatted_message.join(''), time: record.date, tags: o_tag.join(','))
60
- #base_model.create(version: version, author: 'record.author', message: formatted_message.join(''), time: 'record.time', tags: o_tag.join(','))
59
+ ChangeLog::Base.create(version: version, author: record.author, message: formatted_message.join(''), time: record.date, tags: o_tag.join(','))
60
+ #ChangeLog::Base.create(version: version, author: 'record.author', message: formatted_message.join(''), time: 'record.time', tags: o_tag.join(','))
61
61
  end
62
62
 
63
63
  def parse_tag(line)
@@ -69,7 +69,7 @@ namespace :change_log do
69
69
  n = t_release.split('.').join('').to_i
70
70
  if n > 0
71
71
  t_release
72
- elsif last_release = base_model.last_release
72
+ elsif last_release = ChangeLog::Base.last_release
73
73
  t_release_a = last_release.version.split('.')
74
74
  last_number = t_release_a.pop
75
75
  t_release_a << last_number.to_i + 1
@@ -78,12 +78,4 @@ namespace :change_log do
78
78
  '0.0.1'
79
79
  end
80
80
  end
81
-
82
- def base_model
83
- if ChangeLog.config.orm == 'activerecord'
84
- ChangeLog::ActiverecordModel
85
- else
86
- ChangeLog::MongoidModel
87
- end
88
- end
89
81
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: change-log
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
  - Muntasim Ahmed
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-08 00:00:00.000000000 Z
11
+ date: 2014-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git
@@ -102,16 +102,17 @@ files:
102
102
  - app/controllers/change_log/application_controller.rb
103
103
  - app/controllers/change_log/base_controller.rb
104
104
  - app/helpers/change_log/application_helper.rb
105
- - app/models/change_log/activerecord_model.rb
106
- - app/models/change_log/mongoid_model.rb
105
+ - app/models/change_log/base.rb
107
106
  - app/views/change_log/base/index.html.erb
108
107
  - app/views/layouts/change_log/application.html.erb
109
108
  - config/routes.rb
110
109
  - lib/change-log.rb
111
110
  - lib/change_log.rb
111
+ - lib/change_log/activerecord_model.rb
112
112
  - lib/change_log/config.rb
113
113
  - lib/change_log/engine.rb
114
114
  - lib/change_log/markdown_handler.rb
115
+ - lib/change_log/mongoid_model.rb
115
116
  - lib/change_log/version.rb
116
117
  - lib/generators/change_log/install_generator.rb
117
118
  - lib/generators/change_log/templates/initializer.erb
File without changes