falkorlib 0.2.9 → 0.2.10

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e319bb2ed3e993edc52ceceb6c66fa8f24003e4
4
- data.tar.gz: 3df0f1ddaa99fae1752c5071d5b59899f9541d28
3
+ metadata.gz: 23d6954ed4b909ec9d0d4910e1090e5550055622
4
+ data.tar.gz: 31936f89157d0c8a7227c286d97c6b34c73fad06
5
5
  SHA512:
6
- metadata.gz: 61aa9c7a4ebe03537b4abbb6a781f4a3448b32cc88f296dc8c5df7c261895ee66270e1c63427ee2977590a7d22611c9cd2a0ac27a2808a88bbeafc305f4b27b6
7
- data.tar.gz: 6793c79f88f90bb513d5e8077bcc6643006a0c595b7309727d119ca42040d8b6de575d5b4bdf036f67b8ae95a3257f0443fc16165becf316b338acf8812e19c3
6
+ metadata.gz: 518bfa6f7db45c4e6e365d718674d0f3c3449ded82464b95154150656bfbdb04f27b5bcca3be593cc2d0c0b39ea431de0f751fb0c688bc2cb013ff3fafe8b8f1
7
+ data.tar.gz: 95a6b1f26a6963df8184b84cebf315836d162a3b0210c816fd0a7bcbe3d1c0e966571fa52305e977aadc3c1ab0d69c592cc295a0dffc65dd75e22a160fc615cb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ # 0.2.10 / Bootstrapping scipts
2
+
3
+ * Enhanced setup tasks
4
+
5
+ # 0.2.9 / First stable version
6
+
7
+ * Management of git[flow] operations
8
+ * Management of versioning operations
9
+ * Flexible configuration scheme
10
+
11
+
1
12
  # 0.1.0 / FIX ME
2
13
 
3
14
  * Enhancements
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- falkorlib (0.2.9)
4
+ falkorlib (0.2.10)
5
5
  awesome_print (~> 1.2)
6
6
  configatron (~> 3.2)
7
7
  git_remote_branch (~> 0)
data/README.md CHANGED
@@ -4,8 +4,7 @@
4
4
  [![Build Status](https://travis-ci.org/Falkor/falkorlib.png)](https://travis-ci.org/Falkor/falkorlib)
5
5
  [![Code Climate](https://codeclimate.com/github/Falkor/falkorlib.png)](https://codeclimate.com/github/Falkor/falkorlib)
6
6
  [![Inline docs ](http://inch-ci.org/github/Falkor/falkorlib.svg)](http://inch-ci.org/github/Falkor/falkorlib)
7
- [![Gittip
8
- ](http://img.shields.io/gittip/Falkor.svg)](http://gittip.com/Falkor)
7
+ [![Gittip](http://img.shields.io/gittip/Falkor.svg)](http://gittip.com/Falkor)
9
8
 
10
9
  _____ _ _ _ _ _
11
10
  | ___|_ _| | | _____ _ __| | (_) |__
@@ -38,15 +37,19 @@ Or install it yourself as:
38
37
 
39
38
  $> gem install falkorlib
40
39
 
41
- **Note** you probably wants to do the above within an isolated environment. See below for some explanation on this setup.
40
+ **Note** you probably wants to do the above within an isolated environment. See
41
+ below for some explanation on this setup.
42
42
 
43
43
  ## Usage
44
44
 
45
- This library features two aspect
45
+ This library features two aspects
46
46
 
47
- * A set of toolbox functions / components I'm using everywhere in my Ruby developments, more specifically a set of modules:
48
- * `FalkorLib::Common`: Recipe for all my toolbox and versatile Ruby functions I'm using everywhere.
49
- You'll typically want to include the `FalkorLib::Common` module to bring the corresponding definitions into your scope. Example:
47
+ * A set of toolbox functions / components I'm using everywhere in my Ruby
48
+ developments, more specifically a set of modules:
49
+ * `FalkorLib::Common`: Recipe for all my toolbox and versatile Ruby functions
50
+ I'm using everywhere.
51
+ You'll typically want to include the `FalkorLib::Common` module to bring the
52
+ corresponding definitions into your scope. Example:
50
53
 
51
54
  require 'falkorlib'
52
55
  include FalkorLib::Common
@@ -67,20 +70,22 @@ This library features two aspect
67
70
  end
68
71
 
69
72
 
70
- * `FalkorLib::Git`: all git operations
71
- * `FalkorLib::Version`: versioning management
73
+ * `FalkorLib::Git`: all [git](http://git-scm.com/) operations
74
+ * `FalkorLib::GitFlow`: all [git-flow](http://nvie.com/posts/a-successful-git-branching-model/) operations
75
+ * `FalkorLib::Version`: for the [semantic versioning](http://semver.org/)
76
+ management of your project.
72
77
 
73
78
  * Some [rake](https://github.com/jimweirich/rake) tasks to facilitate common operations.
74
79
  In general you can simply embedded my tasks by adding the following header in your `Rakefile`:
75
80
 
76
81
  # In Rakefile
77
- require "falkorlib/<object>_tasks"
82
+ require "falkorlib"
83
+
84
+ ## Place-holder to customize the configuration of the <object> tasks,
85
+ ## Typically by altering FalkorLib.config.<object>
86
+
87
+ require "falkorlib/tasks/<object>" # OR require "falkorlib/<object>_tasks"
78
88
 
79
- or
80
-
81
- #In Rakefile
82
- require "falkorlib/tasks/<object>"
83
-
84
89
  ### `FalkorLib` Ruby Modules / Classes Documentation
85
90
 
86
91
  [Online documentation](https://rubygems.org/gems/falkorlib) is a available.
@@ -94,12 +99,15 @@ Statistics on the documentation generation (in particular *non*-documented compo
94
99
 
95
100
  $> rake yard:stats
96
101
 
97
-
98
102
  ### Overview of the implemented Rake tasks
99
103
 
100
- You can find the list of implemented Rake tasks (detailed below) in the `lib/falkorlib/*_tasks.rb` files
104
+ You can find the list of implemented Rake tasks (detailed below) in the
105
+ `lib/falkorlib/*_tasks.rb` files
101
106
 
102
- For a given task object `<obj>` (*git* tasks for instance as proposed in `lib/falkorlib/git_tasks.rb`), you can specialize the corresponding configuration by using the block construction of `FalkorLib.config do |c| ... end` **before** requiring the task file:
107
+ As mentioned above, for a given task object `<obj>` (*git* tasks for instance as
108
+ proposed in `lib/falkorlib/git_tasks.rb`), you can specialize the corresponding
109
+ configuration by using the block construction of `FalkorLib.config do |c|
110
+ ... end` **before** requiring the task file:
103
111
 
104
112
  # In Rakefile
105
113
  require 'falkorlib'
@@ -114,10 +122,253 @@ For a given task object `<obj>` (*git* tasks for instance as proposed in `lib/fa
114
122
 
115
123
  ## Proposed Rake tasks
116
124
 
117
-
118
- * **Gem Management**: see `lib/falkorlib/tasks/gem.rake`
119
- * **Git Management**
120
- * ... TODO: complete list
125
+ FalkorLib is meant to facilitate many common operations performed within your
126
+ projects and piloted via a
127
+ [Rakefile](https://github.com/jimweirich/rake/blob/master/doc/rakefile.rdoc).
128
+
129
+ ### Bootstrapping the project
130
+
131
+ Within your fresh new directory that will hold your project data
132
+ (`/path/to/myproject` for instance), you'll need to bootstrap the following
133
+ files:
134
+
135
+ * `.ruby-{version,gemset}`: [RVM](https://rvm.io/) configuration, use the name of the
136
+ project as [gemset](https://rvm.io/gemsets) name
137
+ * `Gemfile`: used by `[bundle](http://bundler.io/)`, initialized with `bundle
138
+ init` that contain _at least_ the line `gem 'falkorlib'`
139
+ * `Gemfile.lock` will be automatically generated once you run `bundle` to
140
+ install the configured gems within your `Gemfile`.
141
+ * `Rakefile`: the placeholder for your project tasks.
142
+
143
+ __Assuming you are in your project directory `/path/to/myproject`__ and that RVM
144
+ is installed on your system, you can bootstrap the above file by copy/pasting
145
+ all the following command-lines in your terminal:
146
+
147
+ ```
148
+ bash <(curl --silent https://raw.githubusercontent.com/Falkor/falkorlib/devel/binscripts/bootstrap.sh)
149
+ ```
150
+ _Note_: you probably want to
151
+ [take a look at that script content](https://github.com/Falkor/falkorlib/blob/devel/binscripts/bootstrap.sh)
152
+ before running the above command.
153
+
154
+ You can now complete your `Rakefile` depending on the tasks you wish to see.
155
+ Below is a detailed overview of the implemented rake tasks in `FalkorLib`.
156
+
157
+ ### Git[Flow] and Versioning Management
158
+
159
+ Nearly all my projects are organized under [Git](http://git-scm.com/) using the
160
+ [gitflow](http://nvie.com/posts/a-successful-git-branching-model/) branching
161
+ model.
162
+ Thus I create a flexible framework to pilot the interaction with Git, git-flow,
163
+ git submodules, git subtrees etc.
164
+
165
+ Typical [Minimal] setup of your Rakefile, hopefully self-speaking
166
+
167
+ ```
168
+ require 'falkorlib'
169
+
170
+ ## placeholder for custom configuration of FalkorLib.config.git and
171
+ ## FalkorLib.config.gitflow
172
+
173
+ # Git[Flow] and Versioning management
174
+ require "falkorlib/tasks/git" # OR require "falkorlib/git_tasks"
175
+ ```
176
+
177
+ If git is not yet configured in your repository, you'll end with the following
178
+ tasks:
179
+
180
+ ```
181
+ $> rake -T
182
+ fatal: Not a git repository (or any of the parent directories): .git
183
+ /!\ WARNING: Git is not initialized for this directory.
184
+ /!\ WARNING: ==> consider running 'rake git[:flow]:init' to be able to access the regular git Rake tasks
185
+ rake falkorlib:conf # Print the current configuration of FalkorLib
186
+ rake git:flow:init # Initialize Git-flow repository
187
+ rake git:init # Initialize Git repository
188
+ ```
189
+
190
+ ### Git-flow configuration
191
+
192
+ Configuration aspects for git-flow are stored in the
193
+ `FalkorLib::Config::GitFlow` module (defined in `lib/falkorlib/git/flow.rb`).
194
+
195
+ * __[Default Configuration for Gitflow](http://rubydoc.info/gems/falkorlib/FalkorLib/Config/GitFlow)__
196
+
197
+ You can easily customize these default settings in your Rakefile, __before__ the
198
+ `require "falkorlib/tasks/git"` lines. Just proceed with ruby magic as follows:
199
+
200
+ ```
201
+ require 'falkorlib'
202
+ [...]
203
+ # Git flow customization
204
+ FalkorLib.config.gitflow do |c|
205
+ c[:branches] = {
206
+ :master => 'production',
207
+ :develop => 'devel'
208
+ }
209
+ end
210
+ [...]
211
+ require "falkorlib/tasks/git"
212
+ ```
213
+
214
+ Now you can run `rake git:flow:init` to bootstrap your repository with git-flow.
215
+
216
+ Running `rake -T` shall now raises many new tasks linked to git-flow operations:
217
+
218
+ ```
219
+ $> rake -T
220
+ rake falkorlib:conf # Print the current configuration of FalkorLib
221
+ rake git:feature:finish # Finalize the feature operation
222
+ rake git:feature:start[name] # Start a new feature operation on the repository using the git-flow framework
223
+ rake git:fetch # Fetch the latest changes on remotes
224
+ rake git:flow:init # Initialize your local clone of the repository for the git-flow management
225
+ rake git:push # Push your modifications onto the remote branches
226
+ rake git:up # Update your local copy of the repository from GIT server
227
+ rake version:bump:major # Prepare the major release of the repository
228
+ rake version:bump:minor # Prepare the minor release of the repository
229
+ rake version:bump:patch # Prepare the patch release of the repository
230
+ rake version:info # Get versioning information
231
+ rake version:release # Finalize the release of a given bumped version
232
+ ```
233
+ _Note_: assuming you configured `git-flow` without any `master`, you probably
234
+ want now to delete this default branch by running `git branch -d master`
235
+
236
+ So you can now:
237
+
238
+ * Start/finish features with `rake git:feature:{start,finish}`
239
+ * perform basic git operation with `rake git:{fetch,push,up}`
240
+ * initiate semantic versioning of the project (typically with a `VERSION` file
241
+ at the root of your project) with `rake version:bump:{patch,minor,patch}`.
242
+ Note that these tasks make use of the git flow `release` feature.
243
+
244
+ Concluding a release is performed by `rake version:release`
245
+
246
+ ### Git submodules configuration
247
+
248
+ Configuration aspects for git are stored in the
249
+ `FalkorLib::Config::Git` module (defined in `lib/falkorlib/git/base.rb`).
250
+
251
+ * __[Default Configuration for Git](http://rubydoc.info/gems/falkorlib/FalkorLib/Config/Git)__
252
+
253
+ In particular, you can add as many
254
+ [Git submodules](http://git-scm.com/book/en/Git-Tools-Submodules) as you wish as
255
+ follows:
256
+
257
+ ```
258
+ require 'falkorlib'
259
+ [...]
260
+ # Git customization
261
+ FalkorLib.config.git do |c|
262
+ c[:submodules] = {
263
+ 'veewee' => {
264
+ :url => 'https://github.com/jedi4ever/veewee.git',
265
+ :branch => 'master' # not mandatory if 'master' actually
266
+ }
267
+ }
268
+ end
269
+ [...]
270
+ require "falkorlib/tasks/git"
271
+ ```
272
+
273
+ You can now bootstrap the configured sub-module(s) by running `rake
274
+ git:submodules:init`.
275
+ In the above scenario, the Git sub-module `veewee` will be initiated in
276
+ `.submodules/veewee` -- you can change the root submodules directory by altering
277
+ `FalkorLib.config.git[:submodulesdir]` value (see [defaults](http://rubydoc.info/gems/falkorlib/FalkorLib/Config/Git)).
278
+
279
+ Now you will have new rake tasks available:
280
+
281
+ $> rake -T
282
+ [...]
283
+ rake git:submodules:init # Initialize the Git subtrees defined in FalkorLib.config.git.submodules
284
+ rake git:submodules:update # Update the git submodules from '/private/tmp/toto'
285
+ rake git:submodules:upgrade # Upgrade the git submodules to the latest HEAD commit -- USE WITH CAUTION
286
+ [...]
287
+
288
+
289
+ ### Git subtree configuration
290
+
291
+ You can also add as many
292
+ [Git subtrees](http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/)
293
+ as you wish -- as follows:
294
+
295
+ ```
296
+ require 'falkorlib'
297
+ [...]
298
+ # Git customization
299
+ FalkorLib.config.git do |c|
300
+ c[:subtrees] = {
301
+ 'easybuild/easyblocks' => {
302
+ :url => 'https://github.com/ULHPC/easybuild-easyblocks.git',
303
+ :branch => 'develop'
304
+ },
305
+ 'easybuild/easyconfigs' => {
306
+ :url => 'https://github.com/ULHPC/easybuild-easyconfigs.git',
307
+ :branch => 'uni.lu'
308
+ },
309
+ }
310
+ end
311
+ [...]
312
+ require "falkorlib/tasks/git"
313
+ ```
314
+
315
+ You can now bootstrap the configured sub-tree(s) by running `rake
316
+ git:subtrees:init`.
317
+ In the above scenario, the Git sub-trees will be initiated in the
318
+ sub-directories `easybuild/easyblocks` and `easybuild/easyconfigs`.
319
+
320
+ Now you will have new rake tasks available:
321
+
322
+ ```
323
+ [...]
324
+ rake git:subtrees:diff # Show difference between local subtree(s) and their remotes
325
+ rake git:subtrees:init # Initialize the Git subtrees defined in FalkorLib.config.git.subtrees
326
+ rake git:subtrees:up # Pull the latest changes from the remote to the local subtree(s)
327
+ [...]
328
+ ```
329
+
330
+ ### Gem Management
331
+
332
+ See `lib/falkorlib/tasks/gem.rake`: you just have to add the following line to
333
+ your Rakefile:
334
+
335
+ ```
336
+ require "falkorlib/tasks/gem" # OR require "falkorlib/gem_tasks"
337
+ ```
338
+
339
+ Also, you can adapt the versioning scheme to target a gem management by altering the
340
+ [default configurations](http://rubydoc.info/gems/falkorlib/FalkorLib/Config/Versioning)
341
+
342
+ ```
343
+ require "falkorlib"
344
+ [...]
345
+ # Adapt the versioning aspects to target a gem
346
+ FalkorLib.config.versioning do |c|
347
+ c[:type] = 'gem'
348
+ c[:source]['gem'][:filename] = 'lib/mygem/version.rb', # the file to patch
349
+ end
350
+ [...]
351
+ require "falkorlib/tasks/git"
352
+ require "falkorlib/tasks/gem"
353
+ ```
354
+
355
+ This will bring the following tasks:
356
+
357
+ ```
358
+ $> rake -T
359
+ [...]
360
+ rake build # Builds all packages
361
+ rake clean # Remove any temporary products
362
+ rake clobber # Remove any generated file
363
+ rake gem:console # Spawns an Interactive Ruby Console
364
+ rake gem:info # Informations on the gem
365
+ rake gem:release # Release the gem
366
+ rake version:bump:major # Prepare the major release of the repository
367
+ rake version:bump:minor # Prepare the minor release of the repository
368
+ rake version:bump:patch # Prepare the patch release of the repository
369
+ rake version:info # Get versioning information
370
+ rake version:release # Finalize the release of a given bumped version
371
+ ```
121
372
 
122
373
 
123
374
  ## Implementation details
@@ -135,7 +386,18 @@ the sequel.
135
386
 
136
387
  If you use [RVM](http://beginrescueend.com/), you perhaps wants to create a
137
388
  separate gemset so that we can create and install this gem in a clean
138
- environment. To do that, proceed as follows:
389
+ environment.
390
+
391
+ * create a file `.ruby-gemset` containing the name of the wished Gemset
392
+ (`falkorlib` for instance)
393
+ * create a file `.ruby-version` containing the wished version of Ruby (`2.1.0`
394
+ for instance - check on [Travis](https://travis-ci.org/Falkor/falkorlib) for
395
+ the supported version)
396
+
397
+ To load these files, you have to re-enter the directory where you cloned
398
+ `falkorlib` and placed the above files
399
+
400
+ To do that, proceed as follows:
139
401
 
140
402
  $> rvm gemset create falkorlib
141
403
  $> rvm gemset use falkorlib
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  ################################################################################
3
- # Time-stamp: <Ven 2014-06-20 09:15 svarrette>
3
+ # Time-stamp: <Mer 2014-06-25 14:30 svarrette>
4
4
  ################################################################################
5
5
  # Interface for the main Git operations
6
6
  #
@@ -336,6 +336,17 @@ module FalkorLib #:nodoc:
336
336
  exit_status
337
337
  end
338
338
 
339
+ ## Check if the subtrees have been initialized.
340
+ ## Actually based on a naive check of sub-directory existence
341
+ def subtree_init?(path = Dir.pwd)
342
+ res = true
343
+ FalkorLib.config.git[:subtrees].keys.each do |dir|
344
+ res = res && File.directory?(File.join(path, dir))
345
+ end
346
+ res
347
+ end # subtree_init?
348
+
349
+
339
350
  ## Show difference between local subtree(s) and their remotes"
340
351
  def subtree_diff(path = Dir.pwd)
341
352
  raise ArgumentError, "Git 'subtree' command is not available" unless FalkorLib::Git.command? "subtree"
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  ################################################################################
3
- # Time-stamp: <Jeu 2014-06-19 18:14 svarrette>
3
+ # Time-stamp: <Jeu 2014-06-26 10:45 svarrette>
4
4
  ################################################################################
5
5
  # Management of Git Flow operations
6
6
 
@@ -84,6 +84,22 @@ module FalkorLib
84
84
  FalkorLib.config.gitflow[:prefix].each do |t,prefix|
85
85
  exit_status = execute "git config gitflow.prefix.#{t} #{prefix}"
86
86
  end
87
+ devel_branch = FalkorLib.config.gitflow[:branches][:develop]
88
+ info "Checkout to the main development branch '#{devel_branch}'"
89
+ exit_status = run %{
90
+ git checkout #{devel_branch}
91
+ }
92
+ if branches.include?('master') && ! FalkorLib.config.gitflow[:branches].values.include?( 'master' )
93
+ warn "Your git-flow confuguration does not hold the 'master' branch any more"
94
+ warn "You probably want to get rid of it asap by running 'git branch -d master'"
95
+ end
96
+ if devel_branch != 'master' &&
97
+ remotes.include?( 'origin' ) &&
98
+ branches.include?( 'remotes/origin/master')
99
+ warn "You might want to change the remote default branch to point to '#{devel_branch}"
100
+ puts "=> On github: Settings > Default Branch > #{devel_branch}"
101
+ puts "=> On the remote bare Git repository: 'git symbolic-ref HEAD refs/head/#{devel_branch}'"
102
+ end
87
103
  end
88
104
  exit_status
89
105
  end
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  ################################################################################
3
- # Time-stamp: <Sam 2014-06-14 00:05 svarrette>
3
+ # Time-stamp: <Jeu 2014-06-26 10:29 svarrette>
4
4
  ################################################################################
5
5
  #
6
6
  # FalkorLib rake tasks to pilot Git [flow] operations
@@ -42,15 +42,11 @@ else
42
42
  #.....................
43
43
  namespace :flow do
44
44
  ########### git:flow:init ###########
45
- desc "Initialize Git-flow repository"
45
+ desc "Initialize the Git-flow repository"
46
46
  task :init do
47
47
  FalkorLib::GitFlow.init
48
48
  end
49
49
  end # namespace git:flow
50
50
 
51
-
52
-
53
51
  end # namespace git
54
-
55
-
56
52
  end
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  ################################################################################
3
- # Time-stamp: <Jeu 2014-06-12 16:36 svarrette>
3
+ # Time-stamp: <Mer 2014-06-25 15:38 svarrette>
4
4
  ################################################################################
5
5
  #
6
6
  # Default FalkorLib rake tasks
@@ -21,7 +21,25 @@ namespace :falkorlib do
21
21
  task :conf do
22
22
  puts FalkorLib.config.to_yaml
23
23
  end
24
- end # namespace falkorlib<
24
+ end # namespace falkorlib
25
+
26
+
27
+ #.....................
28
+ namespace :bundle do
29
+
30
+ ########### init ###########
31
+ desc "Initialize your Bundler configuration from your Gemfile"
32
+ task :init do |t|
33
+ info "#{t.comment}"
34
+ run %{ bundle }
35
+ end # task init
36
+
37
+
38
+ end # namespace bundle
39
+
40
+ ########### setup ###########
41
+ desc "Setup the repository"
42
+ task :setup => [ 'bundle:init' ]
25
43
 
26
44
 
27
45
  # Empty task debug
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  ################################################################################
3
3
  # git.rake - Special tasks for the management of Git operations
4
- # Time-stamp: <Jeu 2014-06-19 18:19 svarrette>
4
+ # Time-stamp: <Jeu 2014-06-26 10:33 svarrette>
5
5
  #
6
6
  # Copyright (c) 2014 Sebastien Varrette <Sebastien.Varrette@uni.lu>
7
7
  # http://varrette.gforge.uni.lu
@@ -19,6 +19,7 @@ namespace :git do
19
19
  remotes = FalkorLib::Git.remotes
20
20
  #ap remotes
21
21
 
22
+
22
23
  ########### git:fetch ###########
23
24
  desc "Fetch the latest changes on remotes"
24
25
  task :fetch do |t|
@@ -32,7 +33,7 @@ namespace :git do
32
33
  when 'up'; "Update your local copy of the repository from GIT server"
33
34
  when 'push'; "Push your modifications onto the remote branches"
34
35
  end
35
- ########### git:{up,push} ###########
36
+ ########### git:{up,push} ###########
36
37
  desc "#{description}"
37
38
  task op.to_sym do |t|
38
39
  info t.comment
@@ -40,30 +41,30 @@ namespace :git do
40
41
  warn "No git remote configured... Exiting #{t}"
41
42
  next
42
43
  end
43
- cmd = ( op == 'up') ? 'pull' : op
44
- branch = FalkorLib::Git.branch?
45
- if FalkorLib::Git.list_branch.include? "remotes/origin/#{branch}"
46
- status = run %{
44
+ cmd = ( op == 'up') ? 'pull' : op
45
+ branch = FalkorLib::Git.branch?
46
+ if FalkorLib::Git.list_branch.include? "remotes/origin/#{branch}"
47
+ status = run %{
47
48
  git #{cmd} origin
48
49
  }
49
- if (status.to_i != 0)
50
- warn("The command '#{cmd}' failed with exit status #{status.to_i}")
51
- warn("This may be due to the fact that you're not connected to the internet")
52
- really_continue?('no')
53
- end
54
- else
55
- warn "The current branch '#{branch} is not currently tracked on the remote 'origin'."
56
- warn "=> exiting"
57
- next
58
- end
59
- end
50
+ if (status.to_i != 0)
51
+ warn("The command '#{cmd}' failed with exit status #{status.to_i}")
52
+ warn("This may be due to the fact that you're not connected to the internet")
53
+ really_continue?('no')
54
+ end
55
+ else
56
+ warn "The current branch '#{branch} is not currently tracked on the remote 'origin'."
57
+ warn "=> exiting"
58
+ next
59
+ end
60
+ end
60
61
  end
61
62
 
62
63
  unless FalkorLib.config.git[:submodules].empty?
63
64
  #.....................
64
65
  namespace :submodules do
65
66
  ########### init ###########
66
- desc "Initialize the Git subtrees defined in FalkorLib.config.git.submodules"
67
+ desc "Initialize the Git subtrees defined in FalkorLib.config.git[:submodules]"
67
68
  task :init do |t|
68
69
  info t.full_comment
69
70
  FalkorLib::Git.submodule_init(git_root_dir)
@@ -97,25 +98,28 @@ namespace :git do
97
98
  #.....................
98
99
  namespace :subtrees do
99
100
  ########### git:subtrees:init ###########
100
- desc "Initialize the Git subtrees defined in FalkorLib.config.git.subtrees"
101
+ desc "Initialize the Git subtrees defined in FalkorLib.config.git[:subtrees]"
101
102
  task :init do
102
103
  FalkorLib::Git.subtree_init(git_root_dir)
103
104
  end # task git:subtree:init
104
105
 
105
- ########### git:subtrees:diff ###########
106
- desc "Show difference between local subtree(s) and their remotes"
107
- task :diff do
108
- FalkorLib::Git.subtree_diff(git_root_dir)
109
- end # task git:subtree:diff
110
-
111
- ########### git:subtrees:up ###########
112
- desc "Pull the latest changes from the remote to the local subtree(s)"
113
- task :up do
114
- FalkorLib::Git.subtree_up(git_root_dir)
115
- end # task git:subtree:diff
116
-
106
+ if FalkorLib::Git.subtree_init?(git_root_dir)
107
+ ########### git:subtrees:diff ###########
108
+ desc "Show difference between local subtree(s) and their remotes"
109
+ task :diff do
110
+ FalkorLib::Git.subtree_diff(git_root_dir)
111
+ end # task git:subtree:diff
112
+
113
+ ########### git:subtrees:up ###########
114
+ desc "Pull the latest changes from the remote to the local subtree(s)"
115
+ task :up do
116
+ FalkorLib::Git.subtree_up(git_root_dir)
117
+ end # task git:subtree:diff
118
+ end
117
119
 
118
120
  end # namespace git:subtrees
119
121
  end
120
122
 
121
123
  end # namespace git
124
+
125
+ task :setup => [ 'git:init' ]
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  ################################################################################
3
- # Time-stamp: <Sam 2014-06-14 00:05 svarrette>
3
+ # Time-stamp: <Jeu 2014-06-26 10:29 svarrette>
4
4
  ################################################################################
5
5
  #
6
6
  # FalkorLib rake tasks to pilot Git [flow] operations
@@ -42,15 +42,11 @@ else
42
42
  #.....................
43
43
  namespace :flow do
44
44
  ########### git:flow:init ###########
45
- desc "Initialize Git-flow repository"
45
+ desc "Initialize the Git-flow repository"
46
46
  task :init do
47
47
  FalkorLib::GitFlow.init
48
48
  end
49
49
  end # namespace git:flow
50
50
 
51
-
52
-
53
51
  end # namespace git
54
-
55
-
56
52
  end
@@ -1,6 +1,6 @@
1
1
  ################################################################################
2
2
  # gitflow.rake - Special tasks for the management of Git [Flow] operations
3
- # Time-stamp: <Ven 2014-06-20 14:55 svarrette>
3
+ # Time-stamp: <Jeu 2014-06-26 10:40 svarrette>
4
4
  #
5
5
  # Copyright (c) 2014 Sebastien Varrette <Sebastien.Varrette@uni.lu>
6
6
  # http://varrette.gforge.uni.lu
@@ -16,12 +16,17 @@ namespace :git do
16
16
  include FalkorLib::Common
17
17
  git_root_dir = FalkorLib::Git.rootdir
18
18
 
19
+ ########### git:init ###########
20
+ desc "Initialize Git repository"
21
+ task :init => [ 'git:flow:init' ]
22
+
19
23
  #.....................
20
24
  namespace :flow do
21
25
 
22
26
  ########### git:flow:init ###########
23
27
  desc "Initialize your local clone of the repository for the git-flow management"
24
28
  task :init do |t|
29
+ info t.comment
25
30
  FalkorLib::GitFlow.init(git_root_dir)
26
31
  end # task init
27
32
 
@@ -141,6 +146,8 @@ namespace :version do
141
146
  git push origin
142
147
  }
143
148
  end
149
+ run %{ git push origin --tags }
150
+ #info "Update the changelog"
144
151
  if (! FalkorLib.config[:versioning].nil?) &&
145
152
  FalkorLib.config[:versioning][:type] == 'gem'
146
153
  warn "About to push the released new gem (version #{version}) to the gem server (rybygems.org)"
@@ -19,7 +19,7 @@ module FalkorLib #:nodoc:
19
19
  # MAJOR: Defines the major version
20
20
  # MINOR: Defines the minor version
21
21
  # PATCH: Defines the patch version
22
- MAJOR, MINOR, PATCH = 0, 2, 9
22
+ MAJOR, MINOR, PATCH = 0, 2, 10
23
23
 
24
24
  module_function
25
25
 
@@ -2,7 +2,7 @@
2
2
  #########################################
3
3
  # git_spec.rb
4
4
  # @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
5
- # Time-stamp: <Ven 2014-06-20 09:15 svarrette>
5
+ # Time-stamp: <Mer 2014-06-25 14:36 svarrette>
6
6
  #
7
7
  # @description Check the Git operations
8
8
  #
@@ -150,19 +150,31 @@ describe FalkorLib::Git do
150
150
 
151
151
  # ---------- Subtrees ---------------
152
152
  if FalkorLib::Git.command? 'subtree'
153
+ FalkorLib.config.git do |c|
154
+ c[:subtrees] = {
155
+ 'falkor/lib' => {
156
+ :url => 'https://github.com/Falkor/falkorlib.git',
157
+ :branch => 'devel'
158
+ },
159
+ }
160
+ end
161
+
162
+ it "#subtree_init? -- should check that the subtree(s) have not been initialized" do
163
+ b = FalkorLib::Git.subtree_init?( dir )
164
+ b.should be_false
165
+ end
166
+
153
167
  it "#subtree_init - initialize some Git Subtrees" do
154
- FalkorLib.config.git do |c|
155
- c[:subtrees] = {
156
- 'falkor/lib' => {
157
- :url => 'https://github.com/Falkor/falkorlib.git',
158
- :branch => 'devel'
159
- },
160
- }
161
- end
168
+
162
169
  b = FalkorLib::Git.subtree_init( dir )
163
170
  b.should == 0
164
171
  end
165
172
 
173
+ it "#subtree_init? -- should check that the subtree(s) have been initialized" do
174
+ b = FalkorLib::Git.subtree_init?( dir )
175
+ b.should be_true
176
+ end
177
+
166
178
  it "#subtree_up" do
167
179
  b = FalkorLib::Git.subtree_up( dir )
168
180
  b.should == 0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: falkorlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastien Varrette
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-20 00:00:00.000000000 Z
11
+ date: 2014-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake