fuburake 0.9.0.26 → 0.9.5.29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +8 -8
  2. data/lib/fubudocs.rb +143 -4
  3. data/lib/fuburake.rb +27 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MjkzN2Q0NjdhMWFiODRiNTUzZWM2NGFlNTAzODM5MmEwNjNiMGMzNA==
4
+ YTMzZGE3MTBlNDg2YTNhZDliZWRiYzJjYWUzZWNlNTA5MmZhYzNmNA==
5
5
  data.tar.gz: !binary |-
6
- MWMwYmY4NzQyNmJjMDliZWNiODRiMWNmNzNhYzYyNWViYTcxMWRiNA==
6
+ MjY0ZDE1MzdmYzU0ODkzZTAzYWY1OTExMjNjOTQzZWVhNWZmYzZkYw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- N2FiM2JhM2Q4ZjJjNmEwY2IzMmZiYjZjY2MyZGQ2ZmEyMzVjZGE0NzNkNDdj
10
- ODc5N2E0OGVhNmM1MzY0MDM5ZTI4MDM1M2YxMGIyMGU5NDJlZjBhZmNmYzE5
11
- NWYxZThkZDNiNDkwM2MzNGIzZWVmOWQxZWFhNGUxOWZiZDI1OWY=
9
+ ZDRjYTU3Y2ExNjY5YzU1MjIyMWQ2YjM0MjhkYjQ5ZjU0YjQzNTE4NjQxNjk2
10
+ MjJjNDA1MjU3MjQzZjU5YWU1NDYwZDUzMTY4MjIyODhjNzIzZTBkOWY1YTFh
11
+ YzgzNWRjMzQ5ZjZmNDNkYzNmMjU2MGZlZjhmMjA3N2RhYTZkMjc=
12
12
  data.tar.gz: !binary |-
13
- OWIyZmFjMjVjZjcyYmJkYWI0MDcwYjkzYmI0NWE0NzYzMzQyOWU5MmM1MWY0
14
- N2I1NDdhNTFkNTFjNjMwZWFhYzgxZDAyYTgyOWM4Mzc4MDYyYzljZjExYjRk
15
- NTRmYzBlMDgzZGJkNmNlZWU4ZWIzNDdhMzFlNmFlYmJjODNjZDk=
13
+ YzZiYzE4ZmE2NDYzZjQzZThlN2M2ODljOTdkZmUzYzZkYTBmMWIzZmNiMTkx
14
+ M2E0ZDkwYTdmMmQzYjViOGVkNWNkNjZhNjRmYTY4MGQ5MDk3NDE4ZGE2YjRm
15
+ ZDg3NzJiODFjYzI3ZmU5YzIxM2MyZTcyNWNhM2EzYjNkYzhjYTM=
data/lib/fubudocs.rb CHANGED
@@ -1,15 +1,15 @@
1
1
  namespace :docs do
2
- desc "Tries to run a documentation project hosted in FubuWorld"
2
+ desc "Runs a documentation project hosted in FubuWorld"
3
3
  task :run do
4
4
  sh "fubudocs run -o"
5
5
  end
6
6
 
7
- desc "Tries to run the documentation projects in this solution in a 'watched' mode in Firefox"
7
+ desc "Runs the documentation projects in this solution in a 'watched' mode in Firefox"
8
8
  task :run_firefox do
9
9
  sh "fubudocs run --watched --browser Firefox"
10
10
  end
11
11
 
12
- desc "Tries to run the documentation projects in this solution in a 'watched' mode in Firefox"
12
+ desc "Runs the documentation projects in this solution in a 'watched' mode in Firefox"
13
13
  task :run_chrome do
14
14
  sh "fubudocs run --watched --browser Chrome"
15
15
  end
@@ -23,4 +23,143 @@ namespace :docs do
23
23
  task :snippets do
24
24
  sh "fubudocs snippets"
25
25
  end
26
- end
26
+ end
27
+
28
+
29
+
30
+ class FubuDocs
31
+ attr_accessor :prefix, :branch, :export_dir
32
+
33
+ def initialize(options)
34
+ # :host, :include, :nested, :dump
35
+ @branch = options.fetch(:branch, 'gh-pages')
36
+ @repository = options[:repository]
37
+ @prefix = options.fetch(:prefix, 'docs')
38
+ @export_dir = options.fetch(:dir, 'fubudocs-export')
39
+ @options = options
40
+ end
41
+
42
+ def export
43
+ cmd = "fubudocs export #{@export_dir}"
44
+ if (@options[:host] != nil)
45
+ cmd += " --host #{@options[:host]}"
46
+ end
47
+
48
+ if (@options[:include] != nil)
49
+ cmd += " -i #{@options[:include]}"
50
+ end
51
+
52
+ if (@options[:nested] == true)
53
+ cmd += " -m GhPagesChildFolder"
54
+ elsif (@options[:dump] == true)
55
+ cmd += " -m HtmlDump"
56
+ else
57
+ cmd += ' -m GhPagesRooted'
58
+ end
59
+
60
+ sh cmd
61
+ end
62
+
63
+ def clean
64
+ cleanDirectory @export_dir
65
+ Dir.delete @export_dir
66
+ end
67
+
68
+ def create_branch
69
+ sh "ripple gitignore #{@export_dir}"
70
+
71
+ sh "git clone #{@repository} #{@export_dir}"
72
+
73
+ Dir.chdir @export_dir
74
+
75
+ sh "git checkout --orphan #{@branch}"
76
+ sh "git rm -rf ."
77
+
78
+ writeNoJekyll
79
+
80
+ sh "git add ."
81
+ sh 'git commit -a -m "initial clean slate"'
82
+ sh 'git push origin #{@branch}'
83
+
84
+ Dir.chdir '..'
85
+ end
86
+
87
+ def writeNoJekyll
88
+ output = File.new( ".nojekyll", "w+" )
89
+ output << "Just a marker"
90
+ output.close
91
+ end
92
+
93
+ def fetch_existing
94
+ Dir.mkdir @export_dir
95
+
96
+ # fetch the gh-pages branch from the server
97
+ Dir.chdir @export_dir
98
+ sh 'git init'
99
+ sh "git remote add -t #{@branch} -f origin #{@repository}"
100
+ sh "git checkout #{@branch}"
101
+
102
+ # clean the existing content
103
+ sleep 0.5 # let the file system try to relax its locks
104
+ content_files = FileList['*.*'].exclude('.nojekyll').exclude('CNAME')
105
+ content_files.each do |f|
106
+ FileUtils.rm_r f
107
+ end
108
+
109
+ # do the actual export
110
+ Dir.chdir '..'
111
+ end
112
+
113
+ def commit_new
114
+ # commit and push the generated docs
115
+ Dir.chdir @export_dir
116
+
117
+ if !File.exists?('.nojekyll')
118
+ writeNoJekyll
119
+ end
120
+
121
+ sh "git add ."
122
+ sh 'git commit -a -m "Doc generation version ' + @options[:version] + '"' do |ok, res|
123
+ if ok
124
+ sh "git push origin #{@branch}"
125
+ puts "Documentation generation and push to #{@repository}/#{@branch} is successful"
126
+ else
127
+ puts "commit failed, might be because there are no differences in the content"
128
+ end
129
+ end
130
+
131
+ Dir.chdir '..'
132
+ end
133
+
134
+ def export_tasks
135
+ initTask = Rake::Task.define_task "#{@prefix}:init_branch" do
136
+ clean
137
+ create_branch
138
+ end
139
+
140
+ initTask.add_description "Initializes the #{@branch} branch in git repository #{@repository}"
141
+
142
+ exportTaskName = "#{@prefix}:export"
143
+ exportTask = Rake::Task.define_task exportTaskName do
144
+ clean
145
+ fetch_existing
146
+ export
147
+ commit_new
148
+ end
149
+ exportTask.add_description "Export the generated documentation to #{@repository}/#{@branch}"
150
+ #exportTask.enhance [:compile]
151
+
152
+
153
+ return exportTaskName
154
+ end
155
+
156
+ def dump_task
157
+ dumpTask = Rake::Task.define_task "#{@prefix}:dump" do
158
+ clean
159
+ @options[:dump] = true
160
+ export
161
+ end
162
+ dumpTask.add_description "Export the generated documentation to #{@export_dir} for local usage"
163
+ end
164
+ end
165
+
data/lib/fuburake.rb CHANGED
@@ -25,7 +25,8 @@ module FubuRake
25
25
  :integration_test,
26
26
  :compilations,
27
27
  :bottles,
28
- :bottles_enabled
28
+ :bottles_enabled,
29
+ :doc_exports
29
30
 
30
31
  def initialize
31
32
  @options = {}
@@ -51,6 +52,12 @@ module FubuRake
51
52
 
52
53
  @bottles << FubuRake::AssemblyBottle.new(project)
53
54
  end
55
+
56
+ def export_docs(options)
57
+ @doc_exports ||= []
58
+
59
+ @doc_exports << options
60
+ end
54
61
  end
55
62
 
56
63
  class Solution
@@ -92,6 +99,7 @@ module FubuRake
92
99
  tasks.defaults ||= []
93
100
  tasks.ci_steps ||= []
94
101
  tasks.precompile ||= []
102
+ tasks.doc_exports ||= []
95
103
 
96
104
 
97
105
  enable_docs tasks
@@ -138,6 +146,18 @@ module FubuRake
138
146
  c.create @options
139
147
  end
140
148
  end
149
+
150
+ tasks.doc_exports.each do |opts|
151
+ opts[:version] = @build_number
152
+
153
+ docs = FubuDocs.new(opts)
154
+
155
+ doc_task_name = docs.export_tasks
156
+ if opts[:include_in_ci]
157
+ add_dependency :ci, doc_task_name
158
+ end
159
+ end
160
+
141
161
  end
142
162
 
143
163
  def add_dependency(from, to)
@@ -193,6 +213,12 @@ module FubuRake
193
213
 
194
214
  end
195
215
  end
216
+
217
+ def dump_html(options)
218
+ options[:version] = @build_number
219
+ docs = FubuDocs.new(options)
220
+ docs.dump_task
221
+ end
196
222
  end
197
223
 
198
224
  class MvcApp
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fuburake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0.26
4
+ version: 0.9.5.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy D. Miller
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-08-16 00:00:00.000000000 Z
13
+ date: 2013-09-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ripple-cli