rails-precompile2git 1.0.1 → 1.0.2
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.
- data/Gemfile +0 -2
- data/Gemfile.lock +0 -10
- data/README.md +7 -7
- data/VERSION +1 -1
- data/lib/precompile2git.rb +7 -8
- data/rails-precompile2git.gemspec +4 -6
- metadata +1 -17
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,20 +1,10 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (3.2.2)
|
5
|
-
i18n (~> 0.6)
|
6
|
-
multi_json (~> 1.0)
|
7
|
-
chronic (0.6.7)
|
8
4
|
git (1.2.5)
|
9
|
-
i18n (0.6.0)
|
10
|
-
multi_json (1.1.0)
|
11
|
-
whenever (0.7.3)
|
12
|
-
activesupport (>= 2.3.4)
|
13
|
-
chronic (~> 0.6.3)
|
14
5
|
|
15
6
|
PLATFORMS
|
16
7
|
ruby
|
17
8
|
|
18
9
|
DEPENDENCIES
|
19
10
|
git (= 1.2.5)
|
20
|
-
whenever
|
data/README.md
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
# Rails : Precompile 2 Git
|
2
2
|
|
3
|
-
A small
|
3
|
+
A small daemon that makes Rails 3.1.x deployments faster by automating precompilation process.
|
4
4
|
|
5
|
-
With Rails 3.1 and the assets pipeline, you
|
5
|
+
With Rails 3.1 and the assets pipeline, you have to precompile your assets before or during the deployment phase. Both methods have pros and cons:
|
6
6
|
|
7
|
-
- before:
|
7
|
+
- before: Deployment time is as fast as before Rails 3.1, but deploy will fail if `rake assets:precompile` has not been runned (which is often the job of developpers)
|
8
8
|
|
9
|
-
- after
|
9
|
+
- after: Usually as a hook of a capistrano task - will add an overhead to your deployment time, and in a distributed environment, it might also be run multiple times (on each rails instance), which might not necessary
|
10
10
|
|
11
|
-
Precompile2git is a daemon that
|
11
|
+
Precompile2git is a daemon that watch a branch on a git repo and execute a routine for each new commit:
|
12
12
|
|
13
|
-
- break any currently running assets precompilation
|
13
|
+
- break any currently running assets precompilation task
|
14
14
|
- launch a new "rake assets:precompile"
|
15
|
-
- commit everything (with user_name and user_email
|
15
|
+
- commit everything (with `user_name` and `user_email` for git config as set in config file)
|
16
16
|
- push to origin on a specific branch (as set in config file)
|
17
17
|
|
18
18
|
It makes deployments as fast as before Rails 3.1, and its secure the process.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
data/lib/precompile2git.rb
CHANGED
@@ -43,7 +43,7 @@ class Precompile2git
|
|
43
43
|
end
|
44
44
|
|
45
45
|
|
46
|
-
#
|
46
|
+
# Run the first precompilation task and starts watching a git repo for any update
|
47
47
|
def start
|
48
48
|
@logger.info("Syncing repo.")
|
49
49
|
|
@@ -60,12 +60,12 @@ class Precompile2git
|
|
60
60
|
end
|
61
61
|
|
62
62
|
|
63
|
-
# Creates a new
|
63
|
+
# Creates a new process and start the "rake assets:precompile" task
|
64
64
|
def precompile
|
65
65
|
begin
|
66
66
|
if @precompilation_process_pid
|
67
67
|
|
68
|
-
@logger.info("A precompilation has been launched before. Killing any rake
|
68
|
+
@logger.info("A precompilation has been launched before. Killing any rake task that may be still running...")
|
69
69
|
|
70
70
|
begin
|
71
71
|
pids = Process.descendant_processes(@precompilation_process_pid)
|
@@ -117,13 +117,12 @@ class Precompile2git
|
|
117
117
|
end
|
118
118
|
|
119
119
|
|
120
|
-
# Resets both compiled and uncompiled branch to have mirror of origin
|
120
|
+
# Resets both compiled and uncompiled branch to have a mirror of origin
|
121
121
|
# Then merges uncompiled_branch to compiled one
|
122
122
|
def sync_and_merge
|
123
123
|
sync_with_origin(@uncompiled_branch)
|
124
124
|
sync_with_origin(@compiled_branch)
|
125
125
|
|
126
|
-
# finally merge everything, this should be
|
127
126
|
@g.merge(@uncompiled_branch, nil)
|
128
127
|
end
|
129
128
|
|
@@ -133,7 +132,7 @@ class Precompile2git
|
|
133
132
|
begin
|
134
133
|
@g.fetch
|
135
134
|
|
136
|
-
#
|
135
|
+
# log should be empty if no updates
|
137
136
|
log = @g.log.between(@uncompiled_branch, "origin/" + @uncompiled_branch)
|
138
137
|
|
139
138
|
return log.size == 0
|
@@ -145,8 +144,8 @@ class Precompile2git
|
|
145
144
|
end
|
146
145
|
|
147
146
|
|
148
|
-
# Watch
|
149
|
-
# If so, any running rake task should be killed and a new
|
147
|
+
# Watch at a given interval if the repo has been updated.
|
148
|
+
# If so, any running rake task should be killed and a new one should be launched
|
150
149
|
def watch_repo(interval)
|
151
150
|
Thread.new do
|
152
151
|
loop do
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "rails-precompile2git"
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Robin Komiwes"]
|
12
|
-
s.date = "2012-03-
|
12
|
+
s.date = "2012-03-28"
|
13
13
|
s.description = "Daemon that watch a Git repo for new commit, pull changes, precompile assets and push back to Git"
|
14
14
|
s.email = "robin.komiwes@gmail.com"
|
15
15
|
s.executables = ["precompile2git"]
|
@@ -25,7 +25,8 @@ Gem::Specification.new do |s|
|
|
25
25
|
"bin/precompile2git",
|
26
26
|
"lib/precompile2git.rb",
|
27
27
|
"lib/process.rb",
|
28
|
-
"precompile2git.yml.example"
|
28
|
+
"precompile2git.yml.example",
|
29
|
+
"rails-precompile2git.gemspec"
|
29
30
|
]
|
30
31
|
s.homepage = "http://github.com/nectify/rails-precompile2git"
|
31
32
|
s.licenses = ["Apache 2"]
|
@@ -38,14 +39,11 @@ Gem::Specification.new do |s|
|
|
38
39
|
s.specification_version = 3
|
39
40
|
|
40
41
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
41
|
-
s.add_runtime_dependency(%q<whenever>, [">= 0"])
|
42
42
|
s.add_runtime_dependency(%q<git>, ["= 1.2.5"])
|
43
43
|
else
|
44
|
-
s.add_dependency(%q<whenever>, [">= 0"])
|
45
44
|
s.add_dependency(%q<git>, ["= 1.2.5"])
|
46
45
|
end
|
47
46
|
else
|
48
|
-
s.add_dependency(%q<whenever>, [">= 0"])
|
49
47
|
s.add_dependency(%q<git>, ["= 1.2.5"])
|
50
48
|
end
|
51
49
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-precompile2git
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,22 +11,6 @@ bindir: bin
|
|
11
11
|
cert_chain: []
|
12
12
|
date: 2012-03-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: whenever
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
30
14
|
- !ruby/object:Gem::Dependency
|
31
15
|
name: git
|
32
16
|
requirement: !ruby/object:Gem::Requirement
|