c_project 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f077249f45ad2c626eccf6af687d6279f4263fc
4
- data.tar.gz: ebe32b2737e48ad6b8225a6f6b8e095046fb5fa2
3
+ metadata.gz: b2d88badc1db7100d7981870f66c95879af2dd42
4
+ data.tar.gz: 2c37eb6ccecad4bf9a8ae2aeaa4fa11f5dd8040a
5
5
  SHA512:
6
- metadata.gz: 626f3eeed41a89e0cf5abd99962999fe9fc4c25306b39f9ab7ccb284aa8536e98542c1b7e5ca0238dfffb26239bf4d5622931700bf5705f2844261af06ba2590
7
- data.tar.gz: 97c8ebd7531a73910f737bb79048b0347800a35dac8224ef82d92dd6bf34912ee2579c65675d731225d13a7c9be63575ce002402dc4a109f32b643e0ef249863
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
- empty_directory file_path('scripts')
24
- create_file_from_shared_template "LICENCE"
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
- directory 'templates/commander.c', file_path('vendor/commander.c')
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 < Thor::Group
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
- # @todo
107
- # def src
108
- # create_file_from_template 'src/CExceptionConfig.h'
109
- # template 'templates/src/c_project.c.tt', file_path("src/#{name}.c")
110
- # template 'templates/src/c_project.h.tt', file_path("src/#{name}.h")
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
- # def test
115
- # template 'templates/test/test_c_project.c.tt', file_path("test/test_#{name}.c")
116
- # end
120
+ def test
121
+ template 'templates/cpp/test/test_project.cpp.tt', file_path("test/test_#{name}.cpp")
122
+ end
117
123
 
118
- # def support
119
- # create_file_from_template 'test/support/test_helper.c'
120
- # create_file_from_template 'test/support/test_helper.h'
121
- # end
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
- # def vendor
124
- # directory 'templates/vendor', file_path("vendor")
125
- # end
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
- # @todo
155
- # register(
156
- # Cpp,
157
- # 'c++',
158
- # 'c++ NAME',
159
- # "Creates a new C++ project the name NAME"
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
 
@@ -1,3 +1,3 @@
1
1
  module CProject
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # @todo Execute project with different parameters
4
+ echo "Hi, I'm an experiment!"
@@ -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
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.1.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: 2013-12-29 00:00:00.000000000 Z
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/commander.c/History.md
108
- - templates/commander.c/Makefile
109
- - templates/commander.c/Readme.md
110
- - templates/commander.c/package.json
111
- - templates/commander.c/src/commander.c
112
- - templates/commander.c/src/commander.h
113
- - templates/commander.c/test.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