gitmodel-rails 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "gitmodel"
4
+ gem "rails", "~> 3.2"
5
+
6
+ group :development do
7
+ gem "bundler"
8
+ gem "jeweler", "~> 1.8.4"
9
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,110 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ actionmailer (3.2.6)
5
+ actionpack (= 3.2.6)
6
+ mail (~> 2.4.4)
7
+ actionpack (3.2.6)
8
+ activemodel (= 3.2.6)
9
+ activesupport (= 3.2.6)
10
+ builder (~> 3.0.0)
11
+ erubis (~> 2.7.0)
12
+ journey (~> 1.0.1)
13
+ rack (~> 1.4.0)
14
+ rack-cache (~> 1.2)
15
+ rack-test (~> 0.6.1)
16
+ sprockets (~> 2.1.3)
17
+ activemodel (3.2.6)
18
+ activesupport (= 3.2.6)
19
+ builder (~> 3.0.0)
20
+ activerecord (3.2.6)
21
+ activemodel (= 3.2.6)
22
+ activesupport (= 3.2.6)
23
+ arel (~> 3.0.2)
24
+ tzinfo (~> 0.3.29)
25
+ activeresource (3.2.6)
26
+ activemodel (= 3.2.6)
27
+ activesupport (= 3.2.6)
28
+ activesupport (3.2.6)
29
+ i18n (~> 0.6)
30
+ multi_json (~> 1.0)
31
+ arel (3.0.2)
32
+ builder (3.0.0)
33
+ diff-lcs (1.1.3)
34
+ erubis (2.7.0)
35
+ git (1.2.5)
36
+ gitmodel (0.0.7)
37
+ activemodel (>= 3.0.1)
38
+ activesupport (>= 3.0.1)
39
+ grit (>= 2.3.0)
40
+ lockfile (>= 1.4.3)
41
+ memcache-client (>= 1.8.5)
42
+ yajl-ruby (>= 0.8.2)
43
+ grit (2.5.0)
44
+ diff-lcs (~> 1.1)
45
+ mime-types (~> 1.15)
46
+ posix-spawn (~> 0.3.6)
47
+ hike (1.2.1)
48
+ i18n (0.6.0)
49
+ jeweler (1.8.4)
50
+ bundler (~> 1.0)
51
+ git (>= 1.2.5)
52
+ rake
53
+ rdoc
54
+ journey (1.0.4)
55
+ json (1.7.3)
56
+ lockfile (2.1.0)
57
+ mail (2.4.4)
58
+ i18n (>= 0.4.0)
59
+ mime-types (~> 1.16)
60
+ treetop (~> 1.4.8)
61
+ memcache-client (1.8.5)
62
+ mime-types (1.19)
63
+ multi_json (1.3.6)
64
+ polyglot (0.3.3)
65
+ posix-spawn (0.3.6)
66
+ rack (1.4.1)
67
+ rack-cache (1.2)
68
+ rack (>= 0.4)
69
+ rack-ssl (1.3.2)
70
+ rack
71
+ rack-test (0.6.1)
72
+ rack (>= 1.0)
73
+ rails (3.2.6)
74
+ actionmailer (= 3.2.6)
75
+ actionpack (= 3.2.6)
76
+ activerecord (= 3.2.6)
77
+ activeresource (= 3.2.6)
78
+ activesupport (= 3.2.6)
79
+ bundler (~> 1.0)
80
+ railties (= 3.2.6)
81
+ railties (3.2.6)
82
+ actionpack (= 3.2.6)
83
+ activesupport (= 3.2.6)
84
+ rack-ssl (~> 1.3.2)
85
+ rake (>= 0.8.7)
86
+ rdoc (~> 3.4)
87
+ thor (>= 0.14.6, < 2.0)
88
+ rake (0.9.2.2)
89
+ rdoc (3.12)
90
+ json (~> 1.4)
91
+ sprockets (2.1.3)
92
+ hike (~> 1.2)
93
+ rack (~> 1.0)
94
+ tilt (~> 1.1, != 1.3.0)
95
+ thor (0.15.4)
96
+ tilt (1.3.3)
97
+ treetop (1.4.10)
98
+ polyglot
99
+ polyglot (>= 0.3.1)
100
+ tzinfo (0.3.33)
101
+ yajl-ruby (1.1.0)
102
+
103
+ PLATFORMS
104
+ ruby
105
+
106
+ DEPENDENCIES
107
+ bundler
108
+ gitmodel
109
+ jeweler (~> 1.8.4)
110
+ rails (~> 3.2)
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 mcasimir
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # gitmodel-rails
2
+
3
+ **gitmodel-rails** is a rails gem that integrates [Gitmodel](https://github.com/pauldowman/gitmodel) with Ruby on Rails ~> 3.2
4
+
5
+ ## Install
6
+
7
+ Put this in your `Gemfile`
8
+
9
+ ``` rb
10
+ gem 'gitmodel-rails'
11
+ ```
12
+ and run `bundle install`
13
+
14
+ *NB.* you can remove any explicit dependency on `gitmodel` from your `Gemfile` since it is automatically required by `gitmodel-rails`
15
+
16
+ ### Generate `config/gitmodel.yml`
17
+
18
+ ```
19
+ rails g gitmodel:install
20
+ ```
21
+
22
+ ### Configuring gitmodel
23
+
24
+ ``` yml
25
+ gitmodel:
26
+ db_root: db/gitmodel # joined with Rails.root
27
+ default_branch: master
28
+
29
+ git_user_name: "Git username"
30
+ git_user_email: "Git user email"
31
+
32
+ memcache_servers:
33
+ - server.1.memcache
34
+ - server.2.memcache
35
+
36
+ memcache_namespace: "app_memcache_ns"
37
+
38
+ ```
39
+
40
+ ## Generate your first git-backed model
41
+
42
+ ```
43
+ rails g gitmodel:model Page
44
+ ```
45
+
46
+ == Contributing to gitmodel-rails
47
+
48
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
49
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
50
+ * Fork the project.
51
+ * Start a feature/bugfix branch.
52
+ * Commit and push until you are happy with your contribution.
53
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
54
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
55
+
56
+ == Copyright
57
+
58
+ Copyright (c) 2012 mcasimir. See LICENSE.txt for
59
+ further details.
60
+
data/Rakefile ADDED
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "gitmodel-rails"
18
+ gem.homepage = "http://github.com/mcasimir/gitmodel-rails"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{A Rails gem that integrates Gitmodel (https://github.com/pauldowman/gitmodel) with Ruby on Rails}
21
+ gem.description = %Q{A Rails gem that integrates Gitmodel (https://github.com/pauldowman/gitmodel) with Ruby on Rails}
22
+ gem.email = "maurizio.cas@gmail.com"
23
+ gem.authors = ["mcasimir"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.1
@@ -0,0 +1,59 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "gitmodel-rails"
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["mcasimir"]
12
+ s.date = "2012-07-25"
13
+ s.description = "A Rails gem that integrates Gitmodel (https://github.com/pauldowman/gitmodel) with Ruby on Rails"
14
+ s.email = "maurizio.cas@gmail.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.md"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE.txt",
24
+ "README.md",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "gitmodel-rails.gemspec",
28
+ "lib/generators/gitmodel/install/install_generator.rb",
29
+ "lib/generators/gitmodel/model/model_generator.rb",
30
+ "lib/gitmodel-rails.rb"
31
+ ]
32
+ s.homepage = "http://github.com/mcasimir/gitmodel-rails"
33
+ s.licenses = ["MIT"]
34
+ s.require_paths = ["lib"]
35
+ s.rubygems_version = "1.8.24"
36
+ s.summary = "A Rails gem that integrates Gitmodel (https://github.com/pauldowman/gitmodel) with Ruby on Rails"
37
+
38
+ if s.respond_to? :specification_version then
39
+ s.specification_version = 3
40
+
41
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
42
+ s.add_runtime_dependency(%q<gitmodel>, [">= 0"])
43
+ s.add_runtime_dependency(%q<rails>, ["~> 3.2"])
44
+ s.add_development_dependency(%q<bundler>, [">= 0"])
45
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
46
+ else
47
+ s.add_dependency(%q<gitmodel>, [">= 0"])
48
+ s.add_dependency(%q<rails>, ["~> 3.2"])
49
+ s.add_dependency(%q<bundler>, [">= 0"])
50
+ s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
51
+ end
52
+ else
53
+ s.add_dependency(%q<gitmodel>, [">= 0"])
54
+ s.add_dependency(%q<rails>, ["~> 3.2"])
55
+ s.add_dependency(%q<bundler>, [">= 0"])
56
+ s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
57
+ end
58
+ end
59
+
@@ -0,0 +1,19 @@
1
+ module Gitmodel
2
+ class InstallGenerator < Rails::Generators::Base
3
+ source_root File.expand_path('../templates', __FILE__)
4
+
5
+ def create_config
6
+ create_file(Rails.root.join("config", "gitmodel.yml") do
7
+ <<-eos
8
+ git:
9
+ db_root: db/gitmodel
10
+ default_branch: master
11
+
12
+
13
+ eos
14
+
15
+ end
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module Gitmodel
2
+ class ModelGenerator < Rails::Generators::NamedBase
3
+ source_root File.expand_path('../templates', __FILE__)
4
+
5
+ def create_model
6
+ create_file(Rails.root.join("app", "models", "#{name.underscore.singularize}.rb") do
7
+ <<-eos
8
+ class #{name.camelize.singularize}
9
+ include GitModel::Persistable
10
+
11
+ end
12
+
13
+ eos
14
+
15
+ end
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,31 @@
1
+ require 'rails'
2
+ require 'gitmodel'
3
+
4
+ module GitmodelRails
5
+ class Railtie < ::Rails::Railtie #:nodoc:
6
+ initializer 'gitmodel-rails' do |app|
7
+
8
+ gitmodel_config_file = Rails.root.join("config", "gitmodel.yml")
9
+
10
+ unless File.exist?(gitmodel_config_file)
11
+ raise "Gitmodel: configuration file not found"
12
+ end
13
+
14
+ gitmodel_config = YAML.load_file(gitmodel_config_file)
15
+ gitmodel_config = gitmodel_config.is_a?(Hash) ? gitmodel_config : {}
16
+ GitModel.db_root = gitmodel_config.fetch("gitmodel", nil).try(:fetch, "db_root", GitModel.db_root)
17
+ GitModel.default_branch = gitmodel_config.fetch("gitmodel", nil).try(:fetch, "default_branch", GitModel.default_branch)
18
+ GitModel.git_user_name = gitmodel_config.fetch("gitmodel", nil).try(:fetch, "git_user_name", GitModel.git_user_name)
19
+ GitModel.git_user_email = gitmodel_config.fetch("gitmodel", nil).try(:fetch, "git_user_email", GitModel.git_user_email)
20
+ GitModel.memcache_servers = Array.wrap gitmodel_config.fetch("gitmodel", nil).try(:fetch, "memcache_servers", nil)
21
+ GitModel.memcache_namespace = gitmodel_config.fetch("gitmodel", nil).try(:fetch, "memcache_namespace", GitModel.git_user_email)
22
+
23
+ GitModel.db_root = Rails.root.join(GitModel.db_root)
24
+
25
+ unless File.exist?(GitModel.db_root)
26
+ GitModel.create_db!
27
+ end
28
+
29
+ end
30
+ end
31
+ end
metadata ADDED
@@ -0,0 +1,127 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gitmodel-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - mcasimir
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-07-25 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: gitmodel
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rails
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '3.2'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '3.2'
46
+ - !ruby/object:Gem::Dependency
47
+ name: bundler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: jeweler
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 1.8.4
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.8.4
78
+ description: A Rails gem that integrates Gitmodel (https://github.com/pauldowman/gitmodel)
79
+ with Ruby on Rails
80
+ email: maurizio.cas@gmail.com
81
+ executables: []
82
+ extensions: []
83
+ extra_rdoc_files:
84
+ - LICENSE.txt
85
+ - README.md
86
+ files:
87
+ - .document
88
+ - Gemfile
89
+ - Gemfile.lock
90
+ - LICENSE.txt
91
+ - README.md
92
+ - Rakefile
93
+ - VERSION
94
+ - gitmodel-rails.gemspec
95
+ - lib/generators/gitmodel/install/install_generator.rb
96
+ - lib/generators/gitmodel/model/model_generator.rb
97
+ - lib/gitmodel-rails.rb
98
+ homepage: http://github.com/mcasimir/gitmodel-rails
99
+ licenses:
100
+ - MIT
101
+ post_install_message:
102
+ rdoc_options: []
103
+ require_paths:
104
+ - lib
105
+ required_ruby_version: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ segments:
112
+ - 0
113
+ hash: 1926084905046772441
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ none: false
116
+ requirements:
117
+ - - ! '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ requirements: []
121
+ rubyforge_project:
122
+ rubygems_version: 1.8.24
123
+ signing_key:
124
+ specification_version: 3
125
+ summary: A Rails gem that integrates Gitmodel (https://github.com/pauldowman/gitmodel)
126
+ with Ruby on Rails
127
+ test_files: []