project 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Rakefile +15 -37
- data/VERSION +1 -1
- data/lib/project/command_set.rb +22 -0
- data/lib/project/core_ext.rb +0 -1
- data/lib/project/runner.rb +8 -12
- data/lib/project/version.rb +6 -0
- data/lib/project.rb +13 -11
- data/project.gemspec +22 -28
- data/readme.textile +27 -10
- metadata +14 -7
data/.gitignore
CHANGED
data/Rakefile
CHANGED
@@ -1,44 +1,22 @@
|
|
1
|
-
|
2
|
-
require '
|
1
|
+
# Quick task to build and deploy gem.
|
2
|
+
require 'lib/project'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "project"
|
8
|
-
gem.summary = "A streamlined approach to working with multiple projects and tasks."
|
9
|
-
gem.description = "Project aims to make working with multiple projects as simple as possible. By registering projects with workflows you can quickly create a set of commands that will be run against each project."
|
10
|
-
gem.email = "josh@josh-nesbitt.net"
|
11
|
-
gem.homepage = "http://github.com/joshnesbitt/project"
|
12
|
-
gem.authors = ["Josh Nesbitt"]
|
13
|
-
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
|
-
gem.executables << 'project'
|
15
|
-
end
|
16
|
-
Jeweler::GemcutterTasks.new
|
17
|
-
rescue LoadError
|
18
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
19
|
-
end
|
4
|
+
GEM_NAME = "project-#{Project::Version::STRING}.gem"
|
5
|
+
GEM_PATH = "pkg/#{GEM_NAME}"
|
20
6
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
7
|
+
def execute_commands(commands)
|
8
|
+
commands.each do |command|
|
9
|
+
output = `#{command}`
|
10
|
+
puts "* executed #{command}"
|
11
|
+
puts output unless output.empty?
|
12
|
+
end
|
25
13
|
end
|
26
14
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
spec.rcov = true
|
15
|
+
task :build do
|
16
|
+
execute_commands ['gem build project.gemspec',
|
17
|
+
"mv #{GEM_NAME} pkg/"]
|
31
18
|
end
|
32
19
|
|
33
|
-
task :
|
34
|
-
|
35
|
-
|
36
|
-
require 'rake/rdoctask'
|
37
|
-
Rake::RDocTask.new do |rdoc|
|
38
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
39
|
-
|
40
|
-
rdoc.rdoc_dir = 'rdoc'
|
41
|
-
rdoc.title = "configurable #{version}"
|
42
|
-
rdoc.rdoc_files.include('README*')
|
43
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
20
|
+
task :deploy => [ :build ] do
|
21
|
+
execute_commands ["gem push #{GEM_PATH}"]
|
44
22
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'open3'
|
2
|
+
module Project
|
3
|
+
class CommandSet
|
4
|
+
attr_accessor :project, :workflow
|
5
|
+
|
6
|
+
def initialize(project, workflow)
|
7
|
+
self.project, self.workflow = project, workflow
|
8
|
+
end
|
9
|
+
|
10
|
+
def execute!
|
11
|
+
stdin, stdout, stderr = Open3::popen3 SHELL_BINARY
|
12
|
+
|
13
|
+
self.workflow.each do |command|
|
14
|
+
command = Template.new(command, self.project).parse!
|
15
|
+
stdin.puts command
|
16
|
+
end
|
17
|
+
|
18
|
+
stdin.close
|
19
|
+
return stdout.read, stderr.read
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/project/core_ext.rb
CHANGED
data/lib/project/runner.rb
CHANGED
@@ -18,14 +18,14 @@ module Project
|
|
18
18
|
def run!
|
19
19
|
say "* Opening project '#{self.key}' using workflow '#{self.project.workflow}'"
|
20
20
|
|
21
|
-
self.
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
unless
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
commands = CommandSet.new(self.project, self.workflow)
|
22
|
+
stdout, stderr = commands.execute!
|
23
|
+
|
24
|
+
if stderr.empty?
|
25
|
+
puts stdout unless stdout.empty?
|
26
|
+
else
|
27
|
+
say "! An error occurred whilst running the workflow:"
|
28
|
+
say stderr
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -38,9 +38,5 @@ module Project
|
|
38
38
|
say message
|
39
39
|
Kernel.exit(code)
|
40
40
|
end
|
41
|
-
|
42
|
-
def seperator
|
43
|
-
say "", ("*" * 80), ""
|
44
|
-
end
|
45
41
|
end
|
46
42
|
end
|
data/lib/project.rb
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
$:.unshift File.dirname(__FILE__)
|
2
|
-
$:.unshift File.join(File.dirname(__FILE__), "project")
|
3
2
|
|
4
3
|
module Project
|
5
4
|
ROOT = File.expand_path(File.dirname(__FILE__) + "/..")
|
5
|
+
CONFIG = File.join(ENV["HOME"], '.project')
|
6
|
+
SHELL_BINARY = ENV["SHELL"]
|
6
7
|
end
|
7
8
|
|
8
|
-
require '
|
9
|
-
require '
|
10
|
-
require '
|
11
|
-
require '
|
12
|
-
require '
|
13
|
-
require 'project'
|
14
|
-
require '
|
15
|
-
require '
|
9
|
+
require 'project/version'
|
10
|
+
require 'project/core_ext'
|
11
|
+
require 'project/errors'
|
12
|
+
require 'project/command_set'
|
13
|
+
require 'project/template'
|
14
|
+
require 'project/lookup'
|
15
|
+
require 'project/workflow'
|
16
|
+
require 'project/project'
|
17
|
+
require 'project/loader'
|
18
|
+
require 'project/runner'
|
16
19
|
|
17
|
-
|
18
|
-
Project::Loader.config_path(PROJECT_CONFIG)
|
20
|
+
Project::Loader.config_path(Project::CONFIG)
|
data/project.gemspec
CHANGED
@@ -1,18 +1,14 @@
|
|
1
|
-
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in rakefile, and run the gemspec command
|
4
|
-
# -*- encoding: utf-8 -*-
|
1
|
+
require 'lib/project'
|
5
2
|
|
6
3
|
Gem::Specification.new do |s|
|
7
4
|
s.name = %q{project}
|
8
|
-
s.version =
|
9
|
-
|
5
|
+
s.version = Project::Version::STRING
|
10
6
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
7
|
s.authors = ["Josh Nesbitt"]
|
12
|
-
s.date = %
|
8
|
+
s.date = Time.now.strftime("%Y/%m/%d")
|
13
9
|
s.description = %q{Project aims to make working with multiple projects as simple as possible. By registering projects with workflows you can quickly create a set of commands that will be run against each project.}
|
14
10
|
s.email = %q{josh@josh-nesbitt.net}
|
15
|
-
s.executables = ["project"
|
11
|
+
s.executables = ["project"]
|
16
12
|
s.extra_rdoc_files = [
|
17
13
|
"LICENSE"
|
18
14
|
]
|
@@ -23,8 +19,10 @@ Gem::Specification.new do |s|
|
|
23
19
|
"VERSION",
|
24
20
|
"bin/project",
|
25
21
|
"lib/project.rb",
|
22
|
+
"lib/project/version.rb",
|
26
23
|
"lib/project/core_ext.rb",
|
27
24
|
"lib/project/errors.rb",
|
25
|
+
"lib/project/command_set.rb",
|
28
26
|
"lib/project/loader.rb",
|
29
27
|
"lib/project/lookup.rb",
|
30
28
|
"lib/project/project.rb",
|
@@ -52,27 +50,23 @@ Gem::Specification.new do |s|
|
|
52
50
|
s.summary = %q{A streamlined approach to working with multiple projects and tasks.}
|
53
51
|
s.test_files = [
|
54
52
|
"spec/lib/core_ext_spec.rb",
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
53
|
+
"spec/lib/errors_spec.rb",
|
54
|
+
"spec/lib/loader_spec.rb",
|
55
|
+
"spec/lib/lookup_spec.rb",
|
56
|
+
"spec/lib/project_spec.rb",
|
57
|
+
"spec/lib/template_spec.rb",
|
58
|
+
"spec/lib/workflow_spec.rb",
|
59
|
+
"spec/spec_helper.rb",
|
60
|
+
"spec/watch.rb"
|
63
61
|
]
|
62
|
+
s.post_install_message = <<-MESSAGE
|
63
|
+
#{"*"* 80}
|
64
|
+
Thanks for installing Project. Please check the README for the changelog:
|
64
65
|
|
65
|
-
|
66
|
-
|
67
|
-
s.specification_version = 3
|
66
|
+
http://github.com/joshnesbitt/project#readme
|
67
|
+
#{"*"* 80}
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
73
|
-
end
|
74
|
-
else
|
75
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
76
|
-
end
|
69
|
+
MESSAGE
|
70
|
+
s.platform = Gem::Platform::RUBY
|
71
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
77
72
|
end
|
78
|
-
|
data/readme.textile
CHANGED
@@ -3,6 +3,7 @@ h1. Project
|
|
3
3
|
* Overview
|
4
4
|
* Installation
|
5
5
|
* Usage
|
6
|
+
* Changelog
|
6
7
|
* Bugs
|
7
8
|
* Note on Patches/Pull Requests
|
8
9
|
|
@@ -51,31 +52,35 @@ h3. Workflows
|
|
51
52
|
A workflow is a set of commands you want run against a particular project. An example workflow might look something like this:
|
52
53
|
|
53
54
|
pre. :default:
|
54
|
-
-
|
55
|
-
-
|
55
|
+
- cd %path
|
56
|
+
- mate .
|
57
|
+
- gitx
|
56
58
|
|
57
59
|
Which translates to:
|
58
60
|
|
59
|
-
* @
|
60
|
-
* @
|
61
|
+
* @cd /path/to/project@
|
62
|
+
* @mate .@
|
63
|
+
* @gitx@
|
61
64
|
|
62
65
|
A workflow is just a YAML array of templated commands. Any variable used in a workflow will get looked up on the project that's running it. In the example above the @%path@ variable is replaced by the path specified within the project. Using this method you can quickly build up a set of common workflows to use against many projects.
|
63
66
|
|
64
|
-
|
67
|
+
Each workflow runs within its own subshell. This means that every command executed will run in the environment as it was left by the previous command. Given the above workflow, first a command executes which changes the current directory then commands are executed relative to that directory.
|
65
68
|
|
66
69
|
My default workflow looks something like this:
|
67
70
|
|
68
71
|
pre. :default:
|
69
|
-
-
|
70
|
-
-
|
72
|
+
- cd %path
|
73
|
+
- mate .
|
74
|
+
- gitx
|
71
75
|
- open 'http://%basecamp_url'
|
72
76
|
- open 'http://%app'
|
73
|
-
-
|
77
|
+
- rails server
|
74
78
|
|
75
79
|
Which:
|
76
80
|
|
77
|
-
*
|
78
|
-
* opens
|
81
|
+
* changes to the project directory
|
82
|
+
* opens the project in Textmate
|
83
|
+
* opens it's Git history in GitX
|
79
84
|
* opens the Basecamp project for the app
|
80
85
|
* starts the Rails server (and opens it up in the default browser)
|
81
86
|
|
@@ -91,6 +96,18 @@ pre. project name
|
|
91
96
|
|
92
97
|
|
93
98
|
|
99
|
+
h2. Changelog
|
100
|
+
|
101
|
+
h3. 1.2.0
|
102
|
+
|
103
|
+
* Added the ability for each workflow command to run within the same sub-shell. Commands executed within a sequence now respect the last ran command.
|
104
|
+
|
105
|
+
h3. 1.1.0
|
106
|
+
|
107
|
+
* Fixed issue in the template regular expression where numerics were being ignored.
|
108
|
+
|
109
|
+
|
110
|
+
|
94
111
|
h2. Bugs
|
95
112
|
|
96
113
|
If you have any problems with Project, please file an "issue":http://github.com/joshnesbitt/project/issues.
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: project
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 1.
|
10
|
+
version: 1.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Josh Nesbitt
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-17 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -32,13 +32,12 @@ dependencies:
|
|
32
32
|
- 2
|
33
33
|
- 9
|
34
34
|
version: 1.2.9
|
35
|
-
type: :
|
35
|
+
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
37
|
description: Project aims to make working with multiple projects as simple as possible. By registering projects with workflows you can quickly create a set of commands that will be run against each project.
|
38
38
|
email: josh@josh-nesbitt.net
|
39
39
|
executables:
|
40
40
|
- project
|
41
|
-
- project
|
42
41
|
extensions: []
|
43
42
|
|
44
43
|
extra_rdoc_files:
|
@@ -50,8 +49,10 @@ files:
|
|
50
49
|
- VERSION
|
51
50
|
- bin/project
|
52
51
|
- lib/project.rb
|
52
|
+
- lib/project/version.rb
|
53
53
|
- lib/project/core_ext.rb
|
54
54
|
- lib/project/errors.rb
|
55
|
+
- lib/project/command_set.rb
|
55
56
|
- lib/project/loader.rb
|
56
57
|
- lib/project/lookup.rb
|
57
58
|
- lib/project/project.rb
|
@@ -75,7 +76,13 @@ has_rdoc: true
|
|
75
76
|
homepage: http://github.com/joshnesbitt/project
|
76
77
|
licenses: []
|
77
78
|
|
78
|
-
post_install_message:
|
79
|
+
post_install_message: |+
|
80
|
+
********************************************************************************
|
81
|
+
Thanks for installing Project. Please check the README for the changelog:
|
82
|
+
|
83
|
+
http://github.com/joshnesbitt/project#readme
|
84
|
+
********************************************************************************
|
85
|
+
|
79
86
|
rdoc_options:
|
80
87
|
- --charset=UTF-8
|
81
88
|
require_paths:
|