github_pages_rake_tasks 0.1.3 → 0.1.4
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61d5c837a9f07564a26362d8dd182c44556ce40fdf2aed4b47142a8ab09c897c
|
4
|
+
data.tar.gz: a20eaccf3e952cc502b5deaecdfaf9cef387a19d0b4dd78647a34a51e29f1f1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6eb3c7ed5d02e97f41d713796602f1ca5bee2bd4490f058c0e7b3ba4bf7271caf5401e47ff23f18c752af860964b7d934dbf9b101d0a91de1161ff6acad33181
|
7
|
+
data.tar.gz: e72f830a3ceb8baab32ec41f186b277589ad9a9d6e2977625947eb86e5e885771200597838dd01ac1e57f89ee3fd95ea3561f4586cc2d597cc5036d72398a512
|
data/.travis.yml
CHANGED
@@ -35,7 +35,7 @@ module GithubPagesRakeTasks
|
|
35
35
|
class Interface
|
36
36
|
extend Forwardable
|
37
37
|
|
38
|
-
def_delegators :@file_utils, :chdir, :
|
38
|
+
def_delegators :@file_utils, :chdir, :cp_r, :mkdir_p, :rm_rf, :sh, :verbose
|
39
39
|
def_delegators :@dir, :mktmpdir
|
40
40
|
def_delegator :@dir, :exist?, :dir_exist?
|
41
41
|
def_delegators :@file, :expand_path
|
@@ -97,9 +97,12 @@ module GithubPagesRakeTasks
|
|
97
97
|
|
98
98
|
def publish
|
99
99
|
interface.verbose(verbose) do
|
100
|
-
|
101
|
-
|
102
|
-
|
100
|
+
interface.mkdir_p(staging_dir)
|
101
|
+
interface.chdir(staging_dir) do
|
102
|
+
initialize_staging_dir
|
103
|
+
copy_doc_dir_to_staging_dir
|
104
|
+
commit_and_push_staging_dir
|
105
|
+
end
|
103
106
|
clean_staging_dir
|
104
107
|
end
|
105
108
|
end
|
@@ -126,15 +129,8 @@ module GithubPagesRakeTasks
|
|
126
129
|
end
|
127
130
|
|
128
131
|
def initialize_git
|
129
|
-
interface.
|
130
|
-
|
131
|
-
interface.sh("git remote add '#{remote_name}' '#{repo_url}'")
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
def initialize_staging_repo
|
136
|
-
interface.mkdir_p(staging_dir) unless interface.dir_exist?(staging_dir)
|
137
|
-
initialize_git
|
132
|
+
interface.sh('git init')
|
133
|
+
interface.sh("git remote add '#{remote_name}' '#{repo_url}'")
|
138
134
|
end
|
139
135
|
|
140
136
|
# Creates `staging_dir` (if needed), clones the remote repository to it, and checks
|
@@ -143,7 +139,7 @@ module GithubPagesRakeTasks
|
|
143
139
|
# Finally, removes all files using git rm
|
144
140
|
#
|
145
141
|
def initialize_staging_dir
|
146
|
-
|
142
|
+
initialize_git
|
147
143
|
if remote_branch_exists?
|
148
144
|
checkout_existing_branch
|
149
145
|
else
|
@@ -165,10 +161,8 @@ module GithubPagesRakeTasks
|
|
165
161
|
end
|
166
162
|
|
167
163
|
def remove_staging_files
|
168
|
-
interface.
|
169
|
-
|
170
|
-
# ignore failure
|
171
|
-
end
|
164
|
+
interface.sh('git rm -r .') do
|
165
|
+
# ignore failure
|
172
166
|
end
|
173
167
|
end
|
174
168
|
|
@@ -177,10 +171,9 @@ module GithubPagesRakeTasks
|
|
177
171
|
end
|
178
172
|
|
179
173
|
def commit_and_push_staging_dir
|
180
|
-
interface.
|
181
|
-
|
182
|
-
interface.sh("git
|
183
|
-
interface.sh("git push --set-upstream #{remote_name} #{branch_name}")
|
174
|
+
interface.sh('git add .')
|
175
|
+
interface.sh("git commit -m '#{commit_message}'") do |commit_successful, _process_status|
|
176
|
+
interface.sh("git push --set-upstream #{remote_name} #{branch_name}") if commit_successful
|
184
177
|
end
|
185
178
|
end
|
186
179
|
end
|