after_party 1.5 → 1.6

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: 2d927f9c4c24f053c1cb2b3d68b0aeda5e30b265
4
- data.tar.gz: 0d71841e0e57bd2a3939752114b1210c34634f16
3
+ metadata.gz: 4ba992ece7afc7b3d5a32af6981e2c9250efce5a
4
+ data.tar.gz: a3c28824c4383fa35e3d8c0053860a1545ec5356
5
5
  SHA512:
6
- metadata.gz: 59860f3717d4de2bf05dd7e9253c961dccde907db5e5dd28bd2289bedffd4b0ad0fd6534f32096c7b030a6c0541ed539edae6d30c3efa487ace4f3888ee6b2bc
7
- data.tar.gz: 5f598d6b7e8516e2ddec002b0f349278cb384413b0c56b43ac6064fbfd9e7aa3ded2ba592ba8868712e3710227f4345412698ef5d0a17b0da8b6efb19142efeb
6
+ metadata.gz: 088508e0d93bf7441c1f5d6a3c6746125f11e5c8d101e778aa7e97c92a116afa04c6d9524fef2c2ddcf97c8247d25dd7089f30e28900dde430c537412bd6464f
7
+ data.tar.gz: 74306e9dc1ae8dadb07b56a5b8a3479228ac1dc4f83b84889ecb4e092ded4da41f3585c36dfa0019362dbdcd870c1db829f6311c58143ea638dbbc9c10068007
@@ -1,6 +1,7 @@
1
- class TaskRecord < ActiveRecord::Base
2
- def self.completed_task?(version)
3
- all.any?{|t| t.version == version}
1
+ module AfterParty
2
+ class TaskRecord < ActiveRecord::Base
3
+ def self.completed_task?(version)
4
+ all.any?{|t| t.version == version}
5
+ end
4
6
  end
5
-
6
7
  end
@@ -1,13 +1,14 @@
1
- class TaskRecord
2
- include Mongoid::Document
3
- include Mongoid::Timestamps
1
+ module AfterParty
2
+ class TaskRecord
3
+ include Mongoid::Document
4
+ include Mongoid::Timestamps
4
5
 
5
- field :version, type: String
6
+ field :version, type: String
6
7
 
7
8
 
8
- def self.completed_task?(version)
9
- all.any?{|t| t.version == version}
9
+ def self.completed_task?(version)
10
+ all.any?{|t| t.version == version}
11
+ end
10
12
  end
11
-
12
13
  end
13
14
 
@@ -1,27 +1,27 @@
1
+ module AfterParty
2
+ class TaskRecorder
3
+ include ActiveModel::Naming
4
+ attr_reader :filename, :timestamp, :task_name
1
5
 
6
+ FILE_MASK = File.join(Rails.root, "lib/tasks/deployment/*.rake")
2
7
 
3
- class TaskRecorder
4
- include ActiveModel::Naming
5
- attr_reader :filename, :timestamp, :task_name
8
+ def self.pending_files
9
+ Dir[FILE_MASK].collect{ |f| TaskRecorder.new(f) }.select{ |f| f.pending? }.sort{ |x,y| x.timestamp <=> y.timestamp }
10
+ end
6
11
 
7
- FILE_MASK = File.join(Rails.root, "lib/tasks/deployment/*.rake")
12
+ def initialize(filename='')
13
+ @filename = filename
14
+ parse_filename
15
+ end
8
16
 
9
- def self.pending_files
10
- Dir[FILE_MASK].collect{ |f| TaskRecorder.new(f) }.select{ |f| f.pending? }.sort{ |x,y| x.timestamp <=> y.timestamp }
11
- end
12
-
13
- def initialize(filename='')
14
- @filename = filename
15
- parse_filename
16
- end
17
-
18
- def pending?
17
+ def pending?
19
18
  timestamp && !TaskRecord.completed_task?(timestamp)
20
- end
19
+ end
21
20
 
22
- def parse_filename
23
- /(\d+)_(.+)\.rake/.match(Pathname(@filename).basename.to_s)
24
- @timestamp = $1
25
- @task_name = $2
21
+ def parse_filename
22
+ /(\d+)_(.+)\.rake/.match(Pathname(@filename).basename.to_s)
23
+ @timestamp = $1
24
+ @task_name = $2
25
+ end
26
26
  end
27
27
  end
@@ -1,5 +1,4 @@
1
1
  require 'after_party'
2
- require 'after_party'
3
2
  require 'rails'
4
3
  module AfterParty
5
4
  class Railtie < Rails::Railtie
@@ -19,4 +18,4 @@ module AfterParty
19
18
  end
20
19
 
21
20
 
22
- end
21
+ end
@@ -39,4 +39,4 @@ module AfterParty
39
39
 
40
40
  end
41
41
  end
42
- end
42
+ end
@@ -1,27 +1,38 @@
1
1
  require 'date'
2
+
2
3
  module AfterParty
3
4
  module Generators
4
5
  class TaskGenerator < Rails::Generators::Base
5
- source_root File.expand_path('../templates', __FILE__)
6
- argument :name, :type => :string
7
- class_option :description, :type => :string, :description => "Include a description"
6
+ source_root(File.expand_path('../templates', __FILE__))
7
+ argument(:name, type: :string)
8
+ class_option(
9
+ :description,
10
+ type: :string,
11
+ description: 'Include a description'
12
+ )
8
13
 
9
14
  def copy_deploy_task
10
- template "deploy.rake", "lib/tasks/deployment/#{timestamp}_#{file_name}.rake"
15
+ template(
16
+ 'deploy.txt.erb',
17
+ "lib/tasks/deployment/#{timestamp}_#{file_name}.rake"
18
+ )
11
19
  end
12
20
 
13
21
  private
22
+
14
23
  def file_name
15
24
  name.underscore
16
25
  end
17
26
 
18
27
  def task_description
19
- "Deployment task: #{options.description.blank? ? file_name : options.description}"
28
+ line = 'Deployment task: '
29
+ return line + file_name if options.description.blank?
30
+ line + options.description
20
31
  end
21
32
 
22
33
  def timestamp
23
- @timestamp ||= Time.now.utc.strftime("%Y%m%d%H%M%S")
34
+ @timestamp ||= Time.now.utc.strftime('%Y%m%d%H%M%S')
24
35
  end
25
- end
26
- end
27
- end
36
+ end # class TaskGenerator
37
+ end # module Generators
38
+ end # module AfterParty
@@ -0,0 +1,12 @@
1
+ namespace :after_party do
2
+ desc '<%= task_description %>'
3
+ task <%= file_name %>: :environment do
4
+ puts "Running deploy task '<%= file_name %>'"
5
+
6
+ # Put your task implementation HERE.
7
+
8
+ # Update task as completed. If you remove the line below, the task will
9
+ # run with every deploy (or every time you call after_party:run).
10
+ AfterParty::TaskRecord.create version: '<%= timestamp %>'
11
+ end # task :<%= file_name %>
12
+ end # namespace :after_party
@@ -1,7 +1,7 @@
1
1
  namespace :after_party do
2
2
  desc "runs (in order) all pending after_party deployment tasks, if they have not run yet against the current db."
3
3
  task :run => :environment do
4
- tasks = TaskRecorder.pending_files.map {|f| "after_party:#{f.task_name}"}
4
+ tasks = AfterParty::TaskRecorder.pending_files.map {|f| "after_party:#{f.task_name}"}
5
5
 
6
6
  tasks.each {|t| Rake::Task[t].invoke}
7
7
 
metadata CHANGED
@@ -1,15 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: after_party
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.5'
4
+ version: '1.6'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Mitchell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-16 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2015-10-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activerecord
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: generator_spec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: factory_girl_rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: sqlite3
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
13
97
  description: Automated post-deploy tasks for Ruby/Rails. Your deployment is the party.
14
98
  This is the after party
15
99
  email: thestevemitchell@gmail.com
@@ -17,20 +101,20 @@ executables: []
17
101
  extensions: []
18
102
  extra_rdoc_files: []
19
103
  files:
104
+ - lib/after_party.rb
20
105
  - lib/after_party/active_record.rb
21
106
  - lib/after_party/models/active_record/task_record.rb
22
107
  - lib/after_party/models/mongoid/task_record.rb
23
108
  - lib/after_party/models/task_recorder.rb
24
109
  - lib/after_party/mongoid.rb
25
110
  - lib/after_party/railtie.rb
26
- - lib/after_party.rb
111
+ - lib/generators/install/USAGE
27
112
  - lib/generators/install/install_generator.rb
28
113
  - lib/generators/install/templates/after_party.rb
29
114
  - lib/generators/install/templates/migration.rb
30
- - lib/generators/install/USAGE
31
- - lib/generators/task/task_generator.rb
32
- - lib/generators/task/templates/deploy.rake
33
115
  - lib/generators/task/USAGE
116
+ - lib/generators/task/task_generator.rb
117
+ - lib/generators/task/templates/deploy.txt.erb
34
118
  - lib/tasks/deploy_task_runner.rake
35
119
  homepage: http://github.com/theSteveMitchell/after_party
36
120
  licenses:
@@ -42,20 +126,19 @@ require_paths:
42
126
  - lib
43
127
  required_ruby_version: !ruby/object:Gem::Requirement
44
128
  requirements:
45
- - - '>='
129
+ - - ">="
46
130
  - !ruby/object:Gem::Version
47
131
  version: '0'
48
132
  required_rubygems_version: !ruby/object:Gem::Requirement
49
133
  requirements:
50
- - - '>='
134
+ - - ">="
51
135
  - !ruby/object:Gem::Version
52
136
  version: '0'
53
137
  requirements: []
54
138
  rubyforge_project:
55
- rubygems_version: 2.0.6
139
+ rubygems_version: 2.4.6
56
140
  signing_key:
57
141
  specification_version: 4
58
142
  summary: A rails engine that manages deploy tasks and versions using activeRecord
59
143
  or mongoid
60
144
  test_files: []
61
- has_rdoc:
@@ -1,14 +0,0 @@
1
- namespace :after_party do
2
-
3
- desc "<%= task_description %>"
4
- task :<%= file_name %> => :environment do
5
- Dir[Rails.root.join("lib/after_party/*.rb")].each {|f| require f}
6
- puts "running deploy task '<%= file_name %>'"
7
-
8
- # put your task implementation here
9
-
10
- # update task as completed. If you remove the line below, the task will run with every deploy (or every time you call after_party:run)
11
- TaskRecord.create :version => '<%= timestamp %>'
12
- end
13
-
14
- end