project_group 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NWY1YzczN2U2NWQ0NWYwYThjNmNiZjg5NzgyNTZjNmYxZTQ2NTVhNw==
5
+ data.tar.gz: !binary |-
6
+ YmYwNDg4YmI4OWRmY2Y3ODc3MDI0NGQzMjUxNTZiYzZiYWEyMjBiMw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MmUwNmE2MGE0MmM3NmNmOGM2ZjY2YzVmOGM5NWU5YTI3ZDc5NGQ2MDE4NTAx
10
+ ZWFiMmFkOTE2ZGQ2ODY0OThjZmE1MGM1ZDA5MDZmN2EzMWMxN2VmNTA4Yjc3
11
+ NmZjYmNmOGFiNDZkNmQ5MGQ0ODViZjBjNDkwY2UyYjkyYzljMjM=
12
+ data.tar.gz: !binary |-
13
+ YjBkYjM0NGY2MGQ4MGRlM2U0YWM2NWUxMjNhNGM5ZTkwYWMyZjA1YzJlZmI1
14
+ ZTdjMmM5MjZlNTRkN2Q1NTM0NTNlNTBhMTBkNGZhNjY0NGI2ZTI2YmIzNDUx
15
+ M2ExOWMwNGEwMmViMGE5MTRkY2Q2Mzc2NzJiNmViNWRiYWZjNmE=
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/Gemfile ADDED
@@ -0,0 +1,28 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "rspec", "~> 2.8.0"
10
+ gem "rdoc", "~> 3.12"
11
+ gem "bundler", ">= 1.0"
12
+ gem "jeweler", "~> 1.8.7", :git => "https://github.com/technicalpickles/jeweler.git"
13
+ # gem "rcov", ">= 0"
14
+
15
+ gem 'guard'
16
+ gem 'guard-rspec'
17
+ gem 'guard-spork'
18
+
19
+ gem 'rb-fsevent', '~> 0.9'
20
+
21
+ gem 'lre'
22
+
23
+ gem 'rr'
24
+ end
25
+
26
+ gem 'mharris_ext'
27
+ gem 'andand'
28
+ gem 'grit'
data/Gemfile.lock ADDED
@@ -0,0 +1,130 @@
1
+ GIT
2
+ remote: https://github.com/technicalpickles/jeweler.git
3
+ revision: f7e0a55a207d83f56637dd8fbabf26a803410faf
4
+ specs:
5
+ jeweler (1.8.7)
6
+ builder
7
+ bundler (~> 1.0)
8
+ git (>= 1.2.5)
9
+ github_api (= 0.10.1)
10
+ highline (>= 1.6.15)
11
+ nokogiri (= 1.5.10)
12
+ rake
13
+ rdoc
14
+
15
+ GEM
16
+ remote: http://rubygems.org/
17
+ specs:
18
+ addressable (2.3.5)
19
+ andand (1.3.3)
20
+ builder (3.2.2)
21
+ childprocess (0.3.9)
22
+ ffi (~> 1.0, >= 1.0.11)
23
+ coderay (1.0.9)
24
+ diff-lcs (1.1.3)
25
+ facets (2.9.3)
26
+ faraday (0.8.8)
27
+ multipart-post (~> 1.2.0)
28
+ fattr (2.2.1)
29
+ ffi (1.9.0)
30
+ formatador (0.2.4)
31
+ git (1.2.6)
32
+ github_api (0.10.1)
33
+ addressable
34
+ faraday (~> 0.8.1)
35
+ hashie (>= 1.2)
36
+ multi_json (~> 1.4)
37
+ nokogiri (~> 1.5.2)
38
+ oauth2
39
+ grit (2.5.0)
40
+ diff-lcs (~> 1.1)
41
+ mime-types (~> 1.15)
42
+ posix-spawn (~> 0.3.6)
43
+ guard (1.8.2)
44
+ formatador (>= 0.2.4)
45
+ listen (>= 1.0.0)
46
+ lumberjack (>= 1.0.2)
47
+ pry (>= 0.9.10)
48
+ thor (>= 0.14.6)
49
+ guard-rspec (1.2.1)
50
+ guard (>= 1.1)
51
+ guard-spork (1.5.0)
52
+ childprocess (>= 0.2.3)
53
+ guard (>= 1.1)
54
+ spork (>= 0.8.4)
55
+ hashie (2.0.5)
56
+ highline (1.6.19)
57
+ httpauth (0.2.0)
58
+ json (1.8.0)
59
+ jwt (0.1.8)
60
+ multi_json (>= 1.5)
61
+ listen (1.3.0)
62
+ rb-fsevent (>= 0.9.3)
63
+ rb-inotify (>= 0.9)
64
+ rb-kqueue (>= 0.2)
65
+ lre (0.3.0)
66
+ fattr
67
+ mharris_ext
68
+ watchr
69
+ lumberjack (1.0.4)
70
+ method_source (0.8.2)
71
+ mharris_ext (1.7.0)
72
+ facets
73
+ fattr
74
+ mime-types (1.24)
75
+ multi_json (1.8.0)
76
+ multi_xml (0.5.5)
77
+ multipart-post (1.2.0)
78
+ nokogiri (1.5.10)
79
+ oauth2 (0.9.2)
80
+ faraday (~> 0.8)
81
+ httpauth (~> 0.2)
82
+ jwt (~> 0.1.4)
83
+ multi_json (~> 1.0)
84
+ multi_xml (~> 0.5)
85
+ rack (~> 1.2)
86
+ posix-spawn (0.3.6)
87
+ pry (0.9.12.2)
88
+ coderay (~> 1.0.5)
89
+ method_source (~> 0.8)
90
+ slop (~> 3.4)
91
+ rack (1.5.2)
92
+ rake (10.1.0)
93
+ rb-fsevent (0.9.3)
94
+ rb-inotify (0.9.1)
95
+ ffi (>= 0.5.0)
96
+ rb-kqueue (0.2.0)
97
+ ffi (>= 0.5.0)
98
+ rdoc (3.12.2)
99
+ json (~> 1.4)
100
+ rr (1.1.2)
101
+ rspec (2.8.0)
102
+ rspec-core (~> 2.8.0)
103
+ rspec-expectations (~> 2.8.0)
104
+ rspec-mocks (~> 2.8.0)
105
+ rspec-core (2.8.0)
106
+ rspec-expectations (2.8.0)
107
+ diff-lcs (~> 1.1.2)
108
+ rspec-mocks (2.8.0)
109
+ slop (3.4.6)
110
+ spork (0.9.2)
111
+ thor (0.18.1)
112
+ watchr (0.7)
113
+
114
+ PLATFORMS
115
+ ruby
116
+
117
+ DEPENDENCIES
118
+ andand
119
+ bundler (>= 1.0)
120
+ grit
121
+ guard
122
+ guard-rspec
123
+ guard-spork
124
+ jeweler (~> 1.8.7)!
125
+ lre
126
+ mharris_ext
127
+ rb-fsevent (~> 0.9)
128
+ rdoc (~> 3.12)
129
+ rr
130
+ rspec (~> 2.8.0)
data/Guardfile ADDED
@@ -0,0 +1,34 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ if true
5
+ guard 'spork', :rspec_port => 5710 do
6
+ watch('config/application.rb')
7
+ watch('config/environment.rb')
8
+ watch('config/environments/test.rb')
9
+ watch(%r{^config/initializers/.+\.rb$})
10
+ watch('Gemfile')
11
+ watch('Gemfile.lock')
12
+ watch('spec/spec_helper.rb') { :rspec }
13
+ watch('test/test_helper.rb') { :test_unit }
14
+ watch(%r{features/support/}) { :cucumber }
15
+ watch(%r{^spec/support/.+\.rb$})
16
+ end
17
+ end
18
+
19
+
20
+
21
+
22
+ guard 'rspec', :cli => "--drb --drb-port 5710" do
23
+ watch(%r{^spec/.+_spec\.rb$})
24
+ watch(%r{^lib/(.+)\.rb$}) { "spec" } # { |m| "spec/lib/#{m[1]}_spec.rb" }
25
+ watch(%r{^lib/(.+)\.treetop$}) { "spec" }
26
+ watch(%r{^lib/(.+)\.csv$}) { "spec" }
27
+ #watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
28
+ watch('spec/spec_helper.rb') { "spec" }
29
+ end
30
+
31
+
32
+
33
+
34
+
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
+ = project_group
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to project_group
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,49 @@
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 = "project_group"
18
+ gem.homepage = "http://github.com/mharris717/project_group"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{project_group}
21
+ gem.description = %Q{project_group}
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 = "project_group #{version}"
47
+ rdoc.rdoc_files.include('README*')
48
+ rdoc.rdoc_files.include('lib/**/*.rb')
49
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
data/bin/proj ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ load File.dirname(__FILE__) + "/../lib/project_group.rb"
4
+
5
+ cmd = ProjectGroup::Command.new
6
+ cmd.parse! ARGV
7
+ cmd.run!
@@ -0,0 +1,18 @@
1
+ require 'mharris_ext'
2
+ require 'grit'
3
+ require 'ostruct'
4
+ require 'json'
5
+ require 'optparse'
6
+ require 'andand'
7
+
8
+ module ProjectGroup
9
+ class << self
10
+ def ec(cmd)
11
+ `#{cmd}`
12
+ end
13
+ end
14
+ end
15
+
16
+ %w(single repo group command config sublime_project).each do |f|
17
+ load File.dirname(__FILE__) + "/project_group/#{f}.rb"
18
+ end
@@ -0,0 +1,72 @@
1
+ module ProjectGroup
2
+ class Command
3
+ include FromHash
4
+ attr_accessor :cmd, :group_name
5
+
6
+ fattr(:groupx) do
7
+ res = Group.new
8
+ res << "/code/orig/project_group"
9
+ res
10
+ end
11
+
12
+ fattr(:group) do
13
+ if group_name
14
+ Configs.loaded.groups.find { |x| x.name == group_name }
15
+ else
16
+ Configs.loaded.local_group
17
+ end.tap { |x| raise "no group #{group_name}" unless x }
18
+ end
19
+
20
+ def run!
21
+ send(cmd)
22
+ end
23
+
24
+ def cycle
25
+ group.singles.each do |proj|
26
+ puts "#{proj.path} #{proj.status.inspect} #{proj.spec_output}"
27
+ end
28
+ end
29
+
30
+ def info
31
+ puts "Group #{group.name}"
32
+ group.singles.each do |proj|
33
+ puts "#{proj.name} #{proj.path}"
34
+ end
35
+ end
36
+
37
+ def open
38
+ proj = SublimeProject.new(:group => group)
39
+ proj.write!
40
+ ec "subl --project #{proj.path}"
41
+ end
42
+
43
+ def push
44
+ group.singles.each do |proj|
45
+ if !proj.repo.pushed?
46
+ ec "cd #{proj.path} && git push origin master:master"
47
+ end
48
+ end
49
+ end
50
+
51
+ def git
52
+ group.singles.each do |proj|
53
+ if proj.repo.changes?
54
+ ec "gittower #{proj.path}"
55
+ puts "Enter to Continue"
56
+ STDIN.gets
57
+ end
58
+ end
59
+ end
60
+
61
+ def parse!(args)
62
+ self.cmd = args.first
63
+ OptionParser.new do |opts|
64
+ opts.banner = "Usage: example.rb [options]"
65
+
66
+ opts.on("-n", "--name name", "Group Name") do |v|
67
+ self.group_name = v
68
+ end
69
+ end.parse!(args)
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,98 @@
1
+ module ProjectGroup
2
+ class DSLWrapper
3
+ include FromHash
4
+ attr_accessor :obj
5
+ def initialize(obj)
6
+ @obj = obj
7
+ end
8
+ def method_missing(sym,*args,&b)
9
+ if args.empty?
10
+ obj.send sym
11
+ else
12
+ obj.send "#{sym}=",args.first
13
+ end
14
+ end
15
+ end
16
+
17
+ class GroupWrapper < DSLWrapper
18
+ fattr(:project_names) { [] }
19
+ attr_accessor :configs
20
+ attr_accessor :local
21
+
22
+ def singles
23
+ project_names.map do |name|
24
+ configs.projects.find { |x| x.name == name }
25
+ end
26
+ end
27
+ fattr(:loaded_group) do
28
+ obj.singles = singles
29
+ obj
30
+ end
31
+ def project(name,&b)
32
+ self.project_names << name
33
+ if block_given?
34
+ configs.project(name,&b)
35
+ end
36
+ end
37
+ def name(name)
38
+ end
39
+ end
40
+
41
+ class Configs
42
+ fattr(:dir) do
43
+ File.expand_path("~/.project_group")
44
+ end
45
+ def load!
46
+ Dir["#{dir}/*.rb"].each do |f|
47
+ load f
48
+ end
49
+ global_groups = group_configs.clone
50
+
51
+ locals = ["#{Dir.getwd}/.project_group.rb","#{Dir.getwd}/.project_group"]
52
+ locals.each do |f|
53
+ if FileTest.exist?(f)
54
+ load(f)
55
+ local_groups = group_configs - global_groups
56
+ local_groups.first.local = true if local_groups.size > 0
57
+ end
58
+ end
59
+ end
60
+ fattr(:projects) { [] }
61
+ fattr(:group_configs) { [] }
62
+ fattr(:groups) do
63
+ group_configs.map { |x| x.loaded_group }
64
+ end
65
+
66
+ def project(name,&b)
67
+ c = DSLWrapper.new(Single.new(:name => name))
68
+ b[c]
69
+ self.projects << c.obj
70
+ end
71
+
72
+ def group(name,&b)
73
+ c = GroupWrapper.new(Group.new(:name => name))
74
+ c.configs = self
75
+ b[c]
76
+ self.group_configs << c
77
+ end
78
+
79
+ def local_group
80
+ local_config = group_configs.find { |x| x.local }
81
+ local_config.andand.loaded_group
82
+ end
83
+
84
+ class << self
85
+ fattr(:instance) { new }
86
+ fattr(:loaded) do
87
+ instance.load!
88
+ instance
89
+ end
90
+ def project(name,&b)
91
+ instance.project(name,&b)
92
+ end
93
+ def group(name,&b)
94
+ instance.group(name,&b)
95
+ end
96
+ end
97
+ end
98
+ end