recurs 0.0.4.1 → 0.0.4.2

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.
data/Gemfile CHANGED
@@ -5,6 +5,6 @@ gemspec
5
5
 
6
6
  group :test do
7
7
  #gem 'rails', '3.0.1'
8
- gem 'rspec'
9
- gem 'aruba'
8
+ gem 'rspec', '~> 2.3.0'
9
+ gem 'aruba', '~> 0.2.7'
10
10
  end
data/Gemfile.lock ADDED
@@ -0,0 +1,51 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ recurs (0.0.4.1)
5
+ actic
6
+ ri_cal (>= 0.8.7)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ actic (0.0.2)
12
+ ri_cal (>= 0.8.7)
13
+ aruba (0.2.7)
14
+ background_process
15
+ cucumber (~> 0.10.0)
16
+ background_process (1.2)
17
+ builder (3.0.0)
18
+ cucumber (0.10.0)
19
+ builder (>= 2.1.2)
20
+ diff-lcs (~> 1.1.2)
21
+ gherkin (~> 2.3.2)
22
+ json (~> 1.4.6)
23
+ term-ansicolor (~> 1.0.5)
24
+ diff-lcs (1.1.2)
25
+ gherkin (2.3.2)
26
+ json (~> 1.4.6)
27
+ term-ansicolor (~> 1.0.5)
28
+ json (1.4.6)
29
+ rake (0.8.7)
30
+ ri_cal (0.8.7)
31
+ rspec (2.3.0)
32
+ rspec-core (~> 2.3.0)
33
+ rspec-expectations (~> 2.3.0)
34
+ rspec-mocks (~> 2.3.0)
35
+ rspec-core (2.3.0)
36
+ rspec-expectations (2.3.0)
37
+ diff-lcs (~> 1.1.2)
38
+ rspec-mocks (2.3.0)
39
+ term-ansicolor (1.0.5)
40
+
41
+ PLATFORMS
42
+ ruby
43
+
44
+ DEPENDENCIES
45
+ actic
46
+ aruba (~> 0.2.7)
47
+ cucumber
48
+ rake
49
+ recurs!
50
+ ri_cal (>= 0.8.7)
51
+ rspec (~> 2.3.0)
@@ -12,16 +12,21 @@ Feature:
12
12
  source "http://rubygems.org"
13
13
  gem 'rails', '3.0.0'
14
14
  gem 'sqlite3-ruby', :require => 'sqlite3'
15
- gem 'recurs', :path => '../../../'
15
+ gem 'recurs' #, :path => '../../../'
16
16
  """
17
17
  And I run "bundle install"
18
18
  And I run "rails generate recurs_widget Event"
19
- And I run "rake db:migrate"
19
+ Then the output should contain:
20
+ """
21
+ create app/models/event.rb
22
+
23
+ """
20
24
  And the following files should exist:
21
25
  | app/models/event.rb |
22
26
  | app/views/events/index.html.haml |
23
27
  | app/views/events/new.html.haml |
24
28
  | app/views/events/edit.html.haml |
25
29
  | app/views/events/_form.html.haml |
30
+ | app/views/events/schemes/_form.html.haml |
26
31
  And the following files should not exist:
27
- | test/fixtures/users.yml |
32
+ And I run "rake db:migrate"
@@ -1,24 +1,277 @@
1
- When /^I do aruba (.*)$/ do |aruba_step|
2
- begin
3
- When(aruba_step)
4
- rescue => e
5
- @aruba_exception = e
1
+ require 'aruba/api'
2
+ #require 'aruba/cucumber'
3
+ #=begin
4
+ World(Aruba::Api)
5
+
6
+ Before('@disable-bundler') do
7
+ unset_bundler_env_vars
8
+ end
9
+
10
+ Before do
11
+ @__aruba_original_paths = (ENV['PATH'] || '').split(File::PATH_SEPARATOR)
12
+ ENV['PATH'] = ([File.expand_path('bin')] + @__aruba_original_paths).join(File::PATH_SEPARATOR)
13
+ end
14
+
15
+ After do
16
+ ENV['PATH'] = @__aruba_original_paths.join(File::PATH_SEPARATOR)
17
+ end
18
+
19
+ Before do
20
+ FileUtils.rm_rf(current_dir)
21
+ end
22
+
23
+ Before('@puts') do
24
+ @puts = true
25
+ end
26
+
27
+ Before('@announce-cmd') do
28
+ @announce_cmd = true
29
+ end
30
+
31
+ Before('@announce-stdout') do
32
+ @announce_stdout = true
33
+ end
34
+
35
+ Before('@announce-stderr') do
36
+ @announce_stderr = true
37
+ end
38
+
39
+ Before('@announce-dir') do
40
+ @announce_dir = true
41
+ end
42
+
43
+ Before('@announce-env') do
44
+ @announce_env = true
45
+ end
46
+
47
+ Before('@announce') do
48
+ @announce_stdout = true
49
+ @announce_stderr = true
50
+ @announce_cmd = true
51
+ @announce_dir = true
52
+ @announce_env = true
53
+ end
54
+
55
+ After do
56
+ restore_env
57
+ end
58
+
59
+ Given /^I'm using a clean gemset "([^"]*)"$/ do |gemset|
60
+ use_clean_gemset(gemset)
61
+ end
62
+
63
+ Given /^a directory named "([^"]*)"$/ do |dir_name|
64
+ create_dir(dir_name)
65
+ end
66
+
67
+ Given /^a file named "([^"]*)" with:$/ do |file_name, file_content|
68
+ create_file(file_name, file_content)
69
+ end
70
+
71
+ Given /^an empty file named "([^"]*)"$/ do |file_name|
72
+ create_file(file_name, "")
73
+ end
74
+
75
+ When /^I write to "([^"]*)" with:$/ do |file_name, file_content|
76
+ create_file(file_name, file_content, false)
77
+ end
78
+
79
+ When /^I overwrite "([^"]*)" with:$/ do |file_name, file_content|
80
+ create_file(file_name, file_content, true)
81
+ end
82
+
83
+ When /^I append to "([^"]*)" with:$/ do |file_name, file_content|
84
+ append_to_file(file_name, file_content)
85
+ end
86
+
87
+ When /^I remove the file "([^"]*)"$/ do |file_name|
88
+ remove_file(file_name)
89
+ end
90
+
91
+ When /^I cd to "([^"]*)"$/ do |dir|
92
+ cd(dir)
93
+ end
94
+
95
+ When /^I run "(.*)"$/ do |cmd|
96
+ run_simple(unescape(cmd), false)
97
+ # sleep(5)
98
+ end
99
+
100
+ When /^I successfully run "(.*)"$/ do |cmd|
101
+ run_simple(unescape(cmd))
102
+ end
103
+
104
+ When /^I run "([^"]*)" interactively$/ do |cmd|
105
+ run_interactive(unescape(cmd))
106
+ end
107
+
108
+ When /^I type "([^"]*)"$/ do |input|
109
+ write_interactive(ensure_newline(input))
110
+ end
111
+
112
+ Then /^the output should contain "([^"]*)"$/ do |partial_output|
113
+ assert_partial_output(unescape(partial_output))
114
+ end
115
+
116
+ Then /^the output from "([^"]*)" should contain "([^"]*)"$/ do |cmd, partial_output|
117
+ output_from(cmd).should include(unescape(partial_output))
118
+ end
119
+
120
+ Then /^the output from "([^"]*)" should not contain "([^"]*)"$/ do |cmd, partial_output|
121
+ output_from(cmd).should_not include(unescape(partial_output))
122
+ end
123
+
124
+ Then /^the output should not contain "([^"]*)"$/ do |partial_output|
125
+ all_output.should_not include(unescape(partial_output))
126
+ end
127
+
128
+ Then /^the output should contain:$/ do |partial_output|
129
+ all_output.should include(unescape(partial_output))
130
+ end
131
+
132
+ Then /^the output should not contain:$/ do |partial_output|
133
+ all_output.should_not include(unescape(partial_output))
134
+ end
135
+
136
+ Then /^the output should contain exactly "([^"]*)"$/ do |exact_output|
137
+ all_output.should == unescape(exact_output)
138
+ end
139
+
140
+ Then /^the output should contain exactly:$/ do |exact_output|
141
+ all_output.should == unescape(exact_output)
142
+ end
143
+
144
+ # "the output should match" allows regex in the partial_output, if
145
+ # you don't need regex, use "the output should contain" instead since
146
+ # that way, you don't have to escape regex characters that
147
+ # appear naturally in the output
148
+ Then /^the output should match \/([^\/]*)\/$/ do |partial_output|
149
+ all_output.should =~ /#{partial_output}/
150
+ end
151
+
152
+ Then /^the output should match:$/ do |partial_output|
153
+ all_output.should =~ /#{partial_output}/m
154
+ end
155
+
156
+ Then /^the exit status should be (\d+)$/ do |exit_status|
157
+ @last_exit_status.should == exit_status.to_i
158
+ end
159
+
160
+ Then /^the exit status should not be (\d+)$/ do |exit_status|
161
+ @last_exit_status.should_not == exit_status.to_i
162
+ end
163
+
164
+ Then /^it should (pass|fail) with:$/ do |pass_fail, partial_output|
165
+ self.__send__("assert_#{pass_fail}ing_with", partial_output)
166
+ end
167
+
168
+ Then /^it should (pass|fail) with exactly:$/ do |pass_fail, exact_output|
169
+ assert_exit_status_and_output(pass_fail == "pass", exact_output, true)
170
+ end
171
+
172
+ Then /^it should (pass|fail) with regexp?:$/ do |pass_fail, partial_output|
173
+ Then "the output should match:", partial_output
174
+ if pass_fail == 'pass'
175
+ @last_exit_status.should == 0
176
+ else
177
+ @last_exit_status.should_not == 0
6
178
  end
7
179
  end
8
180
 
9
- # Useful for debugging timing problems
10
- When /^sleep (\d+)$/ do |time|
11
- sleep time.to_i
181
+ Then /^the stderr should contain "([^"]*)"$/ do |partial_output|
182
+ all_stderr.should include(unescape(partial_output))
183
+ end
184
+
185
+ Then /^the stderr should contain exactly:$/ do |exact_output|
186
+ all_stderr.should == exact_output
187
+ end
188
+
189
+ Then /^the stdout should contain "([^"]*)"$/ do |partial_output|
190
+ all_stdout.should include(unescape(partial_output))
191
+ end
192
+
193
+ Then /^the stdout should contain exactly:$/ do |exact_output|
194
+ all_stdout.should == exact_output
195
+ end
196
+
197
+ Then /^the stderr should not contain "([^"]*)"$/ do |partial_output|
198
+ all_stderr.should_not include(unescape(partial_output))
199
+ end
200
+
201
+ Then /^the stdout should not contain "([^"]*)"$/ do |partial_output|
202
+ all_stdout.should_not include(unescape(partial_output))
203
+ end
204
+
205
+ Then /^the stdout from "([^"]*)" should contain "([^"]*)"$/ do |cmd, partial_output|
206
+ stdout_from(cmd).should include(unescape(partial_output))
207
+ end
208
+
209
+ Then /^the stdout from "([^"]*)" should not contain "([^"]*)"$/ do |cmd, partial_output|
210
+ stdout_from(cmd).should_not include(unescape(partial_output))
211
+ end
212
+
213
+ Then /^the stderr from "([^"]*)" should contain "([^"]*)"$/ do |cmd, partial_output|
214
+ stderr_from(cmd).should include(unescape(partial_output))
215
+ end
216
+
217
+ Then /^the stderr from "([^"]*)" should not contain "([^"]*)"$/ do |cmd, partial_output|
218
+ stderr_from(cmd).should_not include(unescape(partial_output))
219
+ end
220
+
221
+ Then /^the file "([^"]*)" should not exist$/ do |file_name|
222
+ check_file_presence([file_name], false)
223
+ end
224
+
225
+ Then /^the following files should exist:$/ do |files|
226
+ check_file_presence(files.raw.map{|file_row| file_row[0]}, true)
227
+ end
228
+
229
+ Then /^the following files should not exist:$/ do |files|
230
+ check_file_presence(files.raw.map{|file_row| file_row[0]}, false)
231
+ end
232
+
233
+ Then /^a file named "([^"]*)" should exist$/ do |file|
234
+ check_file_presence([file], true)
235
+ end
236
+
237
+ Then /^a file named "([^"]*)" should not exist$/ do |file|
238
+ check_file_presence([file], false)
239
+ end
240
+
241
+ Then /^the following directories should exist:$/ do |directories|
242
+ check_directory_presence(directories.raw.map{|directory_row| directory_row[0]}, true)
243
+ end
244
+
245
+ Then /^the following directories should not exist:$/ do |directories|
246
+ check_directory_presence(directories.raw.map{|directory_row| directory_row[0]}, false)
247
+ end
248
+
249
+ Then /^a directory named "([^"]*)" should exist$/ do |directory|
250
+ check_directory_presence([directory], true)
251
+ end
252
+
253
+ Then /^a directory named "([^"]*)" should not exist$/ do |directory|
254
+ check_directory_presence([directory], false)
255
+ end
256
+
257
+ Then /^the file "([^"]*)" should contain "([^"]*)"$/ do |file, partial_content|
258
+ check_file_content(file, partial_content, true)
259
+ end
260
+
261
+ Then /^the file "([^"]*)" should not contain "([^"]*)"$/ do |file, partial_content|
262
+ check_file_content(file, partial_content, false)
263
+ end
264
+
265
+ Then /^the file "([^"]*)" should contain exactly:$/ do |file, exact_content|
266
+ check_exact_file_content(file, exact_content)
12
267
  end
13
268
 
14
- Then /^aruba should fail with "([^"]*)"$/ do |error_message|
15
- @aruba_exception.message.should include(unescape(error_message))
269
+ Then /^the file "([^"]*)" should match \/([^\/]*)\/$/ do |file, partial_content|
270
+ check_file_content(file, /#{partial_content}/, true)
16
271
  end
17
272
 
18
- Then /^the following step should fail with Spec::Expectations::ExpectationNotMetError:$/ do |multiline_step|
19
- proc {steps multiline_step}.should raise_error(RSpec::Expectations::ExpectationNotMetError)
273
+ Then /^the file "([^"]*)" should not match \/([^\/]*)\/$/ do |file, partial_content|
274
+ check_file_content(file, /#{partial_content}/, false)
20
275
  end
21
276
 
22
- Then /^the output should be (\d+) bytes long$/ do |length|
23
- all_output.chomp.length.should == length.to_i
24
- end
277
+ #=end
@@ -1 +1,297 @@
1
- require 'aruba'
1
+ #require 'aruba'
2
+ require 'fileutils'
3
+ require 'rbconfig'
4
+ require 'aruba/process'
5
+
6
+ module Aruba
7
+ module Api
8
+ def in_current_dir(&block)
9
+ _mkdir(current_dir)
10
+ Dir.chdir(current_dir, &block)
11
+ end
12
+
13
+ def current_dir
14
+ File.join(*dirs)
15
+ end
16
+
17
+ def cd(dir)
18
+ dirs << dir
19
+ raise "#{current_dir} is not a directory." unless File.directory?(current_dir)
20
+ end
21
+
22
+ def dirs
23
+ @dirs ||= ['tmp/aruba']
24
+ end
25
+
26
+ def create_file(file_name, file_content, check_presence = false)
27
+ in_current_dir do
28
+ raise "expected #{file_name} to be present" if check_presence && !File.file?(file_name)
29
+ _mkdir(File.dirname(file_name))
30
+ File.open(file_name, 'w') { |f| f << file_content }
31
+ end
32
+ end
33
+
34
+ def remove_file(file_name)
35
+ in_current_dir do
36
+ FileUtils.rm(file_name)
37
+ end
38
+ end
39
+
40
+ def append_to_file(file_name, file_content)
41
+ in_current_dir do
42
+ File.open(file_name, 'a') { |f| f << file_content }
43
+ end
44
+ end
45
+
46
+ def create_dir(dir_name)
47
+ in_current_dir do
48
+ _mkdir(dir_name)
49
+ end
50
+ end
51
+
52
+ def check_file_presence(paths, expect_presence)
53
+ prep_for_fs_check do
54
+ paths.each do |path|
55
+ if expect_presence
56
+ File.should be_file(path)
57
+ else
58
+ File.should_not be_file(path)
59
+ end
60
+ end
61
+ end
62
+ end
63
+
64
+ def check_file_content(file, partial_content, expect_match)
65
+ regexp = regexp(partial_content)
66
+ prep_for_fs_check do
67
+ content = IO.read(file)
68
+ if expect_match
69
+ content.should =~ regexp
70
+ else
71
+ content.should_not =~ regexp
72
+ end
73
+ end
74
+ end
75
+
76
+ def check_exact_file_content(file, exact_content)
77
+ prep_for_fs_check { IO.read(file).should == exact_content }
78
+ end
79
+
80
+ def check_directory_presence(paths, expect_presence)
81
+ prep_for_fs_check do
82
+ paths.each do |path|
83
+ if expect_presence
84
+ File.should be_directory(path)
85
+ else
86
+ File.should_not be_directory(path)
87
+ end
88
+ end
89
+ end
90
+ end
91
+
92
+ def prep_for_fs_check(&block)
93
+ stop_processes!
94
+ in_current_dir{ block.call }
95
+ end
96
+
97
+ def _mkdir(dir_name)
98
+ FileUtils.mkdir_p(dir_name) unless File.directory?(dir_name)
99
+ end
100
+
101
+ def unescape(string)
102
+ eval(%{"#{string}"})
103
+ end
104
+
105
+ def regexp(string_or_regexp)
106
+ Regexp === string_or_regexp ? string_or_regexp : Regexp.compile(Regexp.escape(string_or_regexp))
107
+ end
108
+
109
+ def output_from(cmd)
110
+ cmd = detect_ruby(cmd)
111
+ processes[cmd].output
112
+ end
113
+
114
+ def stdout_from(cmd)
115
+ cmd = detect_ruby(cmd)
116
+ processes[cmd].stdout
117
+ end
118
+
119
+ def stderr_from(cmd)
120
+ cmd = detect_ruby(cmd)
121
+ processes[cmd].stderr
122
+ end
123
+
124
+ def all_stdout
125
+ processes.values.inject("") { |out, ps| out << ps.stdout }
126
+ end
127
+
128
+ def all_stderr
129
+ processes.values.inject("") { |out, ps| out << ps.stderr }
130
+ end
131
+
132
+ def all_output
133
+ all_stdout << all_stderr
134
+ end
135
+
136
+ def assert_exact_output(exact_output)
137
+ all_output.should == exact_output
138
+ end
139
+
140
+ def assert_partial_output(partial_output)
141
+ all_output.should include(unescape(partial_output))
142
+ end
143
+
144
+ def assert_passing_with(partial_output)
145
+ assert_exit_status_and_partial_output(true, partial_output)
146
+ end
147
+
148
+ def assert_failing_with(partial_output)
149
+ assert_exit_status_and_partial_output(false, partial_output)
150
+ end
151
+
152
+ def assert_exit_status_and_partial_output(expect_to_pass, partial_output)
153
+ assert_partial_output(partial_output)
154
+ assert_exiting_with(expect_to_pass)
155
+ end
156
+
157
+ def assert_exit_status_and_output(expect_to_pass, output, expect_exact_output)
158
+ if expect_exact_output
159
+ assert_exact_output(output)
160
+ else
161
+ assert_partial_output(output)
162
+ end
163
+ assert_exiting_with(expect_to_pass)
164
+ end
165
+
166
+ def assert_exiting_with(expect_to_pass)
167
+ if expect_to_pass
168
+ @last_exit_status.should == 0
169
+ else
170
+ @last_exit_status.should_not == 0
171
+ end
172
+ end
173
+
174
+ def install_gems(gemfile)
175
+ create_file("Gemfile", gemfile)
176
+ if ENV['GOTGEMS'].nil?
177
+ run("gem install bundler")
178
+ run("bundle --no-color install")
179
+ end
180
+ end
181
+
182
+ def processes
183
+ @processes ||= {}
184
+ end
185
+
186
+ def stop_processes!
187
+ processes.each do |_, process|
188
+ process.stop
189
+ end
190
+ end
191
+
192
+ def run(cmd)
193
+ cmd = detect_ruby(cmd)
194
+
195
+ in_current_dir do
196
+ announce_or_puts("$ cd #{Dir.pwd}") if @announce_dir
197
+ announce_or_puts("$ #{cmd}") if @announce_cmd
198
+
199
+ process = processes[cmd] = Process.new(cmd, timeout)
200
+ process.run!
201
+
202
+ block_given? ? yield(process) : process
203
+ end
204
+ end
205
+
206
+ DEFAULT_TIMEOUT_SECONDS = 1
207
+
208
+ def timeout
209
+ @aruba_timeout_seconds || DEFAULT_TIMEOUT_SECONDS
210
+ end
211
+
212
+ def run_simple(cmd, fail_on_error=true)
213
+ @last_exit_status = run(cmd) do |process|
214
+ announce_or_puts(process.stdout) if @announce_stdout
215
+ announce_or_puts(process.stderr) if @announce_stderr
216
+ process.stop
217
+ end
218
+ @timed_out = @last_exit_status.nil?
219
+
220
+ if(@last_exit_status != 0 && fail_on_error)
221
+ fail("Exit status was #{@last_exit_status}. Output:\n#{all_output}")
222
+ end
223
+ end
224
+
225
+ def run_interactive(cmd)
226
+ @interactive = run(cmd)
227
+ end
228
+
229
+ def write_interactive(input)
230
+ @interactive.stdin.write(input)
231
+ end
232
+
233
+ def announce_or_puts(msg)
234
+ if(@puts)
235
+ puts(msg)
236
+ else
237
+ announce(msg)
238
+ end
239
+ end
240
+
241
+ def detect_ruby(cmd)
242
+ if cmd =~ /^ruby\s/
243
+ cmd.gsub(/^ruby\s/, "#{current_ruby} ")
244
+ else
245
+ cmd
246
+ end
247
+ end
248
+
249
+ def current_ruby
250
+ File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
251
+ end
252
+
253
+ def use_clean_gemset(gemset)
254
+ run_simple(%{rvm gemset create "#{gemset}"}, true)
255
+ if all_stdout =~ /'#{gemset}' gemset created \((.*)\)\./
256
+ gem_home = $1
257
+ set_env('GEM_HOME', gem_home)
258
+ set_env('GEM_PATH', gem_home)
259
+ set_env('BUNDLE_PATH', gem_home)
260
+
261
+ paths = (ENV['PATH'] || "").split(File::PATH_SEPARATOR)
262
+ paths.unshift(File.join(gem_home, 'bin'))
263
+ set_env('PATH', paths.uniq.join(File::PATH_SEPARATOR))
264
+
265
+ run_simple("gem install bundler", true)
266
+ else
267
+ raise "I didn't understand rvm's output: #{all_stdout}"
268
+ end
269
+ end
270
+
271
+ def unset_bundler_env_vars
272
+ %w[RUBYOPT BUNDLE_PATH BUNDLE_BIN_PATH BUNDLE_GEMFILE].each do |key|
273
+ set_env(key, nil)
274
+ end
275
+ end
276
+
277
+ def set_env(key, value)
278
+ announce_or_puts(%{$ export #{key}="#{value}"}) if @announce_env
279
+ original_env[key] = ENV.delete(key)
280
+ ENV[key] = value
281
+ end
282
+
283
+ def restore_env
284
+ original_env.each do |key, value|
285
+ ENV[key] = value
286
+ end
287
+ end
288
+
289
+ def original_env
290
+ @original_env ||= {}
291
+ end
292
+
293
+ def ensure_newline(str)
294
+ str.chomp << "\n"
295
+ end
296
+ end
297
+ end
@@ -1,5 +1,13 @@
1
- $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
2
- require 'aruba/cucumber'
1
+ require 'aruba'
2
+ # This should only be called if the gem is vendored, otherwise it will probably attempt to write to your
3
+ # root directory!!!
4
+ Before do
5
+ @dirs = [File.expand_path(File.dirname(__FILE__) + '/../../../../../../aruba_test_dir')]
6
+ end
7
+
8
+ =begin
9
+ #$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
10
+ #require 'aruba/cucumber'
3
11
  require 'fileutils'
4
12
 
5
13
  begin
@@ -12,4 +20,5 @@ end
12
20
 
13
21
  Before do
14
22
  FileUtils.rm(Dir['config/*.yml'])
15
- end
23
+ end
24
+ =end
@@ -0,0 +1,26 @@
1
+ module Recurs
2
+ class WidgetGenerator < Rails::Generators::Base
3
+ source_root File.expand_path("../templates", __FILE__)
4
+ argument :name, :type => :string, :default => "event"
5
+
6
+ def create_instance_model
7
+ template "instance.rb.tmpl", "app/models/#{name}.rb"
8
+ #create_file "app/models#{model_name}"
9
+ end
10
+
11
+ def create_instance_views
12
+ ['index', 'show', 'edit', 'new', '_form'].each {|v|
13
+ template "views/#{v}", "app/views/#{name.downcase}/#{v}.html.haml"
14
+ }
15
+ end
16
+
17
+ def create_instance_route
18
+ insert_into_file 'config/routes.rb'
19
+ end
20
+
21
+ def create_instance_controller
22
+
23
+ end
24
+
25
+ end
26
+ end
File without changes
@@ -1,3 +1,3 @@
1
1
  module Recurs
2
- VERSION = "0.0.4.1"
2
+ VERSION = "0.0.4.2"
3
3
  end
data/recurs.gemspec CHANGED
@@ -14,6 +14,7 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.rubyforge_project = "recurs"
16
16
  s.add_dependency('ri_cal', '>= 0.8.7')
17
+ s.add_dependency('actic')
17
18
 
18
19
  s.add_development_dependency 'rspec', '~> 2.3.0'
19
20
  s.add_development_dependency 'aruba', '~> 0.2.7'
@@ -0,0 +1,13 @@
1
+ class RecursWidgetGeneratorTest < Rails::Generators::TestCase
2
+ tests Recurs::WidgetGenerator
3
+ destination File.expand_path("../tmp", File.dirname(__FILE__))
4
+ setup :prepare_destination
5
+
6
+ test "Assert all files are properly created" do
7
+ arguments %w(event)
8
+ run_generator
9
+ assert_file "config/initializers/devise.rb"
10
+ assert_file "config/locales/devise.en.yml"
11
+ end
12
+
13
+ end
metadata CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 0
7
7
  - 0
8
8
  - 4
9
- - 1
10
- version: 0.0.4.1
9
+ - 2
10
+ version: 0.0.4.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Steve Caney Martin
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-14 00:00:00 +00:00
18
+ date: 2010-12-15 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -34,9 +34,22 @@ dependencies:
34
34
  type: :runtime
35
35
  version_requirements: *id001
36
36
  - !ruby/object:Gem::Dependency
37
- name: rspec
37
+ name: actic
38
38
  prerelease: false
39
39
  requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :runtime
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: rspec
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
40
53
  none: false
41
54
  requirements:
42
55
  - - ~>
@@ -47,11 +60,11 @@ dependencies:
47
60
  - 0
48
61
  version: 2.3.0
49
62
  type: :development
50
- version_requirements: *id002
63
+ version_requirements: *id003
51
64
  - !ruby/object:Gem::Dependency
52
65
  name: aruba
53
66
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
67
+ requirement: &id004 !ruby/object:Gem::Requirement
55
68
  none: false
56
69
  requirements:
57
70
  - - ~>
@@ -62,11 +75,11 @@ dependencies:
62
75
  - 7
63
76
  version: 0.2.7
64
77
  type: :development
65
- version_requirements: *id003
78
+ version_requirements: *id004
66
79
  - !ruby/object:Gem::Dependency
67
80
  name: rake
68
81
  prerelease: false
69
- requirement: &id004 !ruby/object:Gem::Requirement
82
+ requirement: &id005 !ruby/object:Gem::Requirement
70
83
  none: false
71
84
  requirements:
72
85
  - - ">="
@@ -75,11 +88,11 @@ dependencies:
75
88
  - 0
76
89
  version: "0"
77
90
  type: :development
78
- version_requirements: *id004
91
+ version_requirements: *id005
79
92
  - !ruby/object:Gem::Dependency
80
93
  name: cucumber
81
94
  prerelease: false
82
- requirement: &id005 !ruby/object:Gem::Requirement
95
+ requirement: &id006 !ruby/object:Gem::Requirement
83
96
  none: false
84
97
  requirements:
85
98
  - - ">="
@@ -88,7 +101,7 @@ dependencies:
88
101
  - 0
89
102
  version: "0"
90
103
  type: :development
91
- version_requirements: *id005
104
+ version_requirements: *id006
92
105
  description: Specifiy you're recurrence pattern in symbols and strings and get an ical format recurrence string
93
106
  email:
94
107
  - steve@shakewell.co.uk
@@ -101,13 +114,15 @@ extra_rdoc_files: []
101
114
  files:
102
115
  - .gitignore
103
116
  - Gemfile
117
+ - Gemfile.lock
104
118
  - README
105
119
  - Rakefile
106
120
  - features/generators.feature
107
121
  - features/step_definitions/aruba_steps.rb
108
122
  - features/support/aruba.rb
109
123
  - features/support/env.rb
110
- - lib/generators/recurs_instance_generator.rb
124
+ - lib/generators/recurs_widget_generator.rb
125
+ - lib/generators/templates/controller.rb.tmpl
111
126
  - lib/generators/templates/instance.rb.tmpl
112
127
  - lib/recurs.rb
113
128
  - lib/recurs/consts.rb
@@ -119,6 +134,7 @@ files:
119
134
  - spec/models/parser_spec.rb
120
135
  - spec/models/rules_spec.rb
121
136
  - spec/spec_helper.rb
137
+ - test/generator_test.rb
122
138
  has_rdoc: true
123
139
  homepage: http://rubygems.org/gems/recurs
124
140
  licenses: []
@@ -160,3 +176,4 @@ test_files:
160
176
  - spec/models/parser_spec.rb
161
177
  - spec/models/rules_spec.rb
162
178
  - spec/spec_helper.rb
179
+ - test/generator_test.rb
@@ -1,9 +0,0 @@
1
- class RecursInstanceGenerator < Rails::Generators::Base
2
- source_root File.expand_path("../templates", __FILE__)
3
- argument :name, :type => :string, :default => "event"
4
-
5
- def create_instance_model
6
- template "instance.rb.tmpl", "app/models/#{name}.rb"
7
- #create_file "app/models#{model_name}"
8
- end
9
- end