intent 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b571afb18d67bd6b6ae48ec431e200f47418f0b6
4
- data.tar.gz: 3ca943e19b1bcf8af6854894c5e2b27c35ccfdd5
3
+ metadata.gz: ea2daf59cb345df7bd72c851cddc2ecde68784fa
4
+ data.tar.gz: 1075d0564b4c0dea690c2359d5cc97d8ec462382
5
5
  SHA512:
6
- metadata.gz: '04649b26d72793e0a64565fcdc11bbed3892668ab40339e6dace60d3ae24b98565593e4762124b6dfbba4d197b7f490a3701c0d7c07763bfb912f170d18a0472'
7
- data.tar.gz: baefb618b9b39bebf1c5cb9e3fb17c76a9cc1bf5e473ce5a8f1a52ec8eee6db4b0eacd77e660f49a7ec3156faffe8885c246465b1e4b34f17538d4b45984d8ae
6
+ metadata.gz: 35ec82d5b361797039e81871d9c938627edc22dc7e6a9cb300b3bcd64319edb10b97965ef9d644af914a957c6b5e1ee4a4e67671b4d139efa78bc412deb8b04b
7
+ data.tar.gz: 9c66b534b656c965a11413a27577ac7732e81d52887931ca74a597a352c5288aaff5eeac20d2d8fff6d0dd361747d376d80a712069eefa1ed40a27b517be3296
data/bin/projects ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ path = __FILE__
4
+ while File.symlink?(path)
5
+ path = File.expand_path(File.readlink(path), File.dirname(path))
6
+ end
7
+ $:.unshift(File.join(File.dirname(File.expand_path(path)), '..', 'lib'))
8
+
9
+ require 'intent'
10
+
11
+ Intent::Projects::Manager.run(ARGV.dup)
@@ -0,0 +1,20 @@
1
+ module Intent
2
+ module Projects
3
+ class Manager
4
+ def self.run(args, output=STDOUT)
5
+ if args.empty?
6
+ print_help(output)
7
+ else
8
+ case args.first.to_sym
9
+ when :status
10
+ Status.run(File.expand_path('~/Projects').to_s)
11
+ end
12
+ end
13
+ end
14
+
15
+ def self.print_help(output)
16
+ output.puts "usage: review"
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,39 @@
1
+ module Intent
2
+ module Projects
3
+ class Status
4
+ def self.run(projects_dir)
5
+ project_index = {}
6
+
7
+ Dir["#{projects_dir}/*"].each do |project|
8
+ if Dir.exists?(project) && Dir.exists?("#{project}/.git")
9
+ Dir.chdir(project)
10
+ git_output = `git status`
11
+ project_name = Pathname.new(project).basename
12
+
13
+ status = {
14
+ untracked_files: git_output.include?('Untracked files'),
15
+ unstaged_edits: git_output.include?('Changes not staged for commit')
16
+ }
17
+
18
+ if status[:untracked_files] || status[:unstaged_edits]
19
+ project_index[project_name] = status
20
+ end
21
+ end
22
+ end
23
+
24
+ pastel = Pastel.new
25
+
26
+ project_index.each do |key, value|
27
+ result = []
28
+ if value[:untracked_files]
29
+ result << pastel.red('untracked files')
30
+ end
31
+ if value[:unstaged_edits]
32
+ result << pastel.red('unstaged edits')
33
+ end
34
+ puts "#{pastel.bold('+')}#{pastel.bold(key)} contains #{result.join(' and ')}."
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+
3
+ require 'intent/projects/status'
4
+ require 'intent/projects/manager'
@@ -1,3 +1,3 @@
1
1
  module Intent
2
- VERSION = '0.5.0'
2
+ VERSION = '0.5.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Rickerby
@@ -126,6 +126,7 @@ description:
126
126
  email:
127
127
  - me@maetl.net
128
128
  executables:
129
+ - projects
129
130
  - review
130
131
  - todo
131
132
  extensions: []
@@ -138,11 +139,15 @@ files:
138
139
  - LICENSE.txt
139
140
  - README.md
140
141
  - Rakefile
142
+ - bin/projects
141
143
  - bin/review
142
144
  - bin/todo
143
145
  - intent.gemspec
144
146
  - lib/gem_ext/todo-txt.rb
145
147
  - lib/intent.rb
148
+ - lib/intent/projects.rb
149
+ - lib/intent/projects/manager.rb
150
+ - lib/intent/projects/status.rb
146
151
  - lib/intent/review.rb
147
152
  - lib/intent/review/manager.rb
148
153
  - lib/intent/todo.rb