hosted_gem_development 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ # General Ruby.
2
+ /.bundle
3
+ .ref-*
4
+ .old*
5
+ *-old*
6
+ /.rvmrc
7
+
8
+ # Project-specific.
9
+ /*.rb
10
+ /doc/
11
+ /pkg/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem dependencies in `PROJECT.gemspec`.
4
+ gemspec
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011-2012 Alex Fortuna
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,80 @@
1
+
2
+ Hosted gem/plugin development infrastructure
3
+ ============================================
4
+
5
+
6
+ Introduction
7
+ ------------
8
+
9
+ Developing gems is often tricky because they act like separate projects with regard to the applications you use them in.
10
+
11
+ "Hosted" development infrastructure **makes gem development easier** by including them into (making them "hosted by") your live application.
12
+ Then you update your gem's code like you update regular application code.
13
+
14
+
15
+ Setup
16
+ -----
17
+
18
+ Add to your `Gemfile`:
19
+
20
+ ~~~
21
+ gem "hosted_gem_development"
22
+ #gem "hosted_gem_development", :git => "git://github.com/dadooda/hosted_gem_development.git" # Edge version.
23
+ ~~~
24
+
25
+ Install the gem:
26
+
27
+ ~~~
28
+ $ bundle install
29
+ ~~~
30
+
31
+ Generate essentials:
32
+
33
+ ~~~
34
+ $ rails generate hosted_gem_development
35
+ ~~~
36
+
37
+ Ensure `config/boot.rb` does this before the `Gemfile` line:
38
+
39
+ ~~~
40
+ require File.expand_path("../clone_hosted_gems", __FILE__)
41
+ ~~~
42
+
43
+ Ensure `.gitignore` contains the following:
44
+
45
+ ~~~
46
+ /vendor/gems_dev/
47
+ /vendor/plugins_dev/
48
+ ~~~
49
+
50
+ Check out the gem you are working on:
51
+
52
+ ~~~
53
+ $ cd vendor/gems_dev
54
+ $ git clone git://github.com/author/cool_gem.git
55
+ ~~~
56
+
57
+ Include the gem into your `Gemfile`:
58
+
59
+ ~~~
60
+ gem "cool_gem", :path => "vendor/gems/cool_gem"
61
+ ~~~
62
+
63
+
64
+ Now you can work on `vendor/gems_dev/cool_gem` like you do on regular
65
+ application code. Changes to the gem become **instantly available** to
66
+ the application whenever you load your Rails environment.
67
+
68
+
69
+ Copyright
70
+ ---------
71
+
72
+ Copyright © 2012 Alex Fortuna.
73
+
74
+ Licensed under the MIT License.
75
+
76
+
77
+ Feedback
78
+ --------
79
+
80
+ Send bug reports, suggestions and criticisms through [project's page on GitHub](http://github.com/dadooda/hosted_gem_development).
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,19 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "hosted_gem_development"
3
+ s.version = "0.1.0"
4
+ s.authors = ["Alex Fortuna"]
5
+ s.email = ["alex.r@askit.org"]
6
+ s.homepage = "http://github.com/dadooda/hosted_gem_development"
7
+
8
+ # Copy these from class's description, adjust markup.
9
+ s.summary = %q{Hosted gem/plugin development infrastructure}
10
+ s.description = %q{"Hosted" development infrastructure makes gem development easier by including them into (making them "hosted by") your live application.
11
+ Then you update your gem's code like you update regular application code.
12
+ }
13
+ # end of s.description=
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map {|f| File.basename(f)}
18
+ s.require_paths = ["lib"]
19
+ end
@@ -0,0 +1,2 @@
1
+ Example:
2
+ `rails generate hosted_gem_development`
@@ -0,0 +1,13 @@
1
+ class HostedGemDevelopmentGenerator < Rails::Generators::Base #:nodoc:
2
+ source_root File.expand_path("../templates", __FILE__)
3
+
4
+ def go
5
+ copy_file (bn = "clone_hosted_gems.rb"), "config/#{bn}"
6
+ # NOTE: It's possible to check the insertion status, but we'd better output the complete INSTALL anyway.
7
+ insert_into_file "config/boot.rb", %{require File.expand_path("../clone_hosted_gems", __FILE__)\n\n}, :before => "# Set up gems listed in the Gemfile.\n"
8
+ append_to_file ".gitignore", "/vendor/gems_dev/\n/vendor/plugins_dev/\n"
9
+ empty_directory "vendor/gems_dev"
10
+ empty_directory "vendor/plugins_dev"
11
+ readme "INSTALL"
12
+ end
13
+ end
@@ -0,0 +1,29 @@
1
+
2
+ Finalizing setup
3
+ ================
4
+
5
+ Ensure `config/boot.rb` does this before the `Gemfile` line:
6
+
7
+ require File.expand_path("../clone_hosted_gems", __FILE__)
8
+
9
+ Ensure `.gitignore` contains the following:
10
+
11
+ /vendor/gems_dev/
12
+ /vendor/plugins_dev/
13
+
14
+ Check out the gem you are working on:
15
+
16
+ $ cd vendor/gems_dev
17
+ $ git clone git://github.com/author/cool_gem.git
18
+
19
+ Include the gem into your `Gemfile`:
20
+
21
+ gem "cool_gem", :path => "vendor/gems/cool_gem"
22
+
23
+
24
+ Now you can work on `vendor/gems_dev/cool_gem` like you do on regular
25
+ application code. Changes to the gem become **instantly available** to
26
+ the application whenever you load your Rails environment.
27
+
28
+ Good luck!
29
+
@@ -0,0 +1,38 @@
1
+ # Clone (vendorize) hosted development gems/plugins.
2
+ # Require this script in `boot.rb` before `Gemfile` is sourced:
3
+ #
4
+ # require File.expand_path("../clone_hosted_gems", __FILE__)
5
+
6
+ verbose = STDOUT.tty? # Verbose on TTYs, quiet otherwise.
7
+ #verbose = false # Always quiet.
8
+
9
+ ["gems", "plugins"].each do |subject|
10
+ # List items to clone. Append "-" to directory name to have it skipped.
11
+ items = begin
12
+ # WARNING: chdir.
13
+ Dir.chdir("vendor/#{subject}_dev") do
14
+ Dir["*"].select do |fn|
15
+ File.directory?(fn) and not fn =~ /-\z/
16
+ end
17
+ end
18
+ rescue Errno::ENOENT
19
+ []
20
+ end
21
+
22
+ print "Cloning hosted #{subject}:" if verbose
23
+
24
+ # NOTE: Use `system` here and below to see error messages, if any.
25
+ system "mkdir -p vendor/#{subject}"
26
+
27
+ # WARNING: chdir.
28
+ Dir.chdir("vendor/#{subject}") do
29
+ items.each do |item|
30
+ print " #{item}" if verbose
31
+ system "rm -rf --preserve-root #{item}"
32
+ system "cp -r ../#{subject}_dev/#{item} ."
33
+ system "rm -rf --preserve-root #{item}/.git"
34
+ end
35
+ end
36
+
37
+ puts if verbose
38
+ end # [...].each do |subject|
metadata ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hosted_gem_development
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Alex Fortuna
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-06 00:00:00.000000000Z
13
+ dependencies: []
14
+ description: ! '"Hosted" development infrastructure makes gem development easier by
15
+ including them into (making them "hosted by") your live application.
16
+
17
+ Then you update your gem''s code like you update regular application code.
18
+
19
+ '
20
+ email:
21
+ - alex.r@askit.org
22
+ executables: []
23
+ extensions: []
24
+ extra_rdoc_files: []
25
+ files:
26
+ - .gitignore
27
+ - Gemfile
28
+ - MIT-LICENSE
29
+ - README.md
30
+ - Rakefile
31
+ - hosted_gem_development.gemspec
32
+ - lib/generators/hosted_gem_development/USAGE
33
+ - lib/generators/hosted_gem_development/hosted_gem_development_generator.rb
34
+ - lib/generators/hosted_gem_development/templates/INSTALL
35
+ - lib/generators/hosted_gem_development/templates/clone_hosted_gems.rb
36
+ homepage: http://github.com/dadooda/hosted_gem_development
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.10
57
+ signing_key:
58
+ specification_version: 3
59
+ summary: Hosted gem/plugin development infrastructure
60
+ test_files: []