c_project 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/bin/c_project +35 -29
- data/lib/c_project/version.rb +1 -1
- data/templates/scripts/experiment +4 -0
- data/templates/scripts/start_new_experiment.sh +23 -0
- data/templates/{commander.c → vendor/commander.c}/History.md +0 -0
- data/templates/{commander.c → vendor/commander.c}/Makefile +0 -0
- data/templates/{commander.c → vendor/commander.c}/Readme.md +0 -0
- data/templates/{commander.c → vendor/commander.c}/package.json +0 -0
- data/templates/{commander.c → vendor/commander.c}/src/commander.c +0 -0
- data/templates/{commander.c → vendor/commander.c}/src/commander.h +0 -0
- data/templates/{commander.c → vendor/commander.c}/test.c +0 -0
- metadata +11 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2d88badc1db7100d7981870f66c95879af2dd42
|
4
|
+
data.tar.gz: 2c37eb6ccecad4bf9a8ae2aeaa4fa11f5dd8040a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ac0445b2cc6410292e4be4398e9cabf08da9927dff87e88dadf7eb58fbd8aa429df7aac8d77c4bff4128fea3f36478547eac5ee9e0e06ec9cf5f2bd6b6d15ed
|
7
|
+
data.tar.gz: eba081b3ef4d95d199a533bdf8f5c77c362a2be6bbad49f210eecdfb6421cd21ed60357100e72782f325fb012ee3c78ac4fbc2607f8e8478fad845ab599c8d48
|
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ include Rake::DSL
|
|
9
9
|
Bundler::GemHelper.install_tasks
|
10
10
|
|
11
11
|
Rake::TestTask.new do |t|
|
12
|
-
t.libs << "lib" << 'spec/support'
|
12
|
+
t.libs << "lib" << 'spec/support' << 'bin'
|
13
13
|
t.test_files = FileList['spec/**/*_spec.rb']
|
14
14
|
t.verbose = false
|
15
15
|
t.warning = false # pry-rescue has a lot of warnings
|
data/bin/c_project
CHANGED
@@ -7,6 +7,8 @@ module CProject
|
|
7
7
|
class NewProject < Thor::Group
|
8
8
|
include Thor::Actions
|
9
9
|
|
10
|
+
EXECUTABLE_PERMISSIONS = 0775
|
11
|
+
|
10
12
|
argument :name, :desc => 'Name of the new project.'
|
11
13
|
|
12
14
|
def self.source_root
|
@@ -18,10 +20,12 @@ module CProject
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def fill_root
|
23
|
+
create_file_from_shared_template "LICENCE"
|
21
24
|
empty_directory file_path('bin')
|
22
25
|
empty_directory file_path('experiments')
|
23
|
-
|
24
|
-
|
26
|
+
shared_directory 'scripts'
|
27
|
+
chmod file_path('scripts/start_new_experiment.sh'), EXECUTABLE_PERMISSIONS
|
28
|
+
chmod file_path('scripts/experiment'), EXECUTABLE_PERMISSIONS
|
25
29
|
end
|
26
30
|
|
27
31
|
private
|
@@ -40,6 +44,10 @@ module CProject
|
|
40
44
|
file_path(file_name)
|
41
45
|
)
|
42
46
|
end
|
47
|
+
|
48
|
+
def shared_directory(dir)
|
49
|
+
directory "templates/#{dir}", file_path(dir)
|
50
|
+
end
|
43
51
|
end
|
44
52
|
|
45
53
|
class C < NewProject
|
@@ -67,7 +75,7 @@ module CProject
|
|
67
75
|
|
68
76
|
def vendor
|
69
77
|
directory 'templates/c/vendor', file_path("vendor")
|
70
|
-
|
78
|
+
shared_directory 'vendor/commander.c'
|
71
79
|
end
|
72
80
|
|
73
81
|
private
|
@@ -88,7 +96,7 @@ module CProject
|
|
88
96
|
end
|
89
97
|
end
|
90
98
|
|
91
|
-
class Cpp <
|
99
|
+
class Cpp < NewProject
|
92
100
|
include Thor::Actions
|
93
101
|
|
94
102
|
argument :name, :desc => 'Name of the new project.'
|
@@ -103,26 +111,25 @@ module CProject
|
|
103
111
|
create_file_from_template "Makefile"
|
104
112
|
end
|
105
113
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
# create_file_from_template 'src/main.c'
|
112
|
-
# end
|
114
|
+
def src
|
115
|
+
template 'templates/cpp/src/project.cpp.tt', file_path("src/#{name}.cpp")
|
116
|
+
template 'templates/cpp/src/project.hpp.tt', file_path("src/#{name}.hpp")
|
117
|
+
create_file_from_template 'src/main.cpp'
|
118
|
+
end
|
113
119
|
|
114
|
-
|
115
|
-
|
116
|
-
|
120
|
+
def test
|
121
|
+
template 'templates/cpp/test/test_project.cpp.tt', file_path("test/test_#{name}.cpp")
|
122
|
+
end
|
117
123
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
124
|
+
def support
|
125
|
+
create_file_from_template 'test/support/test_helper.cpp'
|
126
|
+
create_file_from_template 'test/support/test_helper.hpp'
|
127
|
+
end
|
122
128
|
|
123
|
-
|
124
|
-
|
125
|
-
|
129
|
+
def vendor
|
130
|
+
directory 'templates/cpp/vendor', file_path("vendor")
|
131
|
+
shared_directory 'vendor/commander.c'
|
132
|
+
end
|
126
133
|
|
127
134
|
private
|
128
135
|
|
@@ -151,14 +158,13 @@ module CProject
|
|
151
158
|
)
|
152
159
|
tasks["c"].options = C.class_options
|
153
160
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
# tasks["c++"].options = Cpp.class_options
|
161
|
+
register(
|
162
|
+
Cpp,
|
163
|
+
'c++',
|
164
|
+
'c++ NAME',
|
165
|
+
"Creates a new C++ project the name NAME"
|
166
|
+
)
|
167
|
+
tasks["c++"].options = Cpp.class_options
|
162
168
|
end
|
163
169
|
end
|
164
170
|
|
data/lib/c_project/version.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
set -x
|
4
|
+
|
5
|
+
my_dir="$(dirname "$(readlink -f "$0")")"
|
6
|
+
|
7
|
+
root_dir="$my_dir/../"
|
8
|
+
timestamp=$(date +%b%d_%Y.%H-%M-%S)
|
9
|
+
all_experiments_dir="$root_dir/experiments"
|
10
|
+
|
11
|
+
mkdir $all_experiments_dir 2> /dev/null
|
12
|
+
|
13
|
+
experiment_dir=$all_experiments_dir/experiment.$timestamp
|
14
|
+
|
15
|
+
# Use pbs_job to generate an experiment
|
16
|
+
pbs_job new $experiment_dir your_email@domain.com --no-append-timestamp # @todo Add PBS options here
|
17
|
+
|
18
|
+
# Append run experiment.sh line to task
|
19
|
+
run_exp_line="$my_dir/experiment"
|
20
|
+
sed -i "s|echo\s*\"Hi.*$|$run_exp_line|" $experiment_dir/task
|
21
|
+
|
22
|
+
# Run the job (if on a cluster, run job.qsub, otherwise run job.pbs)
|
23
|
+
$experiment_dir/job.pbs
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: c_project
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dustin Morrill
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -104,13 +104,15 @@ files:
|
|
104
104
|
- templates/c/vendor/unity/src/unity.c
|
105
105
|
- templates/c/vendor/unity/src/unity.h
|
106
106
|
- templates/c/vendor/unity/src/unity_internals.h
|
107
|
-
- templates/
|
108
|
-
- templates/
|
109
|
-
- templates/commander.c/
|
110
|
-
- templates/commander.c/
|
111
|
-
- templates/commander.c/
|
112
|
-
- templates/commander.c/
|
113
|
-
- templates/commander.c/
|
107
|
+
- templates/scripts/experiment
|
108
|
+
- templates/scripts/start_new_experiment.sh
|
109
|
+
- templates/vendor/commander.c/History.md
|
110
|
+
- templates/vendor/commander.c/Makefile
|
111
|
+
- templates/vendor/commander.c/Readme.md
|
112
|
+
- templates/vendor/commander.c/package.json
|
113
|
+
- templates/vendor/commander.c/src/commander.c
|
114
|
+
- templates/vendor/commander.c/src/commander.h
|
115
|
+
- templates/vendor/commander.c/test.c
|
114
116
|
homepage: https://github.com/dmorrill10/c_project
|
115
117
|
licenses:
|
116
118
|
- MIT
|