No submodule mapping found in .gitmodules for path 'sinatra-bootstrap'
It is possible that the index special entry representing the submodule SHA1 for sinatra-bootstrap
could have been replaced with a plain old folder instead.
Try to remove it from the index:
git rm --cached `sinatra-bootstrap`
git submodule update --init
If have no entry in your .gitmodules and want one for a sinatra-bootstrap
path, then you will need to properly add it first
git submodule add /url/for/sinatra-bootstrap sinatra-bootstrap
Exract path and url from config file via regex
This file format is something of a standard and so I imagine there is a gem or other code floating around that will parse it. On the other hand, it's easy to parse and encapsulated little text problems like this are "the fun part" of development, so why not reinvent the wheel? It's kind of like playing a game...
require 'pp'
def scangc
result = h = {}
open '../.gitconfig', 'r' do |f|
while s = f.gets
s.strip!
if s[0..0] == '['
result[s[1..-2].to_sym] = h = Hash.new
next
end
raise 'expected =' unless s['=']
a = s.strip.split /\s+=\s+/
h[a[0].to_sym] = a[1]
end
end
pp result
end
scangc
How do I update my git submodules from specific branches?
now I need to update the submodules into the project.
The parent repo only records SHA1 (in a special gitlink entry, mode 160000)
You can, in your rails4
branch, update your .gitmodules in order to ask your submodule to checkout/update their rails4
branch: see "Git submodules: Specify a branch/tag" for the full process: it starts with:
cd /path/to/your/parent/repo
git config -f .gitmodules submodule.<path>.branch <branch>
That will allow for a git submodule update --recursive --remote
to update the rails4
branch in those submodules.
How can I get Rspec2 to support models and specs in a different path?
To load shared/models, you do have to add it to config.autoload_paths.
Then to load your spec from shared/spec, add this to spec_helper.rb:
shared_model_specs = config.filename_pattern.split(",").collect do |pattern|
Dir["shared/spec/models/#{pattern.strip}"]
end.flatten
config.files_to_run.concat shared_model_specs
Just a side note for other guys interested, if your spec files are in the normal spec folder but under a customized sub folder, you can load it like this:
config.include RSpec::Rails::ModelExampleGroup, :type => :model, :example_group => {
:file_path => config.escaped_path(%w[spec shared models])
}
PS: I would recommend putting the shared code or modules into a gem, then use them in the two projects. This way the gem contains its own tests and referencing it from multiple projects is much easier and organized.
I have a ruby project that needs a submodule from github
From git submodule --help
we can see:
git submodule [--quiet] add [-b branch] [-f|--force]
[--reference <repository>] [--] <repository> [<path>]
So, given a repository "my-plugin" at "git@github.com:my-user/my-plugin.git", you would use
git submodule add git@github.com/my-user/my-plugin.git vendor/plugins/my-plugin
Related Topics
Use [].Replace to Make a Copy of an Array
Shading Mask Algorithm for Radiation Calculations
How to Iterate Through This JSON Document Using Ruby
Run Ruby Script That Is Stored on Internet
Generating Devise Controllers - Rails Devise
Ruby Daemon Process to Keep Objects Alive for Transient Ruby Instances
Has_Many and No Method Error Issue
How to Run Rails App in a Completely Isolated Instances of Chrome
Ruby String Split into Words Ignoring All Special Characters: Simpler Query
Any Standard Guide for Ruby Win32Ole API
Uninitialized Constant Applicationrecord Error
Will_Paginate Can It Order by Day
Rails 4 - Heroku SQLite3 Error