ginst 0.1.3 → 0.2.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.
Files changed (58) hide show
  1. data.tar.gz.sig +0 -0
  2. data/Manifest +34 -8
  3. data/Rakefile +6 -3
  4. data/bin/ginst +11 -4
  5. data/features/browsing_project.feature +20 -0
  6. data/features/manage_projects.feature +36 -0
  7. data/features/manage_server.feature +17 -0
  8. data/features/step_definitions/manage_projects_steps.rb +35 -0
  9. data/features/step_definitions/manage_server_steps.rb +33 -0
  10. data/features/step_definitions/webrat_steps.rb +99 -0
  11. data/features/support/env.rb +29 -0
  12. data/features/support/git.rb +22 -0
  13. data/features/support/paths.rb +16 -0
  14. data/ginst.gemspec +8 -11
  15. data/lib/app/authorization.rb +1 -1
  16. data/lib/app/views/_commit.haml +8 -0
  17. data/lib/app/views/commit.haml +38 -8
  18. data/lib/app/views/commits.haml +1 -1
  19. data/lib/app/views/edit.haml +11 -0
  20. data/lib/app/views/layout.haml +10 -7
  21. data/lib/app/views/new.haml +19 -0
  22. data/lib/app/views/project.haml +4 -1
  23. data/lib/app/views/ref.haml +3 -0
  24. data/lib/app/views/style.sass +0 -1
  25. data/lib/app/webserver.rb +66 -76
  26. data/lib/ginst.rb +7 -5
  27. data/lib/ginst/core_extensions.rb +32 -0
  28. data/lib/ginst/ginst.rb +5 -72
  29. data/lib/ginst/project.rb +13 -38
  30. data/lib/ginst/project/base.rb +59 -0
  31. data/lib/ginst/project/build.rb +117 -0
  32. data/lib/ginst/project/commit_db.rb +29 -0
  33. data/lib/ginst/project/finders.rb +17 -0
  34. data/lib/ginst/project/grit.rb +53 -0
  35. data/lib/ginst/project/validations.rb +60 -0
  36. data/lib/ginst/test.rb +8 -0
  37. data/lib/ginst/test/base.rb +17 -0
  38. data/lib/ginst/test/dir.rb +39 -0
  39. data/lib/ginst/test/repo.rb +13 -0
  40. data/lib/ginst/test/run.rb +11 -0
  41. data/lib/ginst/web_server.rb +43 -0
  42. data/spec/fixtures/sample_repo.zip +0 -0
  43. data/spec/models/project_base_spec.rb +56 -0
  44. data/spec/models/project_build_spec.rb +18 -0
  45. data/spec/models/project_commit_db_spec.rb +19 -0
  46. data/spec/models/project_finders_spec.rb +34 -0
  47. data/spec/models/project_grit_spec.rb +19 -0
  48. data/spec/models/project_validations_spec.rb +72 -0
  49. data/spec/spec_helper.rb +8 -0
  50. metadata +56 -29
  51. metadata.gz.sig +0 -0
  52. data/lib/app/views/full_commit.haml +0 -38
  53. data/lib/app/views/project_index.haml +0 -11
  54. data/lib/ginst/command_line.rb +0 -47
  55. data/lib/ginst/master_command_line.rb +0 -40
  56. data/lib/ginst/plugin.rb +0 -16
  57. data/lib/ginst/server.rb +0 -51
  58. data/lib/ginst/templates/rgithook.rb +0 -6
@@ -0,0 +1,13 @@
1
+ module Ginst::Test
2
+
3
+
4
+ # return a factory made repo inside ginst temp dir
5
+ def create_sample_repo(dir = nil)
6
+ dir ||= create_temp_dir
7
+ in_dir(dir) do
8
+ %x(unzip #{fixture_path('sample_repo.zip')})
9
+ end
10
+ dir
11
+ end
12
+
13
+ end
@@ -0,0 +1,11 @@
1
+ require 'open3'
2
+ module Ginst::Test
3
+
4
+
5
+ # return a factory made repo inside ginst temp dir
6
+ def run(command)
7
+ stdin,stdout,stderr = Open3.popen3(command)
8
+ [stdout.read, stderr.read]
9
+ end
10
+
11
+ end
@@ -0,0 +1,43 @@
1
+ require 'daemons'
2
+ module Ginst
3
+ module WebServer
4
+ class << self
5
+
6
+ SERVER=File.dirname(__FILE__)+'/../app/webserver.rb'
7
+ DAEMON_OPT = {
8
+ :app_name => "ginst",
9
+ :dir_mode => :normal,
10
+ :ARGV => ["status"],
11
+ :dir => Dir.pwd,
12
+ :multiple => false,
13
+ :ontop => false,
14
+ :mode => :exec,
15
+ :monitor => true
16
+ }
17
+
18
+ def start
19
+ fork{Daemons.run(SERVER,build_opts('start'))}
20
+ end
21
+
22
+ def stop
23
+ Daemons.run(SERVER,build_opts('stop'))
24
+ end
25
+
26
+ def status
27
+ Daemons.run(SERVER,build_opts('status'))
28
+ end
29
+
30
+ private
31
+
32
+ def build_opts(action)
33
+ case action
34
+ when 'start'
35
+ DAEMON_OPT.merge({:ARGV => [action, '--', '-e production']})
36
+ else
37
+ DAEMON_OPT.merge({:ARGV => [action]})
38
+ end
39
+ end
40
+
41
+ end
42
+ end
43
+ end
Binary file
@@ -0,0 +1,56 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+
3
+ describe Ginst::Project do
4
+
5
+ context "Base" do
6
+ before(:each) do
7
+ ::Grit::Repo.stub!(:new).and_return(true)
8
+ File.should_receive(:read).with('./projects.yml').and_return("--- \n- !ruby/object:Ginst::Project \n dir: /home/guille\n name: guille\n")
9
+ Ginst::Ginst.working_dir = '.'
10
+ Ginst::Project.load_projects
11
+ end
12
+
13
+ it "should load existing projects" do
14
+ prjs = Ginst::Project.projects
15
+ prjs.size.should == 1
16
+ prjs.first.dir.should == '/home/guille'
17
+ prjs.first.name.should == 'guille'
18
+ end
19
+
20
+ it "should be able to save" do
21
+
22
+ file = Object.new
23
+ File.should_receive(:open).with('./projects.yml','w').and_return(file)
24
+ file.should_receive(:write).with(
25
+ "--- \n- !ruby/object:Ginst::Project \n dir: /home/guille\n name: guille\n- !ruby/object:Ginst::Project \n dir: dir\n name: prj\n")
26
+ file.should_receive(:close)
27
+
28
+ Ginst::Project.new(VALID_ARGS).save.should be
29
+ end
30
+
31
+ it "should be not create a project when update" do
32
+
33
+ file = Object.new
34
+ File.should_receive(:open).with('projects.yml','w').and_return(file)
35
+ file.should_receive(:write).with("--- \n- !ruby/object:Ginst::Project \n dir: /home/guille\n name: Project 2\n")
36
+ file.should_receive(:close)
37
+
38
+ Ginst::Project.projects
39
+ Ginst::Project.projects.first.name = 'Project 2'
40
+ Ginst::Project.projects.first.save.should be
41
+ end
42
+
43
+ end
44
+
45
+ end
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
@@ -0,0 +1,18 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+
3
+ describe Ginst::Project do
4
+ context "Build" do
5
+
6
+ end
7
+ end
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
@@ -0,0 +1,19 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+
3
+ describe Ginst::Project do
4
+
5
+ context "Commit db" do
6
+
7
+ end
8
+ end
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
@@ -0,0 +1,34 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+
3
+ describe Ginst::Project do
4
+
5
+
6
+ context 'Finders' do
7
+ before(:each) do
8
+ ::Grit::Repo.stub!(:new).and_return(true)
9
+ File.should_receive(:read).with('projects.yml').and_return("--- \n- !ruby/object:Ginst::Project \n dir: /home/guille\n name: guille!!\n")
10
+ Ginst::Project.load_projects
11
+ @prj = Ginst::Project.projects.first
12
+ end
13
+
14
+ it "should be able to find by name" do
15
+ Ginst::Project.find_by_name('guille!!').should be(@prj)
16
+ end
17
+
18
+ it "should be able to find by slug" do
19
+ Ginst::Project.find_by_slug(@prj.name.slug).should be(@prj)
20
+ end
21
+ end
22
+
23
+ end
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
@@ -0,0 +1,19 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+
3
+ describe Ginst::Project do
4
+
5
+ context "Grit" do
6
+
7
+ end
8
+ end
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
@@ -0,0 +1,72 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+
3
+ describe Ginst::Project do
4
+
5
+ context "Validations" do
6
+ before(:each) do
7
+ ::Grit::Repo.stub!(:new).and_return(true)
8
+ File.stub!(:read).with('projects.yml').and_return("--- \n- !ruby/object:Ginst::Project \n dir: /home/guille\n name: guille\n")
9
+ Ginst::Project.load_projects
10
+ @prj = Ginst::Project.projects.first
11
+ end
12
+
13
+
14
+ it "should have errors on name if there is no name" do
15
+ @prj.name = nil
16
+ @prj.should_not be_valid
17
+
18
+ @prj.name = ''
19
+ @prj.should_not be_valid
20
+ end
21
+
22
+ it "should have errors on dir if the dir doesn't exists" do
23
+ ::Grit::Repo.should_receive(:new).and_raise(::Grit::NoSuchPathError)
24
+
25
+ @prj.should_not be_valid
26
+ @prj.errors["dir"].should be
27
+ end
28
+
29
+ it "should have errors on dir if the dir is not a valid git dir" do
30
+ ::Grit::Repo.should_receive(:new).and_raise(::Grit::InvalidGitRepositoryError)
31
+
32
+ @prj.should_not be_valid
33
+ @prj.errors["dir"].should be
34
+ end
35
+
36
+ it "should be able to save a valid project" do
37
+ ::Grit::Repo.should_receive(:new).with('dir').and_return(true)
38
+
39
+ Ginst::Project.projects.size.should be(1)
40
+ prj = Ginst::Project.new(VALID_ARGS)
41
+ prj.should be_valid
42
+ end
43
+
44
+ it "should not be valid if there is one with the same slug name" do
45
+ p = Ginst::Project.new(:name => 'guille++', :dir => 'dir')
46
+
47
+ p.should_not be_valid
48
+ p.errors["name"].should be
49
+ end
50
+
51
+ it "should not be valid if there is one with the same dir" do
52
+ p = Ginst::Project.new(:name => 'guille++', :dir => '/home/guille')
53
+
54
+ p.should_not be_valid
55
+ p.errors["dir"].should be
56
+ end
57
+
58
+ end
59
+
60
+
61
+ end
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
@@ -0,0 +1,8 @@
1
+ require File.dirname(__FILE__)+'/../lib/ginst'
2
+ require File.dirname(__FILE__)+'/../features/support/git'
3
+
4
+ require 'ruby-debug'
5
+ require 'fileutils'
6
+
7
+ include Ginst::Test
8
+ VALID_ARGS = {"name" => 'prj', "dir" => 'dir'}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ginst
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Guillermo \xC3\x81lvarez"
@@ -30,7 +30,7 @@ cert_chain:
30
30
  IfYzkN8c0X6VDPrCKbd4IbEe
31
31
  -----END CERTIFICATE-----
32
32
 
33
- date: 2009-02-03 00:00:00 +01:00
33
+ date: 2009-04-21 00:00:00 +02:00
34
34
  default_executable:
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
@@ -39,20 +39,10 @@ dependencies:
39
39
  version_requirement:
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  requirements:
42
- - - ~>
42
+ - - ">"
43
43
  - !ruby/object:Gem::Version
44
44
  version: 0.9.4
45
45
  version:
46
- - !ruby/object:Gem::Dependency
47
- name: rgithook
48
- type: :runtime
49
- version_requirement:
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ~>
53
- - !ruby/object:Gem::Version
54
- version: 3.0.0
55
- version:
56
46
  - !ruby/object:Gem::Dependency
57
47
  name: daemons
58
48
  type: :runtime
@@ -98,65 +88,102 @@ extra_rdoc_files:
98
88
  - bin/ginst_master
99
89
  - CHANGELOG
100
90
  - lib/app/authorization.rb
91
+ - lib/app/views/_commit.haml
101
92
  - lib/app/views/assets/jquery.corners.js
102
93
  - lib/app/views/assets/jquery.js
103
94
  - lib/app/views/branch_index.haml
104
95
  - lib/app/views/clean_layout.haml
105
96
  - lib/app/views/commit.haml
106
97
  - lib/app/views/commits.haml
107
- - lib/app/views/full_commit.haml
98
+ - lib/app/views/edit.haml
108
99
  - lib/app/views/index.haml
109
100
  - lib/app/views/layout.haml
101
+ - lib/app/views/new.haml
110
102
  - lib/app/views/not_found.haml
111
103
  - lib/app/views/project.haml
112
- - lib/app/views/project_index.haml
104
+ - lib/app/views/ref.haml
113
105
  - lib/app/views/style.sass
114
106
  - lib/app/webserver.rb
115
- - lib/ginst/command_line.rb
107
+ - lib/ginst/core_extensions.rb
116
108
  - lib/ginst/ginst.rb
117
- - lib/ginst/master_command_line.rb
118
- - lib/ginst/plugin.rb
109
+ - lib/ginst/project/base.rb
110
+ - lib/ginst/project/build.rb
111
+ - lib/ginst/project/commit_db.rb
112
+ - lib/ginst/project/finders.rb
113
+ - lib/ginst/project/grit.rb
114
+ - lib/ginst/project/validations.rb
119
115
  - lib/ginst/project.rb
120
- - lib/ginst/server.rb
121
- - lib/ginst/templates/rgithook.rb
116
+ - lib/ginst/test/base.rb
117
+ - lib/ginst/test/dir.rb
118
+ - lib/ginst/test/repo.rb
119
+ - lib/ginst/test/run.rb
120
+ - lib/ginst/test.rb
121
+ - lib/ginst/web_server.rb
122
122
  - lib/ginst.rb
123
123
  - README.txt
124
124
  files:
125
125
  - bin/ginst
126
126
  - bin/ginst_master
127
127
  - CHANGELOG
128
- - ginst.gemspec
128
+ - features/browsing_project.feature
129
+ - features/manage_projects.feature
130
+ - features/manage_server.feature
131
+ - features/step_definitions/manage_projects_steps.rb
132
+ - features/step_definitions/manage_server_steps.rb
133
+ - features/step_definitions/webrat_steps.rb
134
+ - features/support/env.rb
135
+ - features/support/git.rb
136
+ - features/support/paths.rb
129
137
  - lib/app/authorization.rb
138
+ - lib/app/views/_commit.haml
130
139
  - lib/app/views/assets/jquery.corners.js
131
140
  - lib/app/views/assets/jquery.js
132
141
  - lib/app/views/branch_index.haml
133
142
  - lib/app/views/clean_layout.haml
134
143
  - lib/app/views/commit.haml
135
144
  - lib/app/views/commits.haml
136
- - lib/app/views/full_commit.haml
145
+ - lib/app/views/edit.haml
137
146
  - lib/app/views/index.haml
138
147
  - lib/app/views/layout.haml
148
+ - lib/app/views/new.haml
139
149
  - lib/app/views/not_found.haml
140
150
  - lib/app/views/project.haml
141
- - lib/app/views/project_index.haml
151
+ - lib/app/views/ref.haml
142
152
  - lib/app/views/style.sass
143
153
  - lib/app/webserver.rb
144
- - lib/ginst/command_line.rb
154
+ - lib/ginst/core_extensions.rb
145
155
  - lib/ginst/ginst.rb
146
- - lib/ginst/master_command_line.rb
147
- - lib/ginst/plugin.rb
156
+ - lib/ginst/project/base.rb
157
+ - lib/ginst/project/build.rb
158
+ - lib/ginst/project/commit_db.rb
159
+ - lib/ginst/project/finders.rb
160
+ - lib/ginst/project/grit.rb
161
+ - lib/ginst/project/validations.rb
148
162
  - lib/ginst/project.rb
149
- - lib/ginst/server.rb
150
- - lib/ginst/templates/rgithook.rb
163
+ - lib/ginst/test/base.rb
164
+ - lib/ginst/test/dir.rb
165
+ - lib/ginst/test/repo.rb
166
+ - lib/ginst/test/run.rb
167
+ - lib/ginst/test.rb
168
+ - lib/ginst/web_server.rb
151
169
  - lib/ginst.rb
152
170
  - Manifest
153
171
  - Rakefile
154
172
  - README.txt
173
+ - spec/fixtures/sample_repo.zip
174
+ - spec/models/project_base_spec.rb
175
+ - spec/models/project_build_spec.rb
176
+ - spec/models/project_commit_db_spec.rb
177
+ - spec/models/project_finders_spec.rb
178
+ - spec/models/project_grit_spec.rb
179
+ - spec/models/project_validations_spec.rb
180
+ - spec/spec_helper.rb
155
181
  - test/app/test_webserver.rb
156
182
  - test/test_ginst.rb
157
183
  - test/test_helper.rb
158
184
  - test/test_project.rb
159
185
  - test/test_server.rb
186
+ - ginst.gemspec
160
187
  has_rdoc: true
161
188
  homepage: http://github.com/guillermo/ginst
162
189
  post_install_message:
@@ -187,7 +214,7 @@ rubyforge_project: ginst
187
214
  rubygems_version: 1.3.1
188
215
  signing_key:
189
216
  specification_version: 2
190
- summary: With ginst you can send e-mails, twittes, record changes, run tests, deploy machines automatically every time you push to a server. You can manage all within its own web page. You can use for just one repo, or for all. It support GitHub push services
217
+ summary: Git Integration System
191
218
  test_files:
192
219
  - test/app/test_webserver.rb
193
220
  - test/test_ginst.rb