matrioshka 0.1.0
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.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/init.rb +1 -0
- data/lib/generators/matrioshka/install_generator.rb +41 -0
- data/lib/generators/matrioshka/templates/application.gemspec +20 -0
- data/lib/generators/matrioshka/templates/engine.rb +15 -0
- data/lib/generators/matrioshka/templates/init.rb +1 -0
- data/lib/generators/matrioshka/templates/matrioshka.rake +14 -0
- data/lib/matrioshka.rb +8 -0
- data/lib/matrioshka/generator.rb +18 -0
- data/lib/matrioshka/version.rb +3 -0
- data/matrioshka.gemspec +19 -0
- metadata +61 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Boris Staal
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Matrioshka
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'matrioshka'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install matrioshka
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "matrioshka"
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Matrioshka
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < ::Rails::Generators::Base
|
4
|
+
source_root File.expand_path('../templates', __FILE__)
|
5
|
+
|
6
|
+
def install
|
7
|
+
template "matrioshka.rake", "lib/tasks/matrioshka.rake"
|
8
|
+
template "engine.rb", "lib/#{application.underscore}.rb"
|
9
|
+
template "init.rb", "init.rb"
|
10
|
+
template "application.gemspec", "#{application.underscore.gsub('/', '-')}.gemspec"
|
11
|
+
|
12
|
+
%w(
|
13
|
+
config.ru
|
14
|
+
Rakefile
|
15
|
+
config/environment.rb
|
16
|
+
config/routes.rb
|
17
|
+
config/environments/development.rb
|
18
|
+
config/environments/production.rb
|
19
|
+
config/environments/test.rb
|
20
|
+
config/initializers/secret_token.rb
|
21
|
+
config/initializers/session_store.rb
|
22
|
+
).each do |f|
|
23
|
+
if File.exists?(Rails.root.join f)
|
24
|
+
gsub_explicit_application_name f
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
protected
|
30
|
+
|
31
|
+
def gsub_explicit_application_name(file)
|
32
|
+
gsub_file file, Rails.application.class.name, 'Rails.application.class'
|
33
|
+
end
|
34
|
+
|
35
|
+
def application
|
36
|
+
@application ||= Rails.application.class.name.deconstantize
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require '<%= application.underscore %>'
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = '<%= application.underscore.gsub('/', '-') %>'
|
7
|
+
gem.version = <%= application %>::VERSION
|
8
|
+
gem.authors = ['']
|
9
|
+
gem.email = ['']
|
10
|
+
gem.description = %q{Write a gem description}
|
11
|
+
gem.summary = %q{Write a gem summary}
|
12
|
+
gem.homepage = ''
|
13
|
+
gem.files = `git ls-files`.split($/)
|
14
|
+
|
15
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
16
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
|
+
gem.require_paths = ['lib']
|
18
|
+
|
19
|
+
gem.add_dependency 'matrioshka', '>= 0.1.0'
|
20
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rails/engine'
|
2
|
+
|
3
|
+
module <%= application %>
|
4
|
+
VERSION = '0.0.1'
|
5
|
+
|
6
|
+
class Engine < ::Rails::Engine
|
7
|
+
initializer 'matrioshka', :before => :set_autoload_paths do |app|
|
8
|
+
app.class.configure do
|
9
|
+
config.i18n.load_path += Dir[<%= application %>::Engine.root.join(*%w(config locales *.{rb,yml})).to_s]
|
10
|
+
config.autoload_paths += %W(#{<%= application %>::Engine.root.join 'lib'})
|
11
|
+
config.paths['db/migrate'] += <%= application %>::Engine.paths['db/migrate'].existent
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require '<%= application.underscore %>'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'matrioshka'
|
2
|
+
|
3
|
+
namespace '<%= application.underscore.gsub('/', '_') %>' do
|
4
|
+
task :link do
|
5
|
+
generator = Matrioshka::Generator.new
|
6
|
+
location = File.expand_path File.join(*['..']*3), __FILE__
|
7
|
+
|
8
|
+
if location == Rails.root.to_s
|
9
|
+
puts "This task was successfully registered. Call it from the gem consumer not from the gem itself."
|
10
|
+
else
|
11
|
+
generator.copy_gemfile_from location, '<%= application.underscore.gsub('/', '_') %>'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/matrioshka.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
module Matrioshka
|
2
|
+
class Generator < Rails::Generators::Base
|
3
|
+
source_root '.'
|
4
|
+
|
5
|
+
def copy_gemfile_from(location, name)
|
6
|
+
copy_file Pathname.new(location).join('Gemfile'), "Gemfile.#{name}"
|
7
|
+
prepend_gemfile name
|
8
|
+
|
9
|
+
inside Rails.root do
|
10
|
+
run "bundle install"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def prepend_gemfile(name)
|
15
|
+
prepend_file 'Gemfile', "eval_gemfile 'Gemfile.#{name}'\n"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/matrioshka.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'matrioshka/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "matrioshka"
|
8
|
+
gem.version = Matrioshka::VERSION
|
9
|
+
gem.authors = ["Boris Staal"]
|
10
|
+
gem.email = ["boris@roundlake.ru"]
|
11
|
+
gem.description = %q{Turn your Rails 3 application into a gem}
|
12
|
+
gem.summary = gem.description
|
13
|
+
gem.homepage = ""
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: matrioshka
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Boris Staal
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-01-12 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Turn your Rails 3 application into a gem
|
15
|
+
email:
|
16
|
+
- boris@roundlake.ru
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE.txt
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- init.rb
|
27
|
+
- lib/generators/matrioshka/install_generator.rb
|
28
|
+
- lib/generators/matrioshka/templates/application.gemspec
|
29
|
+
- lib/generators/matrioshka/templates/engine.rb
|
30
|
+
- lib/generators/matrioshka/templates/init.rb
|
31
|
+
- lib/generators/matrioshka/templates/matrioshka.rake
|
32
|
+
- lib/matrioshka.rb
|
33
|
+
- lib/matrioshka/generator.rb
|
34
|
+
- lib/matrioshka/version.rb
|
35
|
+
- matrioshka.gemspec
|
36
|
+
homepage: ''
|
37
|
+
licenses: []
|
38
|
+
post_install_message:
|
39
|
+
rdoc_options: []
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
requirements: []
|
55
|
+
rubyforge_project:
|
56
|
+
rubygems_version: 1.8.15
|
57
|
+
signing_key:
|
58
|
+
specification_version: 3
|
59
|
+
summary: Turn your Rails 3 application into a gem
|
60
|
+
test_files: []
|
61
|
+
has_rdoc:
|