nested_file 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b40badf177648290c0c85809c58efc792687cdcc
4
+ data.tar.gz: e6ec2f27834bf0b8d17e24f8af6a7669a7ed5baa
5
+ SHA512:
6
+ metadata.gz: f8f0ac3ba39cd6fc93ac51e812546ef0e0123bf819a2a0ece1f1648d60de0953c8d6080c101ad3eb6b9cf026d4689236fb49641bf8244a28a732e8eaf8019503
7
+ data.tar.gz: 0e7e4a740b7223c1a7ce5cfa62b0528ef35172c4edc16b28a949f164499edcdc9075c5868d350cea5b69022ae26fa05f4ee5218ff117135503aef55aba1ca69d
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ sudo: required
2
+ dist: trusty
3
+ before_install:
4
+ - sudo apt-get install -qq pkg-config fuse
5
+ - sudo modprobe fuse
6
+ - sudo chmod 666 /dev/fuse
7
+ - sudo chown root:$USER /etc/fuse.conf
8
+ install: gem install rfuse && bundle install
9
+ language: ruby
10
+ rvm:
11
+ - 2.3.1
data/Gemfile ADDED
@@ -0,0 +1,36 @@
1
+ ruby '2.3.1'
2
+
3
+ source "http://rubygems.org"
4
+ # Add dependencies required to use your gem here.
5
+ # Example:
6
+ # gem "activesupport", ">= 2.3.5"
7
+
8
+ # Add dependencies to develop your gem here.
9
+ # Include everything needed to run rake, tests, features, etc.
10
+ group :development do
11
+ gem "rspec", "~> 2.8.0"
12
+ gem "rdoc", "~> 3.12"
13
+ gem "bundler", ">= 1.0.0"
14
+ gem "jeweler"
15
+ #gem "rcov", ">= 0"
16
+
17
+ gem 'guard'
18
+ gem 'guard-rspec'
19
+ gem 'guard-spork'
20
+
21
+ gem 'rb-fsevent', '~> 0.9'
22
+
23
+ gem 'lre'
24
+
25
+ gem 'rr'
26
+ end
27
+
28
+ gem 'mharris_ext'
29
+ gem 'rfusefs'
30
+ # gem 'rfuse', github: "winebarrel/rfuse", branch: 'master'
31
+
32
+ # group :development do
33
+ # gem 'sys-filesystem'
34
+ # gem "ffi-xattr", ">= 0.1.1"
35
+ # end
36
+
data/Gemfile.lock ADDED
@@ -0,0 +1,135 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ addressable (2.4.0)
5
+ builder (3.2.2)
6
+ celluloid (0.16.0)
7
+ timers (~> 4.0.0)
8
+ childprocess (0.5.9)
9
+ ffi (~> 1.0, >= 1.0.11)
10
+ coderay (1.1.1)
11
+ descendants_tracker (0.0.4)
12
+ thread_safe (~> 0.3, >= 0.3.1)
13
+ diff-lcs (1.1.3)
14
+ facets (3.0.0)
15
+ faraday (0.9.2)
16
+ multipart-post (>= 1.2, < 3)
17
+ fattr (2.3.0)
18
+ ffi (1.9.10)
19
+ formatador (0.2.5)
20
+ git (1.3.0)
21
+ github_api (0.13.1)
22
+ addressable (~> 2.4.0)
23
+ descendants_tracker (~> 0.0.4)
24
+ faraday (~> 0.8, < 0.10)
25
+ hashie (>= 3.4)
26
+ multi_json (>= 1.7.5, < 2.0)
27
+ oauth2
28
+ guard (2.6.1)
29
+ formatador (>= 0.2.4)
30
+ listen (~> 2.7)
31
+ lumberjack (~> 1.0)
32
+ pry (>= 0.9.12)
33
+ thor (>= 0.18.1)
34
+ guard-compat (1.2.1)
35
+ guard-rspec (1.2.2)
36
+ guard (>= 1.1)
37
+ guard-spork (2.1.0)
38
+ childprocess (>= 0.2.3)
39
+ guard (~> 2.0)
40
+ guard-compat (~> 1.0)
41
+ spork (>= 0.8.4)
42
+ hashie (3.4.4)
43
+ highline (1.7.8)
44
+ hitimes (1.2.4)
45
+ jeweler (2.1.1)
46
+ builder
47
+ bundler (>= 1.0)
48
+ git (>= 1.2.5)
49
+ github_api
50
+ highline (>= 1.6.15)
51
+ nokogiri (>= 1.5.10)
52
+ rake
53
+ rdoc
54
+ semver
55
+ json (1.8.3)
56
+ jwt (1.5.1)
57
+ listen (2.10.1)
58
+ celluloid (~> 0.16.0)
59
+ rb-fsevent (>= 0.9.3)
60
+ rb-inotify (>= 0.9)
61
+ lre (0.3.1)
62
+ fattr
63
+ mharris_ext
64
+ watchr
65
+ lumberjack (1.0.10)
66
+ method_source (0.8.2)
67
+ mharris_ext (1.7.1)
68
+ facets
69
+ fattr
70
+ mini_portile2 (2.0.0)
71
+ multi_json (1.12.0)
72
+ multi_xml (0.5.5)
73
+ multipart-post (2.0.0)
74
+ nokogiri (1.6.7.2)
75
+ mini_portile2 (~> 2.0.0.rc2)
76
+ oauth2 (1.1.0)
77
+ faraday (>= 0.8, < 0.10)
78
+ jwt (~> 1.0, < 1.5.2)
79
+ multi_json (~> 1.3)
80
+ multi_xml (~> 0.5)
81
+ rack (>= 1.2, < 3)
82
+ pry (0.10.3)
83
+ coderay (~> 1.1.0)
84
+ method_source (~> 0.8.1)
85
+ slop (~> 3.4)
86
+ rack (1.6.4)
87
+ rake (11.1.2)
88
+ rb-fsevent (0.9.7)
89
+ rb-inotify (0.9.7)
90
+ ffi (>= 0.5.0)
91
+ rdoc (3.12.2)
92
+ json (~> 1.4)
93
+ rfuse (1.1.1.RC0)
94
+ rfusefs (1.0.3)
95
+ rfuse (~> 1.1)
96
+ rr (1.1.2)
97
+ rspec (2.8.0)
98
+ rspec-core (~> 2.8.0)
99
+ rspec-expectations (~> 2.8.0)
100
+ rspec-mocks (~> 2.8.0)
101
+ rspec-core (2.8.0)
102
+ rspec-expectations (2.8.0)
103
+ diff-lcs (~> 1.1.2)
104
+ rspec-mocks (2.8.0)
105
+ semver (1.0.1)
106
+ slop (3.6.0)
107
+ spork (0.9.2)
108
+ thor (0.19.1)
109
+ thread_safe (0.3.5)
110
+ timers (4.0.4)
111
+ hitimes
112
+ watchr (0.7)
113
+
114
+ PLATFORMS
115
+ ruby
116
+
117
+ DEPENDENCIES
118
+ bundler (>= 1.0.0)
119
+ guard
120
+ guard-rspec
121
+ guard-spork
122
+ jeweler
123
+ lre
124
+ mharris_ext
125
+ rb-fsevent (~> 0.9)
126
+ rdoc (~> 3.12)
127
+ rfusefs
128
+ rr
129
+ rspec (~> 2.8.0)
130
+
131
+ RUBY VERSION
132
+ ruby 2.3.1p112
133
+
134
+ BUNDLED WITH
135
+ 1.12.2
data/Guardfile ADDED
@@ -0,0 +1,24 @@
1
+
2
+
3
+ # guard 'rspec' do
4
+ # watch(%r{^spec/.+_spec\.rb$})
5
+ # watch(%r{^lib/(.+)\.rb$}) { "spec" } # { |m| "spec/lib/#{m[1]}_spec.rb" }
6
+ # watch(%r{^lib/(.+)\.treetop$}) { "spec" }
7
+ # watch(%r{^lib/(.+)\.csv$}) { "spec" }
8
+ # watch(%r{^spec/(.+)\.txt$}) { "spec" }
9
+ # #watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
10
+ # watch('spec/spec_helper.rb') { "spec" }
11
+ # end
12
+
13
+
14
+
15
+
16
+
17
+ guard("rspec", :all_on_start => true, :all_after_pass => false, :zeus => false, :cli => "--color --fail-fast", cmd: 'bundle exec rspec') do
18
+ watch(%r{^spec/.+?_spec\.rb$})
19
+ watch(%r{^lib/(.+?)\.rb$}) {|match| "spec/lib/#{match[1]}_spec.rb"}
20
+ watch(%r{^app/models/(.+)\.rb}) {|match| "spec/models/#{match[1]}_spec.rb"}
21
+ watch(%r{^app/controllers/(.+)\.rb}) {|match| "spec/controllers/#{match[1]}_spec.rb"}
22
+ watch(%r{^app/emailer/(.+)\.rb}) {|match| "spec/emailer/#{match[1]}_spec.rb"}
23
+ watch(%r{^app/mailer/messenger_mailer\.rb}) {|match| "spec/lib/jobs/messenger_emailer_spec.rb"}
24
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 Mike Harris
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.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = nested_file
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to nested_file
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
+ * Fork the project.
10
+ * Start a feature/bugfix branch.
11
+ * Commit and push until you are happy with your contribution.
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * 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.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2013 Mike Harris. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,55 @@
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 = "nested_file"
18
+ gem.homepage = "http://github.com/mharris717/nested_file"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{nested_file}
21
+ gem.description = %Q{nested_file}
22
+ gem.email = "mharris717@gmail.com"
23
+ gem.authors = ["Mike Harris"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec) do |spec|
31
+ spec.pattern = FileList['spec/**/*_spec.rb']
32
+ end
33
+
34
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
35
+ spec.pattern = 'spec/**/*_spec.rb'
36
+ spec.rcov = true
37
+ end
38
+
39
+ task :default => :spec
40
+
41
+ require 'rdoc/task'
42
+ Rake::RDocTask.new do |rdoc|
43
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
44
+
45
+ rdoc.rdoc_dir = 'rdoc'
46
+ rdoc.title = "nested_file #{version}"
47
+ rdoc.rdoc_files.include('README*')
48
+ rdoc.rdoc_files.include('lib/**/*.rb')
49
+ end
50
+
51
+ namespace :spec do
52
+ task :watch do
53
+ exec "cd util && node watch.js"
54
+ end
55
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
data/bin/nested_file ADDED
@@ -0,0 +1,6 @@
1
+ load File.dirname(__FILE__) + "/../lib/nested_file.rb"
2
+
3
+ parent_dir, mount_dir, relative_dir = *ARGV
4
+
5
+ dir = NestedFile::PutDir.new(:parent_dir => parent_dir, :mount_dir => mount_dir, relative_dir: relative_dir)
6
+ FuseFS.start(dir,mount_dir)
@@ -0,0 +1,8 @@
1
+ require 'rubygems'
2
+ require 'rfusefs'
3
+ require 'mharris_ext'
4
+
5
+ %w(util file_group file_section put_dir put_file).each do |file|
6
+ dir = File.expand_path(File.dirname(__FILE__))
7
+ load File.join(dir,"nested_file","#{file}.rb")
8
+ end
@@ -0,0 +1,22 @@
1
+ module NestedFile
2
+ class FileGroup
3
+ include FromHash
4
+ attr_accessor :parent_file, :file_glob, :convert_path, :full_glob
5
+ fattr(:files_to_insert) do
6
+ log "expanded #{file_glob} -> #{full_glob} ->" do
7
+ Dir[full_glob].sort
8
+ end
9
+ end
10
+ fattr(:sections) do
11
+ files_to_insert.map do |f|
12
+ fp = convert_path.parent_to_mount(f)
13
+ #full = File.join File.dirname(parent_file.filename),fp
14
+ FileSection.new(file_to_insert: fp, full_file_to_insert: f)
15
+ end
16
+ end
17
+ def to_s
18
+ res = sections.join("\n")
19
+ "<files #{file_glob}>\n#{res}\n</files>"
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,43 @@
1
+ module NestedFile
2
+ module FileSection
3
+ def self.new(*args)
4
+ Read.new(*args)
5
+ end
6
+
7
+ class Read
8
+ include FromHash
9
+ attr_accessor :file_to_insert, :full_file_to_insert
10
+
11
+ fattr(:insert_body) do
12
+ if FileTest.exist?(full_file_to_insert)
13
+ File.read(full_file_to_insert)
14
+ else
15
+ log "file to insert #{full_file_to_insert} doesn't exist"
16
+ ""
17
+ end
18
+ end
19
+
20
+ def to_s
21
+ "<file #{file_to_insert}>\n#{insert_body}\n</file>"
22
+ end
23
+ end
24
+
25
+ class Write
26
+ include FromHash
27
+ attr_accessor :parent_body, :full_file_to_insert
28
+
29
+ fattr(:trimmed_parent_body) do
30
+ parent_body.scan(/\A\n?(.*?)\n?\Z/m).first.first
31
+ end
32
+
33
+ def should_write?
34
+ trimmed_parent_body.present?
35
+ end
36
+ def write!
37
+ return unless should_write?
38
+ log "writing to #{full_file_to_insert}"
39
+ File.create full_file_to_insert, trimmed_parent_body
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,25 @@
1
+ require 'mharris_ext'
2
+
3
+ module FileTag
4
+ class Definition
5
+ include FromHash
6
+ attr_accessor :reg, :names
7
+ end
8
+ class DSL
9
+ include FromHash
10
+ fattr(:definitions) { [] }
11
+ def tag(reg,*names)
12
+ self.definitions << Definition.new(:reg => reg, :names => names)
13
+ end
14
+ end
15
+
16
+ def self.configure(&b)
17
+ dsl = DSL.new
18
+ b[dsl]
19
+ puts "Defs #{dsl.definitions.size}"
20
+ end
21
+ end
22
+
23
+ FileTag.configure do |t|
24
+ t.tag /app\/models\/(.+)\.rb/, :model, 1
25
+ end