adva-static 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,3 @@
1
- require 'site'
2
-
3
1
  module Adva
4
2
  class Static
5
3
  class Import
@@ -13,7 +13,7 @@ module Adva
13
13
  @remote = options[:remote]
14
14
  @host = options[:host] || 'example.org'
15
15
  @title = options[:title] || host
16
-
16
+
17
17
  Adva.out = StringIO.new('')
18
18
  end
19
19
 
@@ -35,34 +35,55 @@ module Adva
35
35
  Import.new(:source => source).run
36
36
  Export.new(app, :target => target).run
37
37
  end
38
-
38
+
39
39
  def setup_source_repository
40
40
  root.join('.gitignore').rmtree rescue Errno::ENOENT
41
41
  root.join('.git').rmtree rescue Errno::ENOENT
42
-
42
+
43
43
  File.open(root.join('.gitignore'), 'w+') { |f| f.write('export') }
44
-
44
+
45
45
  Dir.chdir(root) do
46
- `git init`
47
- `git add .`
48
- `git commit -am '#{host} source'`
49
- `git branch source`
50
- `git checkout --quiet source`
51
- `git branch -D master`
52
- `git remote add origin #{remote} -t source` if remote
46
+ init_repository
47
+ commit("#{host} source")
48
+ checkout_branch('source')
49
+ delete_branch('master')
50
+ add_remote('source') if remote
53
51
  end
54
52
  end
55
-
53
+
56
54
  def setup_export_repository
57
55
  root.join('export/.git').rmtree rescue Errno::ENOENT
58
56
 
59
57
  Dir.chdir(target) do
58
+ init_repository
59
+ commit("#{host} export")
60
+ add_remote('master') if remote
61
+ end
62
+ end
63
+
64
+ protected
65
+
66
+ def init_repository
60
67
  `git init`
68
+ end
69
+
70
+ def commit(message)
61
71
  `git add .`
62
- `git commit -am '#{host} export'`
63
- `git remote add origin #{remote} -t master` if remote
72
+ `git commit -am '#{message}'`
73
+ end
74
+
75
+ def checkout_branch(name)
76
+ `git branch #{name}`
77
+ `git checkout --quiet #{name}`
78
+ end
79
+
80
+ def delete_branch(name)
81
+ `git branch -D #{name}`
82
+ end
83
+
84
+ def add_remote(branch)
85
+ `git remote add origin #{remote} -t #{branch}`
64
86
  end
65
- end
66
87
  end
67
88
  end
68
- end
89
+ end
@@ -1,3 +1,3 @@
1
1
  module AdvaStatic
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adva-static
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
5
- prerelease: false
4
+ hash: 15
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 7
10
- version: 0.0.7
9
+ - 8
10
+ version: 0.0.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sven Fuchs
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-31 00:00:00 +01:00
18
+ date: 2011-02-13 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  requirements: []
145
145
 
146
146
  rubyforge_project: "[none]"
147
- rubygems_version: 1.3.7
147
+ rubygems_version: 1.5.0
148
148
  signing_key:
149
149
  specification_version: 3
150
150
  summary: Static engine for adva-cms2